46 endpoints for customer profiles, tickets, calls, payments and verification codes, all called with a private API key. When something happens on the platform, an event is sent to your server.
The endpoints and examples on this page are generated from the API's own schema; when the code changes, the documentation changes with it.
Authentication
Create a private key on the API keys page of the dashboard and send it in the Authorization header of every request. The full key is shown only when it's created.
A key belongs to one organization and works with member permissions: it sees and changes only that organization's data. Admin tasks such as managing members and keys or deleting, and actions that need confirmation in the dashboard, can't be done with a key.
Limits
60 requests a minute per organization (default). Past that, the API returns 429; try again in a minute.
Some endpoints have their own limits too: a verification code goes to the same number once every 30 seconds and at most 5 times an hour; saying a sentence or adding a note in a call in progress is 20 requests a minute per organization.
Errors
Error responses are JSON, and the detail field says the cause and what to do.
401
The key is invalid or has been revoked.
403
This can't be done with a key: admin tasks and actions that need confirmation in the dashboard are done only in the dashboard.
404
The record doesn't exist or belongs to another organization.
409
Conflict: the record changed after you read it, or the same record already exists.
422
The data sent is invalid; detail says which field wasn't accepted and why.
429
The request limit was exceeded; try again in a minute.
A first request: the profile of the number that's calling
curl -X POST "https://socialroute.tr/api/calls/<call_id>/end" \
-H "Authorization: Bearer sa_..."
Documented responses: 200, 422
POST/api/calls/{call_id}/say
Have the assistant say a sentence in a call in progress
Parameters
Field
In
Type
Required
call_id
path
string (uuid)
Yes
Request body (JSON)
Field
Type
Required
text
string · 1…300
Yes
Example body
{
"text": "Your request is open; you will get an SMS shortly."
}
curl
curl -X POST "https://socialroute.tr/api/calls/<call_id>/say" \
-H "Authorization: Bearer sa_..." \
-H "Content-Type: application/json" \
-d '{"text": "Your request is open; you will get an SMS shortly."}'
Documented responses: 200, 422
POST/api/calls/{call_id}/context
Add a note to a call in progress (not said to the caller)
Parameters
Field
In
Type
Required
call_id
path
string (uuid)
Yes
Request body (JSON)
Field
Type
Required
text
string · 1…1000
Yes
Example body
{
"text": "The caller is a VIP customer."
}
curl
curl -X POST "https://socialroute.tr/api/calls/<call_id>/context" \
-H "Authorization: Bearer sa_..." \
-H "Content-Type: application/json" \
-d '{"text": "The caller is a VIP customer."}'
Documented responses: 200, 422
POST/api/calls/outbound
Call with the assistant
Request body (JSON)
Field
Type
Required
assistant_id
string (uuid)
Yes
phone_number_id
string (uuid)
Yes
to
string
Yes
variables
object
No
voicemail_detection
boolean
No
purpose
string · 0…200
No
Example body
{
"assistant_id": "…",
"phone_number_id": "…",
"to": "0532 111 22 33",
"purpose": "following up on your visa application",
"variables": {
"customer_name": "Elif"
}
}
curl
curl -X POST "https://socialroute.tr/api/calls/outbound" \
-H "Authorization: Bearer sa_..." \
-H "Content-Type: application/json" \
-d '{"assistant_id": "…", "phone_number_id": "…", "to": "0532 111 22 33", "purpose": "following up on your visa application", "variables": {"customer_name": "Elif"}}'
If you enter your server's address on the Settings page of the dashboard, a POST is sent to it when the events below happen. A 2xx response is enough.
Event
When
In the body
call.started
When a call starts (if CALL_CONTROL is on for the server)
call
call.ended
When one of the assistant's calls ends
call
call.analyzed
When the post-call analysis is done (if turned on in Settings)
call
campaign.completed
When every contact of a campaign is done
campaign
monitor.triggered
When a monitoring rule breaks (if turned on in Settings)
monitor
monitor.resolved
When a broken monitoring rule recovers (if turned on in Settings)
monitor
eval.failed
When a scheduled evaluation fails (if turned on in Settings)
eval
switchboard_call.ended
When a switchboard call ends
call
ticket.created
When a ticket is opened (by a person, an integration or a call)
ticket
ticket.updated
When a ticket changes or gets a comment
ticket, comment
form.submitted
When a web form built in the dashboard is filled in and sent
form, response
contact.created
When a profile is created in the dashboard or through the API
contact
payment.paid
When the bank confirms a payment
payment
payment.refunded
When a payment is refunded in full or in part
payment, refunded_now_minor
order.created
When a connected online store reports a new order
order
order.updated
When a connected online store reports a changed order
order
test
When the test button on the Settings page is pressed
message
Signature and retries
Every request carries the X-Sesli-Zaman (time in seconds) and X-Sesli-Imza (starts with sha256=) headers. The signature is the HMAC-SHA256 of time + . + the body, with the secret key from the Settings page. Compute it yourself, compare, and reject requests older than a few minutes.
If retries are on in Settings, an event that didn't arrive for a temporary reason is sent again after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours. The X-Sesli-Olay header is the same on every attempt: if you see the same ID twice, don't process it again.