Skip to main content
POST
/
v1
/
documents
/
Upload Document
curl --request POST \
  --url https://api.agentoffice.dev/v1/documents/ \
  --header 'Content-Type: application/json' \
  --data '{
  "ttl_seconds": 123,
  "return_markdown": true
}'
{
  "detail": "File type not supported. Please upload a .docx or .pdf file"
}

Upload a Document

Upload a Microsoft Word (.docx) or PDF file to create a new document in Agent Office. The document will be stored and ready for AI-powered editing.

Request Parameters

file
file
required
The document file to upload (Word .docx or PDF)
ttl_seconds
integer
Time to live in seconds (300-21600). Default is 3600 (1 hour). The TTL is refreshed after each edit.
return_markdown
boolean
If true, returns a markdown representation of the document. Default is false.

Response

docId
string
required
Unique identifier for the uploaded document (UUID format)
name
string
required
Original filename of the uploaded document
createdAt
string
required
ISO 8601 timestamp when the document was created
fileType
string
required
MIME type of the uploaded file
imageAnnotations
array
Array of image annotations if the document contains images
markdown
string
Markdown representation of the document (only if return_markdown=true)

Example Response

{
  "docId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "document.docx",
  "createdAt": "2024-01-15T10:30:00Z",
  "fileType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
  "imageAnnotations": null,
  "markdown": null
}
The docId from the response is required for all subsequent operations (editing, downloading, etc.)

Error Responses

{
  "detail": "File type not supported. Please upload a .docx or .pdf file"
}
I