API REFERENCE

Contracts API

A contract is the agreement that ties a client to a billing arrangement over a date range. It holds no prices of its own. The numbers live on contract lines, which you attach once the contract exists.

Create the agreement

Only client_id is required. contract_name, start_date, end_date, and billing_frequency set the shape of the agreement; an open-ended contract simply omits end_date.

curl
curl https://algapsa.com/api/v1/contracts \
  -H "X-API-Key: $ALGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "cl_3f9a2c",
    "contract_name": "Managed services 2026",
    "start_date": "2026-01-01",
    "billing_frequency": "monthly"
  }'

Attach the lines

Pricing comes from contract lines. Bind one to the agreement with POST /contracts/{contractId}/contract-lines and remove it with DELETE /contracts/{contractId}/contract-lines/{contractLineId}. The lines themselves are defined and edited through the Contract Lines API; this endpoint only controls which ones belong to this contract.

Endpoints

Every endpoint links through to its full parameters, request and response schemas, and code samples.

GET/api/v1/contractsAlgaPSAList contractsPOST/api/v1/contractsAlgaPSACreate contractPOST/api/v1/contracts/{contractId}/contract-linesAlgaPSAAttach contract lineDELETE/api/v1/contracts/{contractId}/contract-lines/{contractLineId}AlgaPSADetach contract line