API guide
Phone system (PBX)
Users and extensions, phones and SIP credentials, numbers and inbound routing, queues, IVR call flows, business hours, caller ID and voicemail.
The building blocks#
| Object | What it is | Endpoints |
|---|---|---|
| User | A person with a login, a role and an extension (their internal number). | /users |
| Phone | Where a user's calls ring: the browser webphone, a softphone or desk phone (SIP), or both. | phoneType on the user |
| Number | A phone number (DID) of the company and where its inbound calls go. | /numbers |
| Queue | A group of users that share calls (ring all, in order, round robin, longest idle). | /queues |
| Call flow | An IVR menu ("press 1 for sales"), built as a graph of steps. | /callflows |
| Schedule | Business hours and holidays; numbers route differently outside them. | /schedules |
| Caller ID profile | Which number customers see on outbound calls (fixed, local presence, rotate, or your own URL). | /caller-id-profiles |
Reading these needs users:read / numbers:read; changing them needs users:write / numbers:write.
Users and extensions#
curl "$LEXO_URL/api/v1/users" -H "Authorization: Bearer $LEXO_API_KEY"Create (invite) a user with POST /users: email, name, role (agent, supervisor or admin), extension, the queues they belong to, and phoneType. The answer is {"user": {...}, "tempPassword": "..."}: the user is invited and receives an invitation email with the temporary password (when the platform has email set up), and sets their own password at first sign-in. Seats are limited by the company's plan (402 when none is left).
curl -X POST "$LEXO_URL/api/v1/users" \
-H "Authorization: Bearer $LEXO_API_KEY" -H "Content-Type: application/json" \
-d '{"email": "ana@example.com", "name": "Ana Agent", "role": "agent", "extension": "150", "phoneType": "both", "queues": [{"queueId": "6f1e2d3c-4b5a-4968-8776-5a4b3c2d1e0f", "priority": 1}]}'PATCH /users/{id} changes the name, role, extension, status (active or disabled; new users are invited until they set a password), phone type, manual outbound answering machine detection (amd) or the queue memberships (queues replaces the list). DELETE /users/{id} removes the user.
Phones and SIP credentials#
phoneType decides where a user's calls ring:
phoneType | Calls ring on |
|---|---|
webphone (default) | the LexoConnect app or your embedded webphone in the browser |
softphone | a SIP softphone or desk phone registered with the user's SIP credentials |
both | the browser and the SIP device at the same time |
A SIP device registers with the user's extension as the username, the company's SIP domain and the user's SIP password; the user sees these settings, ready to copy, on their phone settings page in the LexoConnect app. Desk phones and softphones connect over SIP (UDP or TCP port 5060); browsers over WebSocket (wss://, port 8443). The platform operator must allow the device's public IP address for SIP.
For your own WebRTC client you do not need the user's password: mint a webphone token on your server and exchange it for short-lived SIP credentials (wsUri, sipUri, authUser, password, domain, iceServers). See Embedding.
Numbers and inbound routing#
GET /numbers lists the company's numbers with their current routing. PATCH /numbers/{id} changes where inbound calls go:
routeType | routeId / routeTarget | Inbound calls go to |
|---|---|---|
user | user id | one user's phone |
queue | queue id | a queue |
callflow | call flow id | an IVR menu |
ai_agent | AI agent id | an AI voice agent |
voicemail | user id | a user's voicemail box |
external | routeTarget: E.164 | an outside number (call forwarding) |
Add scheduleId plus afterHoursRouteType / afterHoursRouteId (or afterHoursTarget) to route differently outside business hours, and amd to detect answering machines on inbound calls.
curl -X PATCH "$LEXO_URL/api/v1/numbers/5a4b3c2d-1e0f-4a9b-8c7d-6e5f4a3b2c1d" \
-H "Authorization: Bearer $LEXO_API_KEY" -H "Content-Type: application/json" \
-d '{"routeType": "queue", "routeId": "6f1e2d3c-4b5a-4968-8776-5a4b3c2d1e0f", "scheduleId": "1d2c3b4a-5968-4776-8594-a3b2c1d0e9f8", "afterHoursRouteType": "voicemail", "afterHoursRouteId": "0b7e5d1c-2a3f-4e6d-8c9b-1a2b3c4d5e6f"}'Getting new numbers. GET /numbers/available?country=US&areaCode=212&type=local (or type=tollfree) searches numbers that can be added. Numbers are bought and assigned to a company by the platform operator (they also set up the carriers and prices), so send them the number you picked; once assigned, it appears in GET /numbers and you route it with PATCH.
Queues#
A queue shares calls among its members. strategy is one of:
| Strategy | Behaviour |
|---|---|
ring_all | ring every available member at once; the first to answer gets the call |
sequential | ring members one at a time in their order |
round_robin | rotate the first member call by call |
longest_idle | ring the member who has waited longest since their last call |
curl -X POST "$LEXO_URL/api/v1/queues" \
-H "Authorization: Bearer $LEXO_API_KEY" -H "Content-Type: application/json" \
-d '{"name": "Sales", "strategy": "ring_all", "ringTimeoutSec": 20, "maxWaitSec": 120, "wrapUpSec": 10, "waitInQueue": true, "fallback": {"type": "voicemail", "userId": "0b7e5d1c-2a3f-4e6d-8c9b-1a2b3c4d5e6f"}}'fallback decides what happens when nobody answers within maxWaitSec: {"type": "voicemail", "userId": "..."}, {"type": "queue", "queueId": "..."}, {"type": "external", "target": "+1..."} or {"type": "hangup"}. PATCH /queues/{id} changes some fields, PUT replaces the queue, DELETE removes it (409 while a number still routes to it). DELETE /queues/{id}/members/{userId} removes a member.
IVR call flows#
A call flow is a graph: nodes (steps of type start, play, menu, hours, ring_user, queue, voicemail, ai_agent, transfer_external and hangup) connected by edges. A menu node has one exit per key (0–9, *, #) plus timeout; an hours node has open and closed; ring_user has noanswer; queue has timeout. The easiest way to build one is in the LexoConnect call flow designer; GET /callflows/{id} then shows the JSON you can copy, change and save back with PUT /callflows/{id} or create with POST /callflows. The API reference shows a complete example graph. Route a number to it with routeType: "callflow".
GET /reports/ivr-logs (scope reports:read) shows, per call, the path taken through the menu, the keys pressed and the outcome.
Business hours#
curl -X POST "$LEXO_URL/api/v1/schedules" \
-H "Authorization: Bearer $LEXO_API_KEY" -H "Content-Type: application/json" \
-d '{"name": "Office", "timezone": "America/New_York", "weekly": {"mon": [{"start": "09:00", "end": "17:00"}], "tue": [{"start": "09:00", "end": "17:00"}], "wed": [{"start": "09:00", "end": "17:00"}], "thu": [{"start": "09:00", "end": "17:00"}], "fri": [{"start": "09:00", "end": "17:00"}]}}'timezone must be an IANA time zone name (for example Europe/London, Asia/Karachi).
Caller ID on outbound calls#
A caller ID profile picks the number customers see:
mode | Picks |
|---|---|
fixed | always the same number |
local_presence | a company number with the customer's area code (match: "area") or state (match: "area_state"), else the fallback |
rotate | the next number from a list |
url | asks your server (an HTTPS URL) for the number for each call |
POST /caller-id-profiles/{id}/test with {"to": "+12125550123"} shows which number a call would use. Assign profiles to users, queues or campaigns in the app, or with the callerIdProfileId field of a campaign.
Voicemail#
Callers reach a user's voicemail box when the user does not answer or when a number or queue routes there. Each new message sends the voicemail.created webhook with a transcript (when enabled) and a signed audio link. GET /voicemails lists messages; see Calls for audio downloads.