Skip to main content
POST
/
documents
/
add-document
Add Document
curl --request POST \
  --url https://api.zeroentropy.dev/v1/documents/add-document \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "collection_name": "<string>",
  "path": "<string>",
  "content": {
    "type": "text",
    "text": "<string>"
  },
  "metadata": {},
  "overwrite": false
}'
{
  "message": "Success!"
}

Authorizations

Authorization
string
header
required

The Authorization header must be provided in the format Bearer <your-api-key>.

You can get your API Key at the Dashboard!

Body

application/json
collection_name
string
required

The name of the collection to be used for this request. A 404 Not Found status code will be returned if this collection name does not exist.

path
string
required

The filepath of the document that you are adding. A 409 Conflict status code will be returned if this path already exists, unless overwrite is set to true.

content
object
required

The content of the document. There are three possible JSON types that can be passed into this parameter: APITextDocument, APITextPagesDocument, APIBinaryDocument. The type field is how ZeroEntropy will know which document object you have passed in.

  • APITextDocument
  • APITextPagesDocument
  • APIBinaryDocument
metadata
object

This is a metadata JSON object that can be used to assign various metadata attributes to your document. The provided object must match the type dict[str, str | list[str]]. Please read Metadata Filtering for more details. By default, the metadata will be set to {}.

NOTE: The UTF-8-encoded JSON string must be less than 65536 bytes (Whitespace does not count). This limit can be increased upon request.

overwrite
boolean
default:false

Setting this property to true will put this endpoint in "upsert" mode: If the document already exists, this action will atomically replace it.

Response

Successful Response

message
string
default:Success!

This string will always be "Success!". This may change in the future.

I