Bulk Operations
Efficiently update or delete up to 100 records in a single request with partial success handling and detailed error reporting.
Bulk Operations
FastCMS provides bulk operations to efficiently update or delete multiple records at once. Instead of making individual API calls for each record, you can process up to 100 records in a single request.
Features
- Bulk Delete — Delete multiple records in one operation
- Bulk Update — Update the same field(s) across multiple records
- Partial Success Handling — Operations continue even if some records fail
- Detailed Error Reporting — Get specific error messages for failed operations
- Access Control — Respects collection permissions for each record
Via Admin UI
Selecting Records
- Navigate to any collection's records page
- Use checkboxes to select records:
- Select individual records: Click the checkbox next to each record
- Select all records: Click the checkbox in the table header
- Selected count is displayed in the header
Bulk Delete
- Select the records you want to delete
- Click the Delete Selected button
- Confirm the deletion in the dialog
- See the operation summary (successful and failed counts)
Bulk Update
- Select the records you want to update
- Click the Update Selected button
- In the modal:
- Choose which field to update from the dropdown
- Enter the new value for that field
- Click Update Records
- See the operation summary (successful and failed counts)
Via API
Bulk Delete Records
Delete multiple records in a single request.
Endpoint: POST /api/v1/collections/{collection_name}/records/bulk-delete
Request Body:
{
"record_ids": [
"record_id_1",
"record_id_2",
"record_id_3"
]
}Response:
{
"success": 2,
"failed": 1,
"errors": [
{
"record_id": "record_id_3",
"error": "Record not found"
}
]
}cURL Example:
curl -X POST "http://localhost:8000/api/v1/collections/posts/records/bulk-delete" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"record_ids": ["abc123", "def456", "ghi789"]
}'Python Example:
import requests
response = requests.post(
'http://localhost:8000/api/v1/collections/posts/records/bulk-delete',
json={
'record_ids': ['abc123', 'def456', 'ghi789']
},
headers={'Authorization': 'Bearer YOUR_TOKEN'}
)
result = response.json()
print(f"Successfully deleted: {result['success']}")
print(f"Failed: {result['failed']}")
if result['errors']:
print(f"Errors: {result['errors']}")Bulk Update Records
Update the same field(s) across multiple records.
Endpoint: POST /api/v1/collections/{collection_name}/records/bulk-update
Request Body:
{
"record_ids": [
"record_id_1",
"record_id_2",
"record_id_3"
],
"data": {
"status": "published",
"priority": 1
}
}cURL Example:
curl -X POST "http://localhost:8000/api/v1/collections/posts/records/bulk-update" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"record_ids": ["abc123", "def456"],
"data": {
"status": "published",
"featured": true
}
}'Error Handling
Bulk operations use partial success — if some records fail, the operation continues processing the remaining records.
Partial Success Response:
{
"success": 3,
"failed": 2,
"errors": [
{
"record_id": "abc123",
"error": "Record not found"
},
{
"record_id": "def456",
"error": "Insufficient permissions"
}
]
}Always check the response to handle failures:
result = bulk_delete(record_ids)
if result['failed'] > 0:
print(f"Warning: {result['failed']} records failed")
for error in result['errors']:
print(f" - {error['record_id']}: {error['error']}")Batching Large Operations
For more than 100 records, split into batches:
def bulk_delete_all(record_ids, batch_size=100):
for i in range(0, len(record_ids), batch_size):
batch = record_ids[i:i + batch_size]
result = bulk_delete(batch)
print(f"Batch {i//batch_size + 1}: {result['success']} deleted")Limitations
| Constraint | Value |
|---|---|
| Maximum records per request | 100 |
| Minimum records required | 1 |
| Authentication | Required |
| Processing mode | Sequential |
Access Control
Bulk operations respect collection access control rules:
- Bulk Delete — Requires delete permission on each individual record
- Bulk Update — Requires update permission on each individual record
If a collection has delete_rule = "@request.auth.id = @record.user_id", bulk deleting 10 records where the user owns 7 will succeed for 7 and fail for 3.
Performance
| Records | Estimated Time |
|---|---|
| 10 | ~100–200ms |
| 50 | ~500ms–1s |
| 100 | ~1–2s |
For thousands of records, consider background jobs instead.