Skip to main content
Manage child sites connected to your MainWP Dashboard through these endpoints.

What You’ll Learn

  • Site listing and filtering endpoints
  • Adding, editing, and removing sites
  • Syncing and connectivity checks
  • Plugin and theme management per site

GET /sites/

Returns basic information for all child sites with pagination support. Method: GET (readonly)
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/?per_page=20"

Parameters

NameTypeRequiredDefaultDescription
pageintegerNo1Page number
per_pageintegerNo10Items per page
searchstringNoSearch in site name and URL
includestringNoComma-separated site IDs to include
excludestringNoComma-separated site IDs to exclude
statusstringNoanyFilter: any, connected, disconnected, suspended, available_update

Response

[
  {
    "id": 1,
    "url": "https://example.com",
    "name": "My Site",
    "status": "connected",
    "wp_version": "6.4.2",
    "php_version": "8.2",
    "last_sync": "2024-01-15T10:30:00"
  }
]

GET /sites/

Returns detailed information about a specific child site. Method: GET (readonly)
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/1"

Parameters

NameTypeRequiredDescription
siteinteger/stringYesSite ID or domain

Response

{
  "id": 1,
  "url": "https://example.com",
  "name": "My Site",
  "status": "connected",
  "wp_version": "6.4.2",
  "php_version": "8.2",
  "mysql_version": "8.0",
  "admin_email": "[email protected]",
  "plugins_count": 15,
  "themes_count": 3,
  "last_sync": "2024-01-15T10:30:00",
  "health_score": 85
}

PUT /sites/add

Adds a new child site to the Dashboard. Method: PUT
curl -X PUT \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "name": "My Site", "admin": "admin"}' \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/add"

Parameters

NameTypeRequiredDescription
urlstringYesChild site URL (must have MainWP Child plugin active)
namestringYesDisplay name for the site
adminstringYesAdmin username on the child site
groupidsstringNoComma-separated tag/group IDs
client_idintegerNoClient ID to associate site with

Response

{
  "id": 5,
  "url": "https://example.com",
  "name": "My Site",
  "status": "connected",
  "message": "Site added successfully"
}

PUT /sites//edit

Updates a site’s properties. Method: PUT
curl -X PUT \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/1/edit?name=Updated%20Name"

Parameters

NameTypeRequiredDescription
siteinteger/stringYesSite ID or domain
namestringNoNew display name
groupidsstringNoComma-separated tag IDs
client_idintegerNoNew client ID

Response

{
  "id": 1,
  "name": "Updated Name",
  "message": "Site updated successfully"
}

DELETE /sites/

Removes a child site from the Dashboard. Method: DELETE
This action is destructive and cannot be undone. The child site itself is not affected, only the Dashboard connection.
curl -X DELETE \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/1"

Parameters

NameTypeRequiredDescription
siteinteger/stringYesSite ID or domain

Response

{
  "success": true,
  "message": "Site removed successfully"
}

POST /sites/sync

Triggers synchronization for all sites. Responds immediately; sync runs in the background. Method: POST
curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/sync"

Parameters

NameTypeRequiredDescription
includestringNoOnly sync these site IDs
excludestringNoSkip these site IDs

Response

{
  "success": 1,
  "message": "Sync initiated for all sites"
}

POST /sites//sync

Syncs a specific child site. Method: POST
curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/1/sync"

Parameters

NameTypeRequiredDescription
siteinteger/stringYesSite ID or domain

Response

{
  "id": 1,
  "url": "https://example.com",
  "status": "connected",
  "last_sync": "2024-01-15T10:30:00",
  "message": "Site synced successfully"
}

POST /sites/check

Runs connectivity checks for all sites. Method: POST
curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/check"

Parameters

NameTypeRequiredDescription
includestringNoOnly check these site IDs
excludestringNoSkip these site IDs

Response

{
  "success": 1,
  "message": "Check initiated for all sites"
}

GET /sites//plugins

Returns plugins installed on a child site. Method: GET (readonly)
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/1/plugins"

Parameters

NameTypeRequiredDescription
siteinteger/stringYesSite ID or domain
pageintegerNoPage number
per_pageintegerNoItems per page
searchstringNoSearch plugin names
statusstringNoFilter: active, inactive, update_available
must_useintegerNoSet to 1 for MU plugins only

Response

[
  {
    "name": "Akismet Anti-spam",
    "slug": "akismet/akismet.php",
    "version": "5.3",
    "status": "active",
    "update_available": false
  }
]

POST /sites//plugins/activate

Activates a plugin on a child site. Method: POST
curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/1/plugins/activate?slug=akismet/akismet.php"

Parameters

NameTypeRequiredDescription
siteinteger/stringYesSite ID or domain
slugstringYesPlugin slug (e.g., akismet/akismet.php)

Response

{
  "success": true,
  "plugin": "akismet/akismet.php",
  "status": "active",
  "message": "Plugin activated successfully"
}

POST /sites//plugins/deactivate

Deactivates a plugin on a child site. Method: POST
curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/1/plugins/deactivate?slug=akismet/akismet.php"

Parameters

NameTypeRequiredDescription
siteinteger/stringYesSite ID or domain
slugstringYesPlugin slug

Response

{
  "success": true,
  "plugin": "akismet/akismet.php",
  "status": "inactive",
  "message": "Plugin deactivated successfully"
}

GET /sites//themes

Returns themes installed on a child site. Method: GET (readonly)
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/1/themes"

Parameters

NameTypeRequiredDescription
siteinteger/stringYesSite ID or domain
pageintegerNoPage number
per_pageintegerNoItems per page
searchstringNoSearch theme names
statusstringNoFilter: active, inactive, update_available

Response

[
  {
    "name": "Twenty Twenty-Four",
    "slug": "twentytwentyfour",
    "version": "1.0",
    "status": "active",
    "update_available": false
  }
]

POST /sites//themes/activate

Activates a theme on a child site. Method: POST
curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/1/themes/activate?slug=twentytwentyfour"

Parameters

NameTypeRequiredDescription
siteinteger/stringYesSite ID or domain
slugstringYesTheme slug

Response

{
  "success": true,
  "theme": "twentytwentyfour",
  "status": "active",
  "message": "Theme activated successfully"
}

GET /sites//non-mainwp-changes

Returns changes made to the site outside of MainWP. Method: GET (readonly)
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/1/non-mainwp-changes"

Parameters

NameTypeRequiredDescription
siteinteger/stringYesSite ID or domain

Response

{
  "plugins_installed": ["hello-dolly/hello.php"],
  "plugins_updated": [],
  "themes_installed": [],
  "themes_updated": [],
  "core_updated": false
}

POST /sites//reconnect

Attempts to reconnect a disconnected child site. Method: POST
curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/1/reconnect"

Parameters

NameTypeRequiredDescription
siteinteger/stringYesSite ID or domain

Response

{
  "id": 1,
  "url": "https://example.com",
  "status": "connected",
  "message": "Site reconnected successfully"
}

POST /sites//suspend

Suspends a child site, preventing sync and updates. Method: POST
curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/1/suspend"

Parameters

NameTypeRequiredDescription
siteinteger/stringYesSite ID or domain

Response

{
  "id": 1,
  "status": "suspended",
  "message": "Site suspended successfully"
}

POST /sites//unsuspend

Removes suspension from a child site. Method: POST
curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/sites/1/unsuspend"

Parameters

NameTypeRequiredDescription
siteinteger/stringYesSite ID or domain

Response

{
  "id": 1,
  "status": "connected",
  "message": "Site unsuspended successfully"
}