Costs Endpoints
FreshSource: MainWP Costs API
Requires the Cost Tracker module to be enabled.
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /costs | List costs (filter by status, category, type) |
| POST/PUT/PATCH | /costs/add | Create cost |
| GET | /costs/{id} | Get single cost |
| POST/PUT/PATCH | /costs/{id}/edit | Edit cost |
| DELETE | /costs/{id}/remove | Remove cost |
| GET | /costs/{id}/sites | Linked sites |
| GET | /costs/{id}/clients | Linked clients |
| POST | /costs/batch | Batch 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"