Requests, ids, pagination and errors
Everything the API does the same way, in one place.
Updated
On this page
Everything the API does the same way, in one place.
Base URL and shape
https://api.voxcore.net/api/v1/orgs/<org_id>/<resource>The organization sits in the path, not only in a header. That is what makes an access-log line, a browser history entry and a bug report say which tenant was addressed. A header-only scheme makes every request look identical.
X-Voxcore-Org exists as a fallback for routes that do not carry
the id in the path. On org-scoped routes it has no effect.
Ids
Every id is <prefix>__<20 characters>, with a double
underscore, drawn from a lowercase Crockford base32 alphabet
(0-9a-z without i, l, o or
u). So con__k3n8xq2v9wp4mt7bd5rj.
The prefix tells you what you're holding, which makes a wrong id in a payload obvious at a glance, instead of after a 404:
| Prefix | Resource |
|---|---|
org | Organization |
agt | Agent |
agv | Agent version |
tol | Tool |
knw | Knowledge source |
pn | Phone number |
con | Contact |
cbt | Contact batch |
cal | Call |
trn | Turn |
cht | Chat session |
key | API key |
Lists are cursor paginated
{
"data": [ ... ],
"page": {
"next": "https://.../contacts/?cursor=cD0yMDI2...",
"previous": null,
"limit": 25
}
}limit defaults to 25 and is capped at 100. Follow
page.next instead of building a cursor yourself. Treat it as
opaque.
cURL
curl "https://api.voxcore.net/api/v1/orgs/<org_id>/contacts/?limit=100" \
-H "Authorization: Bearer vox_sk_live_..."
# then follow page.next verbatim
curl "https://api.voxcore.net/api/v1/orgs/<org_id>/contacts/?cursor=cD0yMDI2..." \
-H "Authorization: Bearer vox_sk_live_..."Python
import os, httpx
BASE, ORG = "https://api.voxcore.net", os.environ["VOXCORE_ORG"]
AUTH = {"Authorization": f"Bearer {os.environ['VOXCORE_API_KEY']}"}
url = f"{BASE}/api/v1/orgs/{ORG}/contacts/?limit=100"
while url:
page = httpx.get(url, headers=AUTH).json()
for row in page["data"]:
print(row["display_name"])
url = page["page"]["next"]Python (voxcore)
from voxcore import Voxcore
vox = Voxcore()
# iterate() follows the cursor and is lazy. Stop reading and it stops.
for contact in vox.contacts.iterate():
print(contact["display_name"])Why a cursor and not an offset? These lists are append-heavy and get read while they grow. Under limit-and-offset, a row arriving between page one and page two shifts everything down and you see a duplicate. A deletion makes you miss one. A cursor anchored on creation time is stable against both.
A few endpoints return a bare {"data": [...]} with no
page, such as agent versions and a contact's calls, because they
are capped, not paginated. They're called out where they appear.
Filtering
There is no generic filter or ordering parameter. Each list supports the specific parameters documented on its own page, and nothing else. An unknown query parameter is ignored, not rejected, so a misspelled filter hands you the unfiltered list and no complaint.
Errors
{
"error": {
"code": "invalid",
"message": "Check the highlighted fields.",
"fields": { "phone": ["Start with a country code, like +19548572225."] }
}
}fields is omitted entirely unless there is something to put in
it.
| Status | Common codes |
|---|---|
| 400 | invalid |
| 401 | not_authenticated, authentication_failed, token_revoked, bad_key, key_revoked, key_expired |
| 403 | permission_denied, origin_denied |
| 404 | not_found |
| 405 | method_not_allowed |
| 409 | conflict, opted_out |
| 429 | throttled |
| 500 | server_error |
| 502 | carrier_unavailable, not_configured, provider_unavailable, provider_unknown, tts_failed |
A missing tenant is a 404, not a 403
Asking for an organization you are not a member of returns 404.
A 403 would confirm that the organization exists, and that is a
fact a stranger has no business learning from an error code.
Deletes are usually soft
Agents, contacts, batches, knowledge sources and phone numbers are all soft deleted. The row stays, drops out of every list, and keeps historical records resolvable. Deleting a phone number does not release it at the carrier.
Retrying a write is your problem, not ours
A GET is safe to repeat. A POST is not, and
repeating one can create a second contact or place a second call. Send an
Idempotency-Key header and the write becomes safe to retry. Use a
key you already have, like an order id or a row id, because that is what makes
the retry safe across a process restart too.
cURL
curl -X POST https://api.voxcore.net/api/v1/orgs/<org_id>/contacts/ \
-H "Authorization: Bearer vox_sk_live_..." \
-H "Idempotency-Key: order-8127" \
-H "Content-Type: application/json" \
-d '{"first_name": "Dana", "phone": "+18175550147"}'Python
import os, httpx
BASE, ORG = "https://api.voxcore.net", os.environ["VOXCORE_ORG"]
AUTH = {"Authorization": f"Bearer {os.environ['VOXCORE_API_KEY']}"}
httpx.post(
f"{BASE}/api/v1/orgs/{ORG}/contacts/",
headers={**AUTH, "Idempotency-Key": "order-8127"},
json={"first_name": "Dana", "phone": "+18175550147"},
).raise_for_status()Python (voxcore)
from voxcore import Voxcore
vox = Voxcore()
# True generates a key. A string uses yours, which is better.
vox.contacts.create(
first_name="Dana",
phone="+18175550147",
idempotency_key="order-8127",
)Rate limits
The org-scoped API is not rate limited at the application layer today. Public and unauthenticated endpoints are: sign-up, sign-in, password reset, the contact form, the embeddable widgets, public forms, the booking page and this documentation. Don't build on the absence of a limit on the org-scoped routes. It's an absence, not a guarantee.