Optimaite

Documents

3 min readUpdated May 26, 2026Auch auf Deutsch verfuegbar

The Documents API lets you programmatically manage documents -- upload files, download content, assign documents to cases and parties, and extract text.

Endpoints

MethodPathDescription
GET/api/v1/documentsList documents
POST/api/v1/documentsUpload a document
GET/api/v1/documents/{id}Get document metadata
GET/api/v1/documents/{id}/downloadDownload file content
DELETE/api/v1/documents/{id}Delete a document
POST/api/v1/documents/{id}/assignAssign to case/party
GET/api/v1/documents/{id}/partiesList assigned parties
POST/api/v1/documents/{id}/extractExtract text content
POST/api/v1/documents/bulk-assignBulk assign documents

Required scope: documents:read for GET endpoints, documents:write for POST/PUT, documents:delete for DELETE.

The Document Object

{
  "id": "doc_01ABCDEFG",
  "filename": "contract_v2.pdf",
  "mime_type": "application/pdf",
  "size_bytes": 245760,
  "status": "processed",
  "case_id": "550e8400-e29b-41d4-a716-446655440000",
  "folder_id": "fld_01ABCDEF",
  "parties": [
    { "id": "pty_01ABCDEF", "name": "John Smith", "is_primary": true }
  ],
  "extracted_text_length": 12543,
  "created_at": "2026-03-10T08:30:00Z",
  "updated_at": "2026-03-10T08:31:00Z"
}

Upload a Document

POST /api/v1/documents
Content-Type: multipart/form-data

Form Fields

FieldTypeRequiredDescription
fileFileYesThe file to upload (PDF, DOCX, DOC, PNG, JPG, TIFF)
case_idUUIDNoAssign to a case immediately
folder_idUUIDNoPlace in a specific folder
party_idsstring[]NoAssign to parties

Example

curl -X POST https://api.optimaite.eu/api/v1/documents \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@contract.pdf" \
  -F "case_id=550e8400-e29b-41d4-a716-446655440000"

Response

Returns 201 Created with the document metadata.

Download a Document

GET /api/v1/documents/{id}/download

Returns the raw file content as a streaming response with the appropriate Content-Type and Content-Disposition headers.

Extract Text

POST /api/v1/documents/{id}/extract

Returns the extracted text content of a document:

{
  "text": "This Employment Agreement (\"Agreement\") is entered into...",
  "page_count": 5,
  "word_count": 3241
}

Supported file types: PDF, DOCX, DOC, images (via OCR), and plain text.

List Documents

GET /api/v1/documents?case_id=...&status=processed&limit=50

Query Parameters

ParameterTypeDescription
cursorstringPagination cursor
limitintegerResults per page (1-100, default 50)
case_idUUIDFilter by case
folder_idUUIDFilter by folder
statusstringFilter: pending, processed, failed
searchstringSearch by filename

Next Steps

  • Cases -- Manage cases for document assignment
  • Signing -- Promote documents for e-signature
Was this helpful?