Document Collections

Create Document Collection

POST
Create a collection of related documents with a shared metadata schema that you can search across.

Request

This endpoint expects an object.
collectionName
stringRequired
A unique name for the document collection.
embeddingsModel
stringOptional
The embeddings model to use for the document collection.
distanceMetric
enumOptional
The distance metric to use for the document collection.
Allowed values: EUCLIDEANCOSINEDOTPRODUCT
customMetadataSchema
objectOptional
Any custom metadata fields for this collection.

Response

This endpoint returns an object
documentCollectionId
UUID
POST
$curl -X POST https://api.credal.ai/api/v0/documentCollections/createDocumentCollection \
> -H "Authorization: Bearer <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "collectionName": "Customer Meeting Transcripts",
> "embeddingsModel": "text-embedding-ada-002",
> "distanceMetric": "EUCLIDEAN",
> "customMetadataSchema": {
> "fields": [
> {
> "name": "customerName",
> "type": "STRING"
> },
> {
> "name": "meetingDate",
> "type": "DATETIME"
> }
> ]
> }
>}'
Response
1{
2 "documentCollectionId": "82e4b12a-6990-45d4-8ebd-85c00e030c24"
3}