POST
/
datastores
/
{datastore_id}
/
documents
curl --request POST \
  --url https://api.contextual.ai/v1/datastores/{datastore_id}/documents \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'metadata={"field1": "value1", "field2": "value2"}}'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

datastore_id
string
required

Datastore ID of the datastore in which to ingest the document

Body

multipart/form-data
file
file
required

File to ingest.

metadata
string

Metadata in JSON format. Metadata should be passed as a nested dictionary structure where:

  • The metadata type custom_metadata is mapped to a dictionary. - The dictionary keys represent metadata attributes. - The values can be of type str, bool, float, or int.

Example Metadata JSON:

metadata = {
    "custom_metadata": {
        "field1": "value1",
        "field2": "value2"
     }
}
Example:

"{\"field1\": \"value1\", \"field2\": \"value2\"}}"

Response

200
application/json
Successful Response

Response body from POST /data/documents

id
string
required

ID of the document being ingested