v2

latestOpenAPI 3.1.02026-08-0382170235.8 KB
context-attachments

Create a context_attachment from a file upload (≤80KB)

Create a context_attachment on the given document via multipart form-data. Use this when the payload exceeds 16 KB; for smaller inline text payloads use the JSON-body variant of this endpoint.

The uploaded file MUST be valid UTF-8 text — extraction injects the raw bytes into the LLM prompt, so non-UTF-8 binaries cannot be decoded.

post/documents/{document_id}/context-attachments/upload

Path parameters

document_idstring uuid required

Response

Attachment created and stored

attachment_idstring uuid

UUIDv7 — chronologically sortable. Stable order for prompt assembly.

workspace_idstring uuid required

Owning workspace; multi-tenant isolation key.

document_idstring uuid required

Document this attachment travels with.

type'author_note' | 'json_schema' required

Vocabulary label (see CreateRequest).

namestring required
content_textstring nullable

Set for inline (≤16KB) attachments. Mutually exclusive with s3_key — see the model_validator below.

s3_keystring nullable

Set for >16KB attachments stored on the FileStorageBackend. Mutually exclusive with content_text. The repository computes this; callers never set it via the create endpoint.

mime_type'text/plain' | 'application/json' | 'application/schema+json' required

MIME type of the payload (text/plain | application/json | application/schema+json).

byte_sizeinteger required

Encoded UTF-8 byte size of the payload. Used for cap math at extract time.

created_atstring date-time