Trimline is in private beta. Public launch: June 2027.Join the waitlist →
Docs / Core concepts

Pagination

Cursor-based pagination and filtering for every list endpoint.

Beta. The Trimline API is available to private beta customers. Endpoints may change before general availability in June 2027, and every breaking change is announced in the changelog. Request access.

Every endpoint that lists objects (vendors, contracts, renewals, drafts and so on) returns results a page at a time, using cursor-based pagination. Cursors stay stable when new objects are created, so you won’t skip or repeat items while you page through.

Parameters

limitinteger, default 20How many objects to return, from 1 to 100.
starting_afterstringAn object ID. The page starts with the object that comes immediately after it. Pass the previous response’s next_cursor here.
ending_beforestringAn object ID. Returns the page that ends just before it, for paging backwards.

List response

{
  "object": "list",
  "url": "/v1/vendors",
  "data": [ { "id": "ven_9xKd02", "object": "vendor", "...": "..." } ],
  "has_more": true,
  "next_cursor": "ven_2Rt7Mq"
}

When has_more is false, you’ve reached the last page and next_cursor is null.

Fetching every page

async function* listAll(path, params = {}) {
  let cursor = null;
  do {
    const qs = new URLSearchParams({ ...params, limit: "100", ...(cursor && { starting_after: cursor }) });
    const res = await fetch(`https://api.trimline.tech/v1${path}?${qs}`, {
      headers: { Authorization: `Bearer ${process.env.TRIMLINE_API_KEY}` },
    });
    const page = await res.json();
    yield* page.data;
    cursor = page.has_more ? page.next_cursor : null;
  } while (cursor);
}

for await (const vendor of listAll("/vendors")) console.log(vendor.name);
def list_all(path, **params):
    cursor = None
    while True:
        q = {**params, "limit": 100, **({"starting_after": cursor} if cursor else {})}
        page = requests.get(f"https://api.trimline.tech/v1{path}", headers=HEADERS, params=q).json()
        yield from page["data"]
        if not page["has_more"]:
            break
        cursor = page["next_cursor"]

for vendor in list_all("/vendors"):
    print(vendor["name"])

Filtering and sorting

List endpoints accept filters, which are documented on each resource page. Date filters support [gt], [gte], [lt] and [lte] modifiers. Results are sorted by created_at, newest first, unless the endpoint says otherwise. For example, renewals are sorted by notice_deadline, soonest first.

curl -G https://api.trimline.tech/v1/contracts \
  -H "Authorization: Bearer $TRIMLINE_API_KEY" \
  -d "term_end[gte]=2027-01-01" \
  -d "term_end[lt]=2027-04-01" \
  -d "auto_renews=true"

Something unclear or missing? Email developers@trimline.tech.