Skip to main content
POST
/
v1
/
collections
/
{collection_id}
/
sync-schema
Sync Collection Schema
curl --request POST \
  --url https://api.mixpeek.com/v1/collections/{collection_id}/sync-schema \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --header 'X-Namespace: <x-namespace>' \
  --data '
{
  "sample_size": 1000,
  "force": false,
  "cascade_to_downstream": true
}
'
{
  "success": true,
  "collection_id": "<string>",
  "schema_version": 123,
  "previous_version": 123,
  "fields_total": 123,
  "documents_sampled": 123,
  "fields_added": [
    "<string>"
  ],
  "downstream_collections_updated": [
    "<string>"
  ],
  "message": "<string>"
}

Headers

Authorization
string
required

REQUIRED: Bearer token authentication using your API key. Format: 'Bearer sk_xxxxxxxxxxxxx'. You can create API keys in the Mixpeek dashboard under Organization Settings.

X-Namespace
string
required

REQUIRED: Namespace identifier for scoping this request. All resources (collections, buckets, taxonomies, etc.) are scoped to a namespace. You can provide either the namespace name or namespace ID. Format: ns_xxxxxxxxxxxxx (ID) or a custom name like 'my-namespace'

Path Parameters

collection_id
string
required

Collection ID to sync schema for

Body

application/json

Request to sync a collection's schema by sampling documents.

Used by:

  • Manual API calls from users
  • Automatic triggers from BatchJobPoller
sample_size
integer
default:1000

Number of documents to sample for schema discovery

Required range: 1 <= x <= 10000
force
boolean
default:false

Force schema sync even if within debounce window. Default: false (respects 5-minute debounce)

cascade_to_downstream
boolean
default:true

Automatically update downstream collections that use this collection as source. Default: true

Response

Successful Response

Response from schema sync operation.

success
boolean
required

Whether schema sync succeeded

collection_id
string
required

Collection that was synced

schema_version
integer
required

New schema version

previous_version
integer
required

Previous schema version

fields_total
integer
required

Total fields in output_schema

documents_sampled
integer
required

Number of documents sampled

fields_added
string[]

List of new fields discovered

downstream_collections_updated
string[]

Downstream collections that were updated

message
string | null

Additional message or error