What You’ll Learn
- Understanding batch thresholds and affected abilities
- Reading immediate vs. queued response patterns
- Monitoring batch job status
- Handling errors in batch operations
Batch Threshold
The default threshold is 200 sites. Operations below this threshold execute synchronously and return results immediately.Affected Abilities
These abilities support batch queuing:| Ability | Description |
|---|---|
mainwp/sync-sites-v1 | Sync multiple sites |
mainwp/run-updates-v1 | Execute updates across sites |
mainwp/update-all-v1 | Apply all updates |
mainwp/reconnect-sites-v1 | Batch reconnect |
mainwp/disconnect-sites-v1 | Batch disconnect |
mainwp/check-sites-v1 | Batch connectivity check |
mainwp/suspend-sites-v1 | Batch suspend |
Response Patterns
Immediate Response (≤200 sites)
Queued Response (>200 sites)
mainwp/get-batch-job-status-v1
Retrieves the current status of a queued batch operation. Method: POSTInput Parameters
| Name | Type | Required | Description |
|---|---|---|---|
job_id | string | Yes | Job ID from queued operation |
Response
Status Values
| Status | Description |
|---|---|
queued | Waiting to start |
processing | Currently running |
completed | Finished successfully |
failed | Failed with errors |
Polling Workflow
Job Lifecycle
| Property | Value | Description |
|---|---|---|
| TTL | 24 hours | Jobs expire after completion |
| Timeout | 4 hours | Maximum runtime |
| Chunk Size | 20 sites | Sites processed per cron run |
| Reschedule Delay | 30 seconds | Delay between chunks |
Error Handling
When a batch job encounters errors, individual failures are recorded while the job continues processing remaining items. Check theerrors array in the status response for details:
status: "completed" if any operations succeeded, or status: "failed" if all operations failed.
Related Resources
- Abilities API Overview - API basics and authentication
- Sites Abilities - Site management abilities
- Updates Abilities - Update management abilities