Global Batch Endpoint
FreshSource: MainWP Batch API
Execute grouped batch operations across multiple controllers in a single request.
Endpoint
POST /wp-json/mainwp/v2/batch
Supported Controllers
sites, clients, updates, costs, tags
Additional Site Actions
sync, reconnect, disconnect, suspend, check, remove, security, plugins, themes, non-mainwp-changes
Limits
Default item limit: 100 items per request (mainwp_rest_batch_items_limit).
Example: Multi-Controller Batch
bash
curl -X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sites": {
"create": [{"url": "https://newsite.com", "admin": "admin"}]
},
"tags": {
"create": [{"name": "Staging"}]
},
"sites_sync": [1, 2, 3]
}' \
"https://your-dashboard.com/wp-json/mainwp/v2/batch"Global vs Controller-Specific
| Use | Endpoint |
|---|---|
| Multi-controller operations | /batch |
| Sites CRUD only | /sites/batch |
| Clients CRUD only | /clients/batch |
| Tags CRUD only | /tags/batch |
| Costs CRUD only | /costs/batch |