POST /search/indexes/{name}/documents
Add or update documents
Add or replace up to 1,000 documents in an index, all or nothing. Use when loading or syncing the app's records into an index. Before: search_get_index (needs search query access) for the fields. Returns the task: indexed, unchanged and stale counts, and the receipt. Scope: search:write. Reuse the same idempotency_key on retry.
API key (Bearer), on the public API endpoint.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
name | path | string · required | Index name. |
Idempotency-Key | header | string · required |
Request body
application/json
| Field | Type | Description |
|---|---|---|
documents | array<object> · required | The documents. A document with an existing id replaces it. |
Responses
| Status | Description | Body |
|---|---|---|
2XX | Success: the JSON body the route returns (see the description for its fields). | object |
401 | Key missing or invalid | Error |
4XX | Refused: act on detail.code, then follow detail.next_action (404 not_found while the service is not open to the account). | Error |
Examples
curl
curl -X POST "$GALON_API_BASE/search/indexes/<name>/documents" \
-H "Authorization: Bearer $GALON_API_KEY" \
-H "Idempotency-Key: <unique-key>" \
-H "Content-Type: application/json" \
-d '{"documents": [{}]}'