Skip to main content
Use these endpoints to manage Cost Tracker entries in MainWP Dashboard.
Use the MainWP Postman collection as the source of truth for request and response schemas.
Cost endpoints require the built-in Cost Tracker module to be enabled.

Route Matrix

MethodPathPurposeKey Params
GET/costsList costspage, per_page, search, include, exclude, status, category, type
POST, PUT, PATCH/costs/addCreate a costname, price, payment_type, product_type, renewal_type, one of sites/groups/clients
GET/costs/{id}Get one costid
POST, PUT, PATCH/costs/{id}/editEdit a costSame fields as add
DELETE/costs/{id}/removeRemove a costid
GET/costs/{id}/sitesList sites linked to a costid
GET/costs/{id}/clientsList clients linked to a costid
POST/costs/batchBatch cost create/update/deletecreate[], update[], delete[]

Key Request Fields

Common write fields (create/edit):
  • name, price, payment_type, license_type, product_type, product_slug
  • renewal_type, last_renewal, payment_method, cost_tracker_status
  • url, note, visual fields like product_color, icon_hidden
  • Relationship selectors: sites[], groups[], or clients[]
At least one target set (sites, groups, or clients) is required.

Representative Requests

Create a cost

curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name":"Hosting Plan",
    "price":49.00,
    "payment_type":"subscription",
    "product_type":"hosting",
    "renewal_type":"monthly",
    "sites":[12]
  }' \
  "https://your-dashboard.com/wp-json/mainwp/v2/costs/add"
{
  "success": 1,
  "data": {
    "id": 22,
    "name": "Hosting Plan"
  }
}

Remove a cost

curl -X DELETE \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-dashboard.com/wp-json/mainwp/v2/costs/22/remove"
{
  "success": 1,
  "message": "Cost deleted successfully."
}