Skip to content

Costs Endpoints

Fresh

Source: MainWP Costs API

Requires the Cost Tracker module to be enabled.

Endpoints

MethodPathDescription
GET/costsList costs (filter by status, category, type)
POST/PUT/PATCH/costs/addCreate cost
GET/costs/{id}Get single cost
POST/PUT/PATCH/costs/{id}/editEdit cost
DELETE/costs/{id}/removeRemove cost
GET/costs/{id}/sitesLinked sites
GET/costs/{id}/clientsLinked clients
POST/costs/batchBatch create/update/delete

Write Fields

name, price, payment_type, license_type, product_type, product_slug, renewal_type, last_renewal, payment_method, cost_tracker_status, url, note, product_color, icon_hidden

Relationship selectors: sites[], groups[], clients[] (at least one required)

Example: Create Cost

bash
curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Hosting", "price": 29.99, "payment_type": "monthly", "product_type": "hosting", "renewal_type": "auto", "sites": [1, 2, 3]}' \
  "https://your-dashboard.com/wp-json/mainwp/v2/costs/add"