Batch
Batch write operations
Batch upsert and delete documents
POST
/batch/{tableSlug}Perform batch operations (upserts and deletes) on an AntflyDB table. If tableSlug is empty or not found, uses the project's default table.
- Inserts are upserts: if key exists, document is replaced; if not, it's created
- Deletes are simple key deletions
Security
Provide your bearer token in the Authorization header when making requests to protected resources.
Example: Authorization: Bearer YOUR_API_KEY
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
tableSlug | string | path | Yes | Table slug (or empty string for default table) |
Request Body
Example:
{
"inserts": [
{
"id": "string",
"document": {}
}
],
"deletes": [
"string"
]
}
Code Examples
curl -X POST "https://searchaf.antfly.io/api/v1/batch/products" \\
-H "Authorization: Bearer YOUR_API_KEY" \\
-H "Content-Type: application/json" \\
-d '{
"inserts": [
{
"id": "string",
"document": {}
}
],
"deletes": [
"string"
]
}'Responses
{
"inserted": 0,
"deleted": 0,
"errors": [
{
"id": "string",
"error": "string"
}
]
}