HTTP API
Upload a document
const url = 'https://sergo.example.com/v1/documents';const form = new FormData();form.append('file', 'example');form.append('folder_id', 'example');form.append('preset_id', 'example');form.append('model_id', 'example');form.append('max_credits', '1');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://sergo.example.com/v1/documents \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: multipart/form-data' \ --form file=example \ --form folder_id=example \ --form preset_id=example \ --form model_id=example \ --form max_credits=1Upload one file as form data. Needs a personal key that can write (sgk_uw_…); other keys get 422 read_only_key.
Without preset_id the file waits as Not processed until someone picks a preset in the console. With preset_id it is processed as it arrives. If a language model reads it, also send model_id and max_credits: the file waits for its page count and is processed only if the estimate fits — deferred_approval says what happened.
If the name is taken in the folder, it gets a number, such as Budget (1).pdf.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The file
Responses
Section titled “Responses”Successful Response
object
The file name, with its extension
The folder it is in
The page numbers are estimates, for a file without pages of its own
How many chunks of text processing made
All its chunks are in the search index
Pages whose text may miss a figure, chart or table — worth looking at as a picture
object
none (never processed: Not processed), queued, running, done or failed
No processor for this is running — it carries on when one starts
Things to know, such as pages with no text
For a file uploaded with preset_id that a model reads: whether it started
object
measuring: waiting for a page count before it starts. rejected: it was not processed
People this file was shared with on its own
object
The person’s username — it may be an email address
The person’s display name
object
The person’s username — it may be an email address
The person’s display name
Example
{ "chunk_count": 14, "folder_id": "Hn3pX7cR", "format": "pdf", "id": "4kTq8Wmz", "indexed": true, "name": "Leave policy.pdf", "page_count": 12, "pages_estimated": false, "pages_to_view": [ 5 ], "processing": { "changed_at": "2026-11-02T09:14:03+00:00", "preset": { "id": "basic", "name": "Basic" }, "processor": { "id": "read-pdf.pypdfium2", "name": "PDF text layer" }, "stalled": false, "state": "done", "warnings": [] }, "shared_with": [], "size_bytes": 482113, "uploaded_at": "2026-11-02T09:13:51+00:00", "uploaded_by": { "name": "Ava Bennett", "username": "ava-hr" }}Validation Error
object
What was wrong, field by field
Example
{ "code": "invalid_request"}