Skip to main content
PATCH
/
v1
/
collections
/
{collection_identifier}
/
documents
/
bulk
Bulk Update Documents
curl --request PATCH \
  --url https://api.mixpeek.com/v1/collections/{collection_identifier}/documents/bulk \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Namespace: <x-namespace>' \
  --data '{
  "description": "Update all pending documents to processed",
  "filters": {
    "must": [
      {
        "key": "metadata.status",
        "value": "pending"
      }
    ]
  },
  "update_data": {
    "metadata": {
      "status": "processed"
    }
  }
}'
{
  "updated_count": 123,
  "message": "Documents updated successfully"
}

Authorizations

Authorization
string
header
required

Bearer token authentication using your API key. Format: 'Bearer your_api_key'. To get an API key, create an account at mixpeek.com/start and generate a key in your account settings.

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.

Examples:

"Bearer sk_live_abc123def456"

"Bearer sk_test_xyz789"

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'

Examples:

"ns_abc123def456"

"production"

"my-namespace"

Path Parameters

collection_identifier
string
required

The ID of the collection to update documents in.

Body

application/json

Request model for bulk updating documents by filters.

Updates ALL documents matching the provided filters with the SAME update_data. For updating specific documents by ID or different values per document, use BatchUpdateDocumentsRequest.

Use Cases: - Update all pending documents to processed - Update all documents from a specific date range - Apply uniform changes across filtered document sets

Requirements: - update_data: REQUIRED - fields to update on all matching documents - filters: OPTIONAL - if omitted, updates ALL documents in collection

update_data
object
required

REQUIRED. Dictionary of field-value pairs to update on ALL matching documents. Can update any document field except vectors (metadata, internal_metadata, source_blobs, etc.). All matched documents receive the SAME updates. Example: {'metadata.status': 'processed', 'metadata.reviewed': true}

Examples:
{
"metadata": { "reviewed": true, "status": "processed" }
}
{
"internal_metadata.processing_complete": true
}
filters
object | null

OPTIONAL. Filter conditions to match documents for update. If not provided, updates ALL documents in the collection. Supports complex logical operators (AND, OR, NOT). Example: {'must': [{'key': 'metadata.status', 'value': 'pending'}]} Represents a logical operation (AND, OR, NOT) on filter conditions.

Allows nesting with a defined depth limit.

Also supports shorthand syntax where field names can be passed directly as key-value pairs for equality filtering (e.g., {"metadata.title": "value"}).

Examples:
{
"must": [
{
"key": "metadata.status",
"value": "pending"
}
]
}
{
"must": [
{
"gt": "2024-01-01",
"key": "metadata.created_at"
}
]
}

Response

Successful Response

Response model for bulk document update operation.

updated_count
integer
required

Number of documents that were updated.

message
string
default:Documents updated successfully