Skip to main content
Use /batch when you need one request to fan out into multiple controller actions.
Use the MainWP Postman collection as the source of truth for request and response schemas.

Global Batch Route

MethodPathPurposeKey Params
POST, PUT, PATCH/batchExecute grouped batch operations across multiple controllersController payload objects (sites, clients, updates, costs, tags)

Global Batch Behavior

The global /batch controller is orchestration-focused:
  • Supports grouped create requests for controllers in scope (sites, clients, updates, costs, tags)
  • Supports additional site action arrays under sites such as sync, reconnect, disconnect, suspend, check, remove, security, plugins, themes, non-mainwp-changes
  • Enforces a request item limit (mainwp_rest_batch_items_limit, default 100)

Global Batch Example

curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sites": {
      "create": [
        {"url":"https://site-a.com","name":"Site A","admin":"admin"}
      ],
      "sync": [12, 19]
    },
    "tags": {
      "create": [
        {"name":"Managed"}
      ]
    }
  }' \
  "https://your-dashboard.com/wp-json/mainwp/v2/batch"
{
  "sites": {
    "create": [{"success": 1}],
    "sync": [{"success": 1}]
  },
  "tags": {
    "create": [{"success": 1}]
  }
}

Global vs Controller-Specific Batch

Use controller-specific batch endpoints when you need dedicated CRUD batching for that controller:
  • /sites/batch
  • /clients/batch
  • /tags/batch
  • /costs/batch
Use global /batch when you need a single orchestrated request spanning multiple controller types.