Skip to content
DocsAPI Overview

API Reference

The MantleWP API lets you manage sites, generate reports, and access health data programmatically. All endpoints return JSON.

Base URL

https://mantlewp.com/api

Authentication

MantleWP supports two authentication methods depending on context. Session auth is used by the dashboard via NextAuth.js cookies. API Key auth is used by the WordPress plugin via the X-MantleWP-Key header. See Authentication for details.

Response Format

All responses return a consistent JSON structure. Success responses:

{
  "data": { ... }
}

Error responses:

{
  "error": {
    "message": "Human-readable error",
    "code": "ERROR_CODE",
    "details": { ... }
  }
}

Rate Limiting

Endpoints are rate-limited per API key or session to prevent abuse. When you exceed the limit, the API returns 429 Too Many Requests. Retry after a short delay.

Endpoint Overview

Sites

MethodEndpointDescriptionAuth
POST/api/sitesAdd a new siteSession
GET/api/sitesList all sitesSession
GET/api/sites/[id]Get site detailsSession
PUT/api/sites/[id]Update siteSession
DELETE/api/sites/[id]Remove siteSession

Reports

MethodEndpointDescriptionAuth
POST/api/reportsCreate report recordSession
GET/api/reportsList reportsSession
GET/api/reports/[id]Get report detailsSession
POST/api/reports/generateGenerate PDF reportSession
POST/api/reports/[id]/sendEmail report to clientsSession

Schedules

MethodEndpointDescriptionAuth
GET/api/schedulesList schedulesSession
POST/api/schedulesCreate scheduleSession
PUT/api/schedules/[id]Update scheduleSession
DELETE/api/schedules/[id]Delete scheduleSession

Branding

MethodEndpointDescriptionAuth
GET/api/brandingGet branding settingsSession
PUT/api/brandingUpdate brandingSession
POST/api/branding/logoUpload logoSession

Ingest (WordPress Plugin)

MethodEndpointDescriptionAuth
POST/api/ingest/healthSubmit health dataAPI Key
POST/api/ingest/pluginsSubmit plugin inventoryAPI Key
POST/api/ingest/heartbeatUptime heartbeatAPI Key

Billing

MethodEndpointDescriptionAuth
POST/api/billing/checkoutCreate checkout sessionSession
POST/api/billing/portalOpen billing portalSession

Webhooks

MethodEndpointDescriptionAuth
POST/api/webhooks/stripeStripe webhook handlerStripe signature

Error Codes

StatusMeaning
400Bad Request — invalid parameters or malformed request body
401Unauthorized — missing or invalid authentication
403Forbidden — authenticated but insufficient permissions
404Not Found — resource does not exist
429Rate Limited — too many requests
500Internal Server Error — unexpected server issue