agentlyleads docs
Contracts API

API Reference

The reference below covers every endpoint in the Contracts API. Code examples are generated automatically; the live playground is disabled to prevent accidental writes to production from the docs site.

GET/api/v1/contracts

Authorization

BearerAuth
AuthorizationBearer <token>

Pass an API key issued from the agentlyleads workspace settings. Example: Authorization: Bearer alk_live_xxxxxxxxxxxx

In: header

Query Parameters

status?string

Filter to contracts in this status.

Value in

  • "DRAFT"
  • "ACTIVE"
  • "EXPIRED"
  • "CANCELLED"
companyId?string

Filter to contracts held by this company.

dealId?string

Filter to the contract that came out of this deal.

ownerId?string

Filter to contracts owned by this workspace user.

expiringWithinDays?integer

Only contracts whose term ends between now and this many days out. Deliberately forward-looking: a term that already ran out is an EXPIRED status, not a renewal to prepare for, and is excluded.

Range1 <= value <= 3650
updatedSince?string

Only contracts updated at or after this ISO 8601 datetime.

Formatdate-time
limit?integer

Page size.

Range1 <= value <= 1000
Default100
cursor?string

The nextCursor value from the previous page.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/api/v1/contracts?expiringWithinDays=30"
{  "contracts": [    {      "id": "cmq2cont0alk34567890",      "number": 12,      "title": "Acme master agreement",      "status": "DRAFT",      "value": 12500.5,      "startsAt": "2019-08-24T14:15:22Z",      "endsAt": "2019-08-24T14:15:22Z",      "autoRenew": true,      "renewalNotifiedAt": "2019-08-24T14:15:22Z",      "notes": "string",      "company": {        "id": "cmq2comp0alk34567890",        "name": "Acme Corp"      },      "deal": {        "id": "cmq2comp0alk34567890",        "name": "Acme Corp"      },      "owner": {        "id": "cmq2comp0alk34567890",        "name": "Acme Corp"      },      "createdAt": "2019-08-24T14:15:22Z",      "updatedAt": "2019-08-24T14:15:22Z"    }  ],  "nextCursor": "string"}
{  "error": "status must be one of: DRAFT, ACTIVE, EXPIRED, CANCELLED."}
{  "error": "Invalid or missing API key."}
{  "error": "API key missing required scope: read:contracts."}
{  "error": "Rate limit exceeded."}
GET/api/v1/contracts/{id}

Authorization

BearerAuth
AuthorizationBearer <token>

Pass an API key issued from the agentlyleads workspace settings. Example: Authorization: Bearer alk_live_xxxxxxxxxxxx

In: header

Path Parameters

id*string

The agentlyleads contract ID.

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/api/v1/contracts/string"
{  "contract": {    "id": "cmq2cont0alk34567890",    "number": 12,    "title": "Acme master agreement",    "status": "DRAFT",    "value": 12500.5,    "startsAt": "2019-08-24T14:15:22Z",    "endsAt": "2019-08-24T14:15:22Z",    "autoRenew": true,    "renewalNotifiedAt": "2019-08-24T14:15:22Z",    "notes": "string",    "company": {      "id": "cmq2comp0alk34567890",      "name": "Acme Corp"    },    "deal": {      "id": "cmq2comp0alk34567890",      "name": "Acme Corp"    },    "owner": {      "id": "cmq2comp0alk34567890",      "name": "Acme Corp"    },    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  }}
{  "error": "Invalid or missing API key."}
{  "error": "API key missing required scope: read:contracts."}
{  "error": "Contract not found."}