Contract Endpoints
Contracts are legal agreements linked to organizations and entitlements. They track lifecycle from draft through active service to expiration or renewal.
Base path: /wp-json/middag-account/v1/contracts
Endpoints
| Method | Endpoint | Auth | Scope | Description |
|---|---|---|---|---|
| GET | /contracts | JWT + Org | contracts | List contracts |
| GET | /contracts/{id} | JWT + Org | contracts | Contract details |
| GET | /contracts/{id}/pdf | JWT + Org | contracts | Download contract PDF |
GET /contracts
List contracts for the current organization.
Headers: X-Middag-Organization: {org_id}
Query filters:
| Parameter | Type | Values |
|---|---|---|
status | string | draft, active, suspended, expired, cancelled, renewed |
Response (200):
json
{
"success": true,
"data": [
{
"id": 401,
"title": "Annual Service Agreement",
"status": "active",
"start_date": "2026-04-01",
"end_date": "2027-03-31",
"organization_id": 42,
"entitlement_id": 101,
"created_at": "2026-04-01T10:00:00Z"
}
],
"meta": {
"page": 1,
"per_page": 20,
"total": 1,
"pages": 1
}
}GET /contracts/:id
Full contract details including linked entitlement and document references.
Response fields: id, title, status, start_date, end_date, organization_id, entitlement_id, entitlement_code, terms, notes, created_at, updated_at.
GET /contracts/:id/pdf
Returns the contract PDF as a binary download with Content-Type: application/pdf.
Contract Statuses
| Status | Description |
|---|---|
draft | Contract created, not yet active |
active | Currently in effect |
suspended | Temporarily paused |
expired | Past end date |
cancelled | Permanently cancelled (terminal) |
renewed | Replaced by a new contract term |