API overview
Use the Core API when an integration needs more control than the dashboard provides. Start with a focused recipe, then use this page for the shared client setup and implementation practices.
Get a token first
Every request below needs a bearer token, obtained by exchanging an integration user's credentials with the Token API. API authentication covers creating that user, choosing its role, obtaining and refreshing the token, rotating it, and what to do if it leaks. Read it before anything else on this page.
Keep API tokens on a server-side integration. Never commit a real token to source control or expose it in browser code. The examples use the placeholder your_token_here.
Configure a client
The Core API is available below /api_router/v1/core:
import requests
BASE_URL = "https://your-dialerai-host/api_router/v1/core"
HEADERS = {
"Authorization": "Bearer your_token_here",
"Content-Type": "application/json",
}
Use the API reference for the current schema, authentication requirements, and response models. Treat IDs such as ctl_... (contact lists), ct_... (contacts), and callcp_... (call campaigns) as opaque values.
Choose a recipe
- API authentication: obtain, refresh, and rotate the token every other recipe needs.
- Contacts API: create, update, and bulk-import contacts, including alternative phone numbers.
- CDR API: export high-volume call detail records with cursor pagination.
- Flows API: create a Flow, add nodes, and connect transitions from an integration.
- Call Requests API: place an ad-hoc call against a campaign or directly against a Flow.
- Automate DialerAI with the API: choosing between the API, webhooks, and the HTTP Request node.
Contacts and alternative phone numbers
Create a contact
POST /contact/create requires a phone number, contact-list ID, and selected_tags. The server can enrich the primary number with timezone information.
payload = {
"contact_list_id": "ctl_example",
"phone_number": "+14155130870",
"first_name": "Joe",
"last_name": "Foo",
"selected_tags": [],
}
response = requests.post(f"{BASE_URL}/contact/create", json=payload, headers=HEADERS)
response.raise_for_status()
contact_id = response.json()["contact_id"]
To include alternative numbers, add alternative_phone_number keyed by slots "1" through "10". Each entry needs phonenumber; label is optional:
payload["alternative_phone_number"] = {
"1": {"phonenumber": "+441234567890", "label": "Office"},
"2": {"phonenumber": "+12025550139", "label": "Mobile"},
}
Alternative numbers require ENABLE_ALTERNATIVE_PHONE_NUMBERS=True on the server. When enabled, GET /contact/get/{id} returns timezone enrichment for each number. Updating a contact with PUT /contact/update/{id} replaces the supplied alternative-number mapping, so send the complete mapping you want to retain.
Bulk-create contacts
POST /contact/bulk-create/{contact_list_id} accepts up to 1,000 contacts as a JSON array. Duplicate phone numbers or email addresses are reported per item, allowing the rest of the batch to continue:
contacts = [
{"phone_number": "+14155130870", "first_name": "Alice", "selected_tags": []},
{"phone_number": "+14155130871", "first_name": "Bob", "selected_tags": []},
]
response = requests.post(
f"{BASE_URL}/contact/bulk-create/ctl_example",
json=contacts,
headers=HEADERS,
)
response.raise_for_status()
for result in response.json():
if result["success"]:
print("Created", result["contact_id"])
else:
print("Skipped", result.get("reason"))
Read high-volume CDR data with cursors
Use GET /cdr/list with a required date and a bounded limit (maximum 500). The response contains results and an opaque next_cursor. Pass that cursor back as cursor until it is null:
cursor = None
while True:
params = {"date": "2026-06-30", "limit": 100}
if cursor:
params["cursor"] = cursor
response = requests.get(f"{BASE_URL}/cdr/list", params=params, headers=HEADERS)
response.raise_for_status()
page = response.json()
process(page["results"])
cursor = page["next_cursor"]
if not cursor:
break
Cursors are forward-only: start a new request without cursor to restart. You can also add call-campaign-id to restrict results to one campaign. Paginating by date keeps requests predictable for large call volumes.
Create a Flow programmatically
Flow creation is a two-stage operation:
POST /flow/createcreates the Flow and returns its ID.POST /flow/{flow_id}/nodes/addadds nodes. Pass the node type as thetypequery parameter and its configuration as JSON.POST /flow/{flow_id}/transitions/addconnects nodes. Passsource_transition_typeas the event that moves execution to the target node.
For example, add an HTTP Request node:
flow_id = requests.post(
f"{BASE_URL}/flow/create",
json={"name": "Sample Flow", "description": "Created through the API"},
headers=HEADERS,
).json()
http_config = {
"url": "https://httpbin.org/ip",
"http_method": "get",
"auth_type": "no-auth",
"body_type": "json",
"data": {},
"headers": {},
"params": {},
"request_timeout": 3600,
}
node_id = requests.post(
f"{BASE_URL}/flow/{flow_id}/nodes/add",
params={"type": "HTTP Request", "node-name": "lookup-ip"},
json=http_config,
headers=HEADERS,
).json()
Node configuration is type-specific. The source examples include Send Message, Voicemail Detection, DTMF IVR Input, Call Transfer, and Add to DNC. Use the API reference for the complete field list, then connect nodes with valid transition event names for those node types.
Retrieve the resulting configuration with GET /flow/{flow_id}/flow-data before publishing or assigning it to a campaign. This makes it easier to validate node settings and transitions in an automated deployment.
Place a call against a campaign or a Flow
POST /call-request/create places a single ad-hoc call. Provide exactly one of call_campaign_id (the call follows that campaign's retry, do-not-call, and contact-list rules) or flow_id (the call runs that Flow directly, with no campaign, retry handling, or contact-list restriction). A Flow call also needs a callerid_id, an authorized Caller ID of your organization, since there is no campaign to take one from:
payload = {
"contact_id": "ct_GJXQ063CGZ5OY",
"flow_id": "flow_NYB01UDCGO",
"callerid_id": "cid_R7VQ0KMD3A",
"priority": 1,
"call_date": "2025-11-01T10:00:00Z",
}
response = requests.post(f"{BASE_URL}/call-request/create", json=payload, headers=HEADERS)
response.raise_for_status()
call_request_id = response.json()["id"]
POST /call-request/bulk-create accepts the same choice, up to 50 requests at once, with the campaign or Flow ID set once at the top level. See the Call Requests API for both create paths, error responses, and listing call requests.
Integration practices
- Validate required IDs and phone numbers before sending a request.
- Call
raise_for_status()(or equivalent) and log a redacted response for troubleshooting. - Treat bulk-create results independently; retry only failed items after reviewing the reason.
- Store cursors temporarily and restart from the first page when a cursor expires or a date changes.
- Use a test organization and small contact list before creating production campaigns or Flows.
Related
- API authentication: tokens, roles, refresh, rotation.
- Contacts API · CDR API · Flows API · Call Requests API: the recipes.
- Webhooks: receive events instead of polling.
- Connect integrations: choosing the right integration method.
- API reference: the interactive Core, Token, and Admin schemas.