Skip to content

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

MethodEndpointAuthScopeDescription
GET/contractsJWT + OrgcontractsList contracts
GET/contracts/{id}JWT + OrgcontractsContract details
GET/contracts/{id}/pdfJWT + OrgcontractsDownload contract PDF

GET /contracts

List contracts for the current organization.

Headers: X-Middag-Organization: {org_id}

Query filters:

ParameterTypeValues
statusstringdraft, 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

StatusDescription
draftContract created, not yet active
activeCurrently in effect
suspendedTemporarily paused
expiredPast end date
cancelledPermanently cancelled (terminal)
renewedReplaced by a new contract term