Skip to content

Plans ​

1 endpoint. Every path below is relative to the API base URL and already includes the /api/v1 prefix — see conventions for authentication, pagination, errors and idempotency.

Endpoint
GET/billing/plansReturn the public plans and add-ons with prices, the organization's entitlements and its limit headroom

Endpoints ​

Return the public plans and add-ons with prices, the organization's entitlements and its limit headroom ​

GET/billing/plans
  • Requires billing.read.
  • A plan's price is null when no price exists in the organization's currency. In limits, a null limit means unlimited or no plan.
bash
curl -X GET "$CALLAGENT_API_URL/billing/plans" \
  -H "Authorization: Bearer $CALLAGENT_API_KEY" \
  -H "Accept: application/json"
js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/billing/plans`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
    Accept: 'application/json',
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.type}: ${error.message}`);
}

const { data } = await response.json();
php
<?php

$handle = curl_init(getenv('CALLAGENT_API_URL') . '/billing/plans');

curl_setopt_array($handle, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
        'Accept: application/json',
    ],
]);

$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);

if ($status >= 400) {
    throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}

$data = $body['data'];
python
import os, requests

response = requests.get(
    f"{os.environ['CALLAGENT_API_URL']}/billing/plans",
    headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]

Responses

StatusBody
200data-wrapped object

Errors

StatusWhen it happens
403Neither the API key scope nor the session user's permission allows billing.read

Example response, generated from the schema:

json
{
  "data": {
    "plans": [
      {}
    ],
    "addons": [
      {}
    ],
    "entitlements": {},
    "limits": {}
  }
}

Documented against the code. Anything not yet implemented is labelled, never described as working.