Skip to main content
Use these endpoints to manage REST API keys programmatically.
Use the MainWP Postman collection as the source of truth for request and response schemas.
{key_identifier} accepts either a numeric key ID (v2) or a ck_... key identifier (legacy key format).

Route Matrix

MethodPathPurposeKey Params
GET/rest-api/keysList API keyspage, per_page
POST/rest-api/add-keyCreate a new API keyactive (bool), permissions (read, write, delete combos), optional description
PUT, PATCH/rest-api/edit-key/{key_identifier}Edit key propertieskey_identifier, optional active, permissions, description
DELETE/rest-api/delete-key/{key_identifier}Delete an API keykey_identifier

Representative Requests

Create API key

curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "active": true,
    "permissions": "read,write",
    "description": "Automation key"
  }' \
  "https://your-dashboard.com/wp-json/mainwp/v2/rest-api/add-key"
{
  "success": 1,
  "message": "API Key created successfully.",
  "token": "GENERATED_TOKEN"
}

Edit API key

curl -X PATCH \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"active": false, "description": "Temporarily disabled"}' \
  "https://your-dashboard.com/wp-json/mainwp/v2/rest-api/edit-key/15"
{
  "success": 1,
  "message": "API Key updated successfully."
}