Skip to content
campaiDeveloper
campai.com

An API key identifies an organization. Many CRM, booking, and finance operations also require a mandate within that organization. Passing the organization ID twice does not select a mandate, and knowing an ID does not establish access.

Create a key as shown in Make your first API request. For this guide, it needs Mandates → Read.

What you’ll have at the end

A verified organization and mandate pair you can reuse in scoped API requests.

  1. Key info
  2. Organization ID
  3. Accessible mandates
  4. Selected scope
Before you start
  • A working API key
  • Mandates Read and access to the intended mandate
On this page
Value Purpose Reliable source
Full organization ID Organization-scoped API operations The organization property from the API key info operation
Organization short ID Organization selection in the admin URL and supported public URLs Organization details; it is not universally accepted by API operations
Mandate ID The mandate selected for CRM, booking, and finance requests An accessible record from the mandate list

On More → Developers → API Keys, the documentation panel also displays Your organization id. In an admin URL shaped like /ad/<shortId>/<mandateId>/…, the first segment is the short ID and the next is the mandate ID. Prefer the API discovery flow below over parsing a browser URL in production code.

GET /apiKey/info takes no organization parameter. Its response tells you which organization the credential belongs to. Copy the returned organization value into the mandate-list request below.

Example

curl --fail-with-body --silent --show-error --max-time 30 --globoff \
  --request GET 'https://cloud.campai.com/api/apiKey/info' \
  --header 'X-API-Key: YOUR_API_KEY'

If you need the organization's name or short ID, use GET /organizations/{organizationId}. That operation requires Organization settings → Read. It supports a full ID or a short ID, but this exception does not make short IDs valid for every operation.

Replace YOUR_ORGANIZATION_ID with the full ID returned by key info and YOUR_API_KEY with the same key.

Example

curl --fail-with-body --silent --show-error --max-time 30 --globoff \
  --request POST 'https://cloud.campai.com/api/organizations/YOUR_ORGANIZATION_ID/mandates/list' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "limit": 50,
  "offset": 0,
  "returnCount": true,
  "sort": {
    "name": "asc"
  }
}'

POST /organizations/{organizationId}/mandates/list is a read operation despite using POST. Its JSON body carries pagination and sorting. The response contains a mandates array and count; requesting returnCount: true asks the server to calculate the matching total.

This request reads one page of 50. For more pages, keep the same sort and increase offset to 50, 100, and so on until a shorter page arrives. The list respects the key's mandate restrictions. A zero-length result means no matching accessible mandates were returned; it does not prove that the organization has none.

Choose the intended mandate by its name and _id. Do not silently choose the first row: sorting, restrictions, and the organization's configuration can change. isDefault describes the organization's default; it is not a guarantee that every integration should use it.

Store the full organization ID and selected mandate ID in your integration configuration. Later examples mark them as YOUR_ORGANIZATION_ID and YOUR_MANDATE_ID; replace those placeholders with the returned values.

At startup, compare the configured organization with GET /apiKey/info, then confirm that the configured mandate appears in the accessible mandate list. Stop with a configuration error if either check fails. This is especially useful after key rotation or migration.

Read the reference before constructing a URL. Different operation families deliberately use different paths:

Operation IDs in the path
Get API key info Neither; the key supplies the organization
List mandates Organization only, after /organizations/
List contacts Organization and mandate before /crm/contacts/list
List receipts Organization and mandate before /finance/receipts/list

Each example includes the complete API URL, including the operation’s organization and mandate parameters. If discovery works but a list operation returns 403, continue with Resolve 403 errors and empty results.

Check your result

Correct pair
A scoped read succeeds.
Restricted key
Only permitted mandates appear.
Abbreviated ID
Replace it with the complete response value.
Continue with Resolve 403 errors and empty results