Contracts API
Fetch contract metadata and billing roll-up for a project's contracted version.
GET /api/v1/contracts/{id}
Get a contract's metadata. Includes the frozen approval snapshot (rates, total amount, billed-to-date) plus any frozen rooms/lines persisted at approval time.
Response (200 OK)
{
"id": 88,
"versionId": 17,
"tenantId": "tenant-abc",
"approvedAt": "2025-04-18T14:05:00Z",
"approvedByUserId": "auth0|abc123",
"rates": {
"taxRate": 8.250
},
"jobSiteAddress": "123 Main St, Seattle, WA",
"shipToName": "Acme HQ",
"shipToAddress": "123 Main St, Seattle, WA",
"shipToContact": "ops@acme.example",
"totalAmount": 57295.90,
"amountBilledToDate": 28647.95,
"rooms": [ /* frozen room snapshots */ ],
"lines": [ /* frozen line snapshots */ ]
}
Errors
404 Not Found— contract does not exist for your tenant.
GET /api/v1/contracts/{id}/billing-summary
Roll-up of the contract's billing state plus approved Change Order totals. Includes the project's currency code, localized tax label, and the contract's snapshotted tax rate so consumers can format amounts correctly without a follow-up project lookup.
Response (200 OK)
{
"contractId": 88,
"isTimeAndMaterials": false,
"contractTotal": 28000.00,
"contractTaxAmount": 2216.00,
"contractBilled": 14000.00,
"contractRemaining": 14000.00,
"creditsTotal": 0.00,
"approvedChangeOrders": 1,
"changeOrderTotal": 440.00,
"changeOrderBilled": 0.00,
"changeOrderRemaining": 440.00,
"billableSubtotal": 28440.00,
"billableTax": 2251.20,
"billedSubtotal": 14000.00,
"billedTax": 1108.00,
"billingDifference": 15583.20,
"currency": "USD",
"taxLabel": "Tax",
"taxRate": 8.000
}
contractTaxAmount- The tax frozen on the contract when it was signed;nullon a contract signed before contract tax was stored. Untaxed project fees carry no tax.creditsTotal- The approved client-charge credit change orders (zero or less), already taken offcontractRemaining.billableSubtotal/billableTax- What the contract and its billable change orders bill in all, before tax and tax, credits taken off. Their sum is the figure the invoice window's banner shows.billedSubtotal/billedTax- What the non-voided invoices have billed.isTimeAndMaterials-truefor a contract approved as T&M (time and materials): no fixed price, socontractTotalis 0 and the contract's billed, billable and remaining figures are what its hours-and-parts invoices have billed (the contract never shows a remainder). Approved change orders bill as usual.billingDifference- Still to bill, tax included. Negative on a fixed-price contract when credits left it over-billed; negative on a T&M contract when an approved credit change order is due back to the customer (credit due), since a credit there nets into the overall figures rather than the contract's remaining.
approvedChangeOrders and changeOrderTotal / Billed / Remaining only count approved Change Orders that are billable to the client (clientCharge: true) and add money. Internal-cost-only COs are excluded, and so are credit change orders, which appear in creditsTotal instead.
Errors
404 Not Found— contract does not exist for your tenant.
