Indexing API (BETA) --- Overview · Datasource & properties · Index documents · Permissions
Overview
Once your datasource is configured, you can push documents toPOST /documents. Each document is identified by a unique id within its datasource. Indexing a document with an existing id will update it.
The endpoint accepts either a single document object or an array in the same request body — there is no separate bulk route. Wrap your payload in documents:
- Send file binaries --- Post the file as Base64-encoded bytes (
binary_base64) with the correctmime_type. amber handles content extraction server-side. - Send text directly --- Post
text_contentwith the content you want indexed.
Index a single document
Send aPOST request to the /documents endpoint:
status is "ok" when the document was sent; otherwise it repeats the outcome ("already_indexed" or "skipped"). Fields without a value (such as documents_received here) are omitted from the response.
Per-document outcomes
The pipeline returns one of these outcomes for each document so you can act on duplicates and skipped items:Response codes for POST /documents
The HTTP response is 200 for any well-formed request, even if individual documents fail — inspect results[*].outcome for per-document state.
Index multiple documents
Send an array underdocuments. The server processes them sequentially and returns one result per document. A failure on one document does not abort the rest — each entry’s outcome is reported individually.
Two kinds of checks apply to the request as a whole, before any document is processed:
- Structural validation --- if any document in the array is malformed (missing required field, invalid
id, unknownfile_type, …), the whole request is rejected with 422 and nothing is indexed. - Document quota --- every document in the array counts toward the per-service-account quota (500 documents per minute by default). A batch that would exceed the remaining quota is rejected with 429, and a batch larger than the quota can never succeed. The quota is charged before validation, so a batch rejected with 422 still counts (a batch rejected with 429 does not). See Limits & timing.
Document fields
For the full field reference (types, required/optional, descriptions) see Datasource & properties --- Standard document fields. A few field-level reminders:file_typeis required and must be one of the supported values listed under File types (or fetched fromGET /file-types).data_source_sub/data_source_sub_submust be slug keys that match a sub declared on the datasource (word_wordform, e.g.engineering,runbooks). amber builds the compound storage values ({datasource}__{sub_key}etc.) for you.authoris a free-form string (an email or display name); it is not an object.pathis a breadcrumb string for display (e.g.Engineering / Runbooks / Onboarding). For the URL to open the document, usepath_preview.
Content extraction (two options)
Send either
binary_base64 or text_content in body, never both.
Server processing --- Encode the file with standard Base64. Set mime_type to the real media type for that file. There is no closed list of supported types; use the correct IANA media type for whatever you upload.
Client-supplied text --- Pass text_content with the content you want indexed.
binary_base64 must be standard Base64 (A–Z, a–z, 0–9, +, /, = padding). Line breaks and other whitespace are ignored; any other character makes the request fail with 400 Bad Request (body.binary_base64 is not valid base64.).
Custom properties on documents
If your datasource has property definitions, send matching values incustom_properties on each document. Each entry is a { "name", "value" } pair where name matches a property definition key.
name must exist in the definitions, and the value must match the declared property_type. See Schema validation & errors for details.
Updating a document
To update an existing document, simply re-index it with the sameid. The entire document is replaced with the new payload:
The pipeline updates a document only when
last_modified has changed or its effective permissions have changed (a change to the permissions block — allow_anonymous_access, allowed_users, or allowed_groups):last_modifiedchanged --- the document is fully re-processed, including content extraction frombinary_base64.- Only permissions changed --- the document is updated without re-extracting binary content (
message:document sent (metadata-only update).). All other fields you send (e.g.title,path,custom_properties, andtext_content) are updated as well. - Neither changed --- nothing is updated, even if other fields (e.g.
title,body,custom_properties) differ; the response reportsoutcome: "already_indexed".
last_modified whenever you want edits to take effect.last_modified nor the access tokens have changed, nothing is re-queued and the response reports outcome: "already_indexed".
Deleting a document
DELETE /documents/{datasource}/{document_id}
Schema validation & errors
Every document is validated against the datasource’s schema (property definitions and declared sub keys) before it is persisted. If validation fails the API returns HTTP 422 with this envelope:Structural validation errors (e.g. missing required fields, invalid
id characters) use a different shape — {"detail": [...]} with one entry per offending field. The error_code envelope above is only used for the schema-validation cases listed below.Error codes
Expected value types
Envelope summary
For 401 / 403 / 422 / 429 / 500 / 502 / 503 responses that can come from any endpoint, see Common HTTP responses on the overview page.
Next steps
Permissions
Configure fine-grained access controls for your documents.
Datasource & custom properties
Adjust object types, sub-datasources, and property schemas on the datasource.