Skip to main content
GET
/
api
/
v1
/
contracts
List Contracts
curl --request GET \
  --url https://api.example.com/api/v1/contracts/
{
  "contracts": [
    {}
  ],
  "limit": 123,
  "offset": 123,
  "total": 123
}
Retrieve a paginated list of contracts with optional filtering by status or phone number. Results are ordered by creation date (newest first).

Query Parameters

limit
integer
default:"50"
Maximum number of contracts to return (pagination)
offset
integer
default:"0"
Number of contracts to skip (pagination)
status
string
Filter contracts by status. Possible values:
  • pending: Awaiting signatures
  • confirmed: All parties have signed
  • active: Contract is in effect
  • completed: Contract has been fulfilled
  • cancelled: Contract was cancelled
phone_number
string
Filter contracts by a specific party’s phone number. Returns only contracts where this phone number is a party.

Response

contracts
array
Array of contract objects, each containing:
  • contract_id: Unique contract identifier
  • status: Current contract status
  • created_at: Creation timestamp
  • expires_at: Expiration timestamp (if applicable)
  • total_amount: Contract amount
  • currency: Currency code
  • parties: List of contract parties
  • contract_hash: Cryptographic hash
limit
integer
The limit parameter used in the request
offset
integer
The offset parameter used in the request
total
integer
Number of contracts returned in this response

Example Request

# List all contracts with default pagination
curl -X GET https://api.voicepact.com/api/v1/contracts/ \
  -H "Content-Type: application/json"
# Filter by status
curl -X GET "https://api.voicepact.com/api/v1/contracts/?status=confirmed&limit=20" \
  -H "Content-Type: application/json"
# Filter by phone number
curl -X GET "https://api.voicepact.com/api/v1/contracts/?phone_number=%2B254712345678" \
  -H "Content-Type: application/json"
# Pagination example
curl -X GET "https://api.voicepact.com/api/v1/contracts/?limit=10&offset=20" \
  -H "Content-Type: application/json"

Example Response

{
  "contracts": [
    {
      "contract_id": "AGRI-2026-001235",
      "status": "confirmed",
      "created_at": "2026-03-06T14:20:00Z",
      "expires_at": "2026-04-06T14:20:00Z",
      "total_amount": 35000,
      "currency": "KES",
      "parties": [
        {
          "phone_number": "+254712345678",
          "role": "buyer",
          "name": "John Kamau"
        },
        {
          "phone_number": "+254798765432",
          "role": "seller",
          "name": "Peter Mwangi"
        }
      ],
      "contract_hash": "b8e9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9"
    },
    {
      "contract_id": "AGRI-2026-001234",
      "status": "pending",
      "created_at": "2026-03-06T10:30:00Z",
      "expires_at": null,
      "total_amount": 25000,
      "currency": "KES",
      "parties": [
        {
          "phone_number": "+254712345678",
          "role": "buyer",
          "name": "John Kamau"
        },
        {
          "phone_number": "+254787654321",
          "role": "seller",
          "name": "Mary Wanjiru"
        }
      ],
      "contract_hash": "a7f8d9e2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0"
    }
  ],
  "limit": 50,
  "offset": 0,
  "total": 2
}

Error Responses

500 Internal Server Error

{
  "detail": "Failed to list contracts"
}
Returned when an unexpected error occurs during contract listing.

Notes

  • Contracts are always ordered by creation date in descending order (newest first)
  • When filtering by phone_number, the query joins with the ContractParty table to find all contracts involving that number
  • The total field represents the number of contracts returned in the current response, not the total count in the database

Build docs developers (and LLMs) love