Skip to main content
POST
Create a document upload

Authorizations

Authorization
string
header
required

A project API key, created in the dashboard.

Headers

Idempotency-Key
string

A unique key that makes the request safe to retry, such as a V4 UUID. 1 to 255 printable ASCII characters.

Required string length: 1 - 255

Body

application/json
agent_id
string
required
Maximum string length: 64
filename
string
required

The file's name, with its extension: .pdf, .txt, .doc, or .docx. The extension sets the file's content type.

Maximum string length: 255
Example:

"Handbook.pdf"

size
integer
required

The file's exact size in bytes, up to the plan's document size limit. Storage rejects files of any other size.

Required range: x >= 1
Example:

482133

Response

The upload, with the form for uploading the file.

object
any
required
id
string
required

Pass as document.upload_id to add the document once its file is uploaded.

Example:

"9b2e7c41-8d3a-4f6e-a1b5-2c7d9e0f3a64"

agent
object
required

The agent this belongs to.

filename
string
required

The file name you passed, without folders.

Example:

"Handbook.pdf"

size
integer
required
Example:

482133

content_type
string
required
Example:

"application/pdf"

upload
object
required

Upload the file to url with a multipart/form-data POST: every field in fields, then the file as the last field, named file. Don't send your API key to this URL.

expires_at
string<date-time>
required

Time by which the file must be uploaded, 5 minutes after the upload is created. If it expires, create a new upload.