Skip to content

Quote Endpoints

Quotes represent proposals sent to organizations. They follow a lifecycle from draft through fulfillment, with automatic provisioning of entitlements upon payment.

Base path: /wp-json/middag-account/v1/quotes

Endpoints

MethodEndpointAuthScopeDescription
GET/quotesJWT + OrgquotesList quotes
GET/quotes/{id}JWT + OrgquotesQuote details
POST/quotes/{id}/acceptJWT + OrgquotesAccept quote
POST/quotes/{id}/rejectJWT + OrgquotesReject quote
GET/quotes/{id}/paymentJWT + Orgquotes + financesPayment status

GET /quotes

List quotes for the current organization.

Headers: X-Middag-Organization: {org_id}

Query filters:

ParameterTypeValues
statusstringdraft, sent, viewed, accepted, paid, fulfilled, expired, rejected, cancelled

Response (200):

json
{
    "success": true,
    "data": [
        {
            "id": 201,
            "status": "sent",
            "total": "5400.00",
            "currency": "BRL",
            "valid_until": "2026-05-15",
            "organization_id": 42,
            "line_items": [
                {
                    "product_name": "Campus EAD - Annual",
                    "quantity": 1,
                    "unit_price": "5400.00",
                    "entitlement_class": "PLG"
                }
            ],
            "created_at": "2026-04-01T10:00:00Z"
        }
    ],
    "meta": {
        "page": 1,
        "per_page": 20,
        "total": 1,
        "pages": 1
    }
}

GET /quotes/:id

Full quote details including line items, notes, and linked order/entitlement data.

Response fields: id, status, total, subtotal, currency, valid_until, organization_id, company, line_items[], order_id, entitlement_ids[], notes, rejection_reason, created_at, updated_at.

POST /quotes/:id/accept

Accept a quote. This triggers WooCommerce order creation. The quote must be in sent or viewed status.

Response (200):

json
{
    "success": true,
    "data": {
        "quote_id": 201,
        "status": "accepted",
        "order_id": 502
    },
    "message": "Quote accepted"
}

Returns 409 CONFLICT if the quote is expired, rejected, or already accepted.

POST /quotes/:id/reject

Reject a quote with an optional reason. The quote must be in sent or viewed status.

Request:

json
{
    "reason": "Budget constraints for this quarter"
}

Response (200):

json
{
    "success": true,
    "message": "Quote rejected"
}

GET /quotes/:id/payment

Check payment status for an accepted quote. Requires both quotes and finances scopes.

Quote Lifecycle

draft -> sent -> viewed -> accepted -> paid -> fulfilled
                   |           |
                   +-> expired  +-> cancelled
                   |
                   +-> rejected

When a quote reaches paid status, the middag/quote/paid hook fires and auto-provisions entitlements based on line items.

Statuses

StatusDescription
draftCreated by admin, not yet sent to client
sentDelivered to client
viewedClient has opened the quote
acceptedClient accepted, WC order created
paidPayment confirmed
fulfilledEntitlements provisioned (terminal)
expiredPast validity date without acceptance (terminal)
rejectedClient rejected the quote (terminal)
cancelledCancelled by admin (terminal)