Skip to content

API Keys Endpoints

Fresh

Source: MainWP API Keys

Route-level reference for MainWP REST API key management under /mainwp/v2/rest-api.

The {key_identifier} parameter accepts either numeric IDs (v2) or legacy ck_... formatted identifiers.

Route Matrix

MethodPathParameters
GET/rest-api/keyspage, per_page
POST/rest-api/add-keyactive, permissions, description
PUT/PATCH/rest-api/edit-key/{key_identifier}active, permissions, description
DELETE/rest-api/delete-key/{key_identifier}-

Permissions

write maps to the Write & Delete permission shown in the Dashboard UI.

Examples

Create API Key

bash
curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"active": true, "permissions": "both", "description": "Automation key"}' \
  "https://your-dashboard.com/wp-json/mainwp/v2/rest-api/add-key"

Disable API Key

bash
curl -X PATCH \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"active": false, "description": "Disabled - rotation"}' \
  "https://your-dashboard.com/wp-json/mainwp/v2/rest-api/edit-key/15"

API Access Management

The REST API remains active while at least one enabled key exists. To disable all API access, deactivate all keys at MainWP Dashboard > API Access > API Keys.