PPactDocs
Developers

Your first API call — list accounts

List accounts with curl, TypeScript, and Python, and read the standard pagination envelope.

This guide lists accounts (companies) three ways. You need an API key — see Get an API key in 60 seconds.

All examples call GET /v1/companies, which returns the accounts in your workspace. The same shape applies to GET /v1/contacts and GET /v1/opportunities (deals).

curl

bash
curl "https://app.pact.place/v1/companies?limit=2&offset=0" \
  -H "Authorization: Bearer $PACT_API_KEY"

TypeScript

ts
const res = await fetch("https://app.pact.place/v1/companies?limit=2&offset=0", {
  headers: { Authorization: `Bearer ${process.env.PACT_API_KEY}` },
});
if (!res.ok) throw new Error(`Pact API ${res.status}`);
const page = await res.json();
console.log(`${page.items.length} of ${page.total} accounts`);

Python

python
import os
import requests

res = requests.get(
    "https://app.pact.place/v1/companies",
    params={"limit": 2, "offset": 0},
    headers={"Authorization": f"Bearer {os.environ['PACT_API_KEY']}"},
    timeout=10,
)
res.raise_for_status()
page = res.json()
print(f"{len(page['items'])} of {page['total']} accounts")

The response envelope

List endpoints return the standard pagination envelope:

json
{
  "items": [{ "public_id": "8f2c…", "name": "Acme Corp", "stage": "customer" }],
  "total": 412,
  "limit": 2,
  "offset": 0
}
FieldMeaning
itemsThe records on this page
totalTotal records matching the query, across all pages
limitPage size you requested (echoed back)
offsetStarting index you requested (echoed back)

Use public_id, not id

Records are addressed by their public_id (a UUID). Build detail URLs and follow-up requests with public_id — for example GET /v1/companies/{public_id}. Never use an internal integer id.

Common query parameters

GET /v1/companies accepts limit, offset, search, and stage. Filtering server-side keeps your pages small:

bash
curl "https://app.pact.place/v1/companies?search=acme&stage=customer&limit=25" \
  -H "Authorization: Bearer $PACT_API_KEY"

What's next?