Skip to content

Bulk Ingestion

Auth required: Authorization: <main_api_key> header.

Inserts or updates multiple items in a single request. This is significantly faster than sending individual requests, especially for large datasets.

Example

js
await fetch("http://localhost:3000/collections/posts/items/bulk", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "SecretApiKey",
  },
  body: JSON.stringify([
    { id: "01HPT7B2X", title: "Hello World", body: "Lorem ipsum..." },
    { id: "01HPT7B2Y", title: "Second Post", body: "Dolor sit amet..." },
  ]),
});
sh
# POST /collections/{collection_name}/items/bulk
#
# Request Body:
# [
#   { "id": "01HPT7B2X", "title": "Hello World", "body": "Lorem ipsum..." },
#   { "id": "01HPT7B2Y", "title": "Second Post", "body": "Dolor sit amet..." }
# ]
#
# Response: 200 OK
# {
#   "ok": true,
#   "count": 2
# }

curl -X POST http://localhost:3000/collections/posts/items/bulk \
  -H "Content-Type: application/json" \
  -H "Authorization: SecretApiKey" \
  -d '[
    {"id": "01HPT7B2X", "title": "Hello World", "body": "Lorem ipsum..."},
    {"id": "01HPT7B2Y", "title": "Second Post", "body": "Dolor sit amet..."}
  ]'

Endpoint Definition

FieldValue
MethodPOST
Path/collections/{collection}/items/bulk

Request Body

FieldTypeDescription
(body)arrayArray of JSON objects, each with an id field matching the collection's id_type

Response Body

FieldTypeDescription
okbooleanAlways true on success
countnumberNumber of items queued for indexing