SpeakApp API
Introduction#
The API connects an organization's own system, a CRM, BI or a script, to its calls, recordings, extensions, queues and users in SpeakApp. The system never connects to the PBX itself, and sees its own organization only.
This version has GET only. Answers are JSON, in UTF-8. Times are ISO 8601 with Israel's offset. Phone numbers are as the PBX writes them.
https://app.b-smart.org.il/api/v1Quickstart#
- The organization's administrator makes a key in SpeakApp: "הגדרות מערכת", the tab "API וחיבורים", "מפתח חדש", and picks its scopes.
- Send GET /me with the key. The answer shows the organization and the scopes.
- Read what you need, for example GET /calls.
curl "https://app.b-smart.org.il/api/v1/me" \
-H "Authorization: Bearer $SPEAKAPP_API_KEY"HTTP/1.1 200 OK
{
"organization": {
"id": "8c1d2b3a-4e5f-4a6b-9c7d-0e1f2a3b4c5d",
"name": "חברת הדוגמה בע״מ"
},
"key": {
"id": "0c6f2a51-7d0e-4c3a-9f1b-2a7e5d9c4b01",
"name": "CRM המכירות",
"scopes": [
"calls.read",
"recordings.read"
]
},
"limits": {
"requests_per_minute": 120,
"organization_requests_per_minute": 600,
"calls_per_minute": 20,
"recording_links_per_hour": 300,
"max_days": 31,
"page_size_max": 200
},
"version": "1.1"
}Authentication#
Every request carries the key in the Authorization header, as a Bearer token. A key looks like spk_, 12 characters, an underscore and 43 characters.
- The header only. A key in the URL (?api_key=) is refused: URLs end up in logs.
- Keep the key on a server. Never in a page's code or a phone app: browsers are blocked from calling the API directly.
- One key per system. A leaked key is revoked without touching the others.
- A key may be limited to IP addresses. A request from another address is refused with address_not_allowed.
Authorization: Bearer spk_4be19a0c27d3_…HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="SpeakApp"
{
"error": {
"code": "invalid_token",
"message": "The key is missing, wrong or revoked."
}
}Scopes#
Each key holds only the scopes the organization's administrator ticked. A request that needs another one gets 403 with scope_missing.
| Scope | Name | What it opens |
|---|---|---|
| calls.read | Calls | Every call of the organization, and each call's path |
| recordings.read | Recordings | A 5-minute link to download a call's recording |
| extensions.read | Extensions | The extensions, who each belongs to, and its phone's state |
| queues.read | Queues and agents | The queues, who waits in them, and the agents' state now |
| users.read | Users | Name, e-mail, job title, department and extensions; never a phone |
Pagination#
A list answers data and next_cursor. When there is more, send the request again with cursor=next_cursor only. When it is null, this is the last page. Call and queue IDs are strings: keep them as they are.
curl "https://app.b-smart.org.il/api/v1/calls?cursor=eyJmcm9tIjoi…" \
-H "Authorization: Bearer $SPEAKAPP_API_KEY"Errors#
An error answers an HTTP status and an error object with a fixed code and a message. Check code: it never changes; the message may.
| Code | Status | Meaning | Retry |
|---|---|---|---|
| invalid_request | 400 | A wrong parameter, a range over 31 days, or a key sent in the URL instead of the header | No |
| invalid_token | 401 | The key is missing, wrong, revoked, or unused for 180 days | No |
| scope_missing | 403 | The key lacks the scope this request needs | No |
| address_not_allowed | 403 | The request came from an IP address outside the key's list | No |
| organization_inactive | 403 | The organization is not active | No |
| terms_not_accepted | 403 | The organization's administrator has not accepted the terms of use yet | No |
| not_found | 404 | Not found, or not the organization's | No |
| no_recording | 404 | The call has no recording | No |
| method_not_allowed | 405 | Only GET in this version | No |
| rate_limited | 429 | Too many requests; wait the seconds in Retry-After | Yes |
| pbx_unavailable | 503 | The PBX did not answer; try again after Retry-After | Yes |
| server_error | 503 | A passing fault; try again after Retry-After | Yes |
HTTP/1.1 403 Forbidden
{
"error": {
"code": "scope_missing",
"message": "The key lacks the scope \"recordings.read\"."
}
}Limits#
- 120 requests a minute per key, and 600 for the whole organization.
- The call list: 20 requests a minute per key, up to 31 days and 200 calls a page.
- Recording links: 300 an hour per key. Each link works for 5 minutes.
- 20 attempts with a wrong key in 10 minutes block the address.
- Over a limit: 429 with a Retry-After header.
- A key unused for 180 days is revoked.
HTTP/1.1 429 Too Many Requests
Retry-After: 12
{
"error": {
"code": "rate_limited",
"message": "Too many requests; wait."
}
}Recordings#
- Ask GET /calls/{id}/recording, and get a url that works for 5 minutes.
- Open the url with a GET, without the key, and keep the file or play it.
- Two ways to work: download each recording once and keep it, or show a "listen" button that asks a new link on each click. Either way the key never reaches a browser.
- Each link is logged in the organization's activity log in the key's name.
curl "https://app.b-smart.org.il/api/v1/calls/2f6a91c4-1763540000.1234/recording" \
-H "Authorization: Bearer $SPEAKAPP_API_KEY"GET https://app.b-smart.org.il/api/v1/recordings/q3VbT…
HTTP/1.1 200 OK
Content-Type: audio/wav
Content-Disposition: attachment; filename="call-202611191013.wav"Webhooks#
A webhook tells your system's address when something happens, so it need not ask again and again. The organization's administrator sets it in SpeakApp: "הגדרות מערכת", the tab "API וחיבורים", "Webhook חדש": an https address, the events, and, if wanted, only some extensions or queues.
| Event | Name | When |
|---|---|---|
| call.missed | Missed call | An incoming call that ended unanswered |
| call.ended | Call ended | An answered call (incoming, outgoing or internal) ended |
| recording.ready | Recording ready | An answered call's recording is kept by the PBX and may be asked for |
| bot.handoff | Bot handed over | In Messages: the bot handed a WhatsApp conversation to the agents, with what it gathered |
| bot.ended | Bot ended | In Messages: the bot closed a WhatsApp conversation with no agent, with what it gathered |
- The message: a POST of JSON: the event's id, type, occurred_at, organization and data. A call's data is the object GET /calls returns, with queues, the queues the call went through.
- Answer 2xx within 5 seconds. Any other answer, or none: the message is sent again after 1 minute, 5 minutes, 30 minutes, 2 hours, 8 hours and 24 hours, and then no more.
- The same id may come twice: skip an id already handled. Order is not guaranteed: rely on occurred_at.
- A call arrives within about 2 minutes of its end. recording.ready a few minutes later; ask for the recording with GET /calls/{id}/recording.
- bot.handoff and bot.ended come from the bot of Messages on WhatsApp, at once. Their data: conversation_id, number (the business's number), contact (the phone and the name of whoever wrote), reason, department and collected, what the bot gathered: a list of label and value. Phone numbers are digits with the country code. reason in bot.handoff: agent (a step of the bot), asked (the contact asked for a person), lost (not understood twice), media (a file or a voice note), loop or quiet. In bot.ended it is end. A webhook's limit to extensions or queues does not apply to the bot's events.
- A webhook that took no message for 3 days is switched off, and the organization's administrators are e-mailed. "שליחת בדיקה" (a test) sends a webhook.test event.
- https on port 443 only, to an address open to the internet. Redirects (3xx) are not followed. Up to 5 webhooks an organization.
POST /speakapp/webhooks HTTP/1.1
Host: crm.example.com
Content-Type: application/json
User-Agent: SpeakApp-Webhooks/1
SpeakApp-Signature: t=1795098930,v1=6f2b0c8e4d1a9f7e3c5b2a0d8e6f4c1b9a7d5e3f1c0b8a6d4e2f0c9b7a5d3e1f
{
"id": "evt_5f0c2e9a1b7d4c3e8a6f0b2d9c1e7a4b",
"type": "call.missed",
"occurred_at": "2026-11-19T10:15:30+02:00",
"organization": {
"id": "8c1d2b3a-4e5f-4a6b-9c7d-0e1f2a3b4c5d"
},
"data": {
"id": "2f6a91c4-1763540000.1234",
"pbx_id": "2f6a91c4-5b0e-4d7a-9c13-8e2b47d0a615",
"started_at": "2026-11-19T10:13:20+02:00",
"direction": "in",
"result": "missed",
"extension": null,
"other_party": {
"number": "0545550172",
"name": "אבי"
},
"initiated_by": "other_party",
"number_dialed": "0733334560",
"duration_seconds": 34,
"talk_seconds": 0,
"queues": [
{
"id": "2f6a91c4-865",
"name": "מכירות"
}
]
}
}Verifying a signature#
Every message is signed with the webhook's secret (spw_…), shown once when it is made. The SpeakApp-Signature header holds t, the time in seconds, and v1: the hex HMAC-SHA256 of t, a dot and the body as it came, keyed with the whole secret.
- Compute it on the body as it came, before parsing the JSON.
- Compare in constant time, and refuse a message whose t is more than 5 minutes from your clock.
- For 24 hours after "סוד חדש" (a new secret) the header holds two v1 values, one with the new secret and one with the old. Either one matching is enough.
# body.json: the body exactly as it came. T: the t of SpeakApp-Signature.
printf '%s.%s' "$T" "$(cat body.json)" \
| openssl dgst -sha256 -hmac "$SPEAKAPP_WEBHOOK_SECRET"
# The result must equal one of the v1 values in the header.GET/me#
The key and its organization. Which key this is, whose organization, its scopes, and the limits. Any key may read it: use it to check the connection.
Scope: Any key
curl "https://app.b-smart.org.il/api/v1/me" \
-H "Authorization: Bearer $SPEAKAPP_API_KEY"HTTP/1.1 200 OK
{
"organization": {
"id": "8c1d2b3a-4e5f-4a6b-9c7d-0e1f2a3b4c5d",
"name": "חברת הדוגמה בע״מ"
},
"key": {
"id": "0c6f2a51-7d0e-4c3a-9f1b-2a7e5d9c4b01",
"name": "CRM המכירות",
"scopes": [
"calls.read",
"recordings.read"
]
},
"limits": {
"requests_per_minute": 120,
"organization_requests_per_minute": 600,
"calls_per_minute": 20,
"recording_links_per_hour": 300,
"max_days": 31,
"page_size_max": 200
},
"version": "1.1"
}GET/pbxs#
PBXs. The organization's PBXs: an ID and a name. In an organization with several, every call, extension and queue carries its pbx_id.
Scope: Any key
curl "https://app.b-smart.org.il/api/v1/pbxs" \
-H "Authorization: Bearer $SPEAKAPP_API_KEY"HTTP/1.1 200 OK
{
"data": [
{
"id": "2f6a91c4-5b0e-4d7a-9c13-8e2b47d0a615",
"name": "ראשית"
}
],
"next_cursor": null
}GET/extensions#
Extensions. The organization's active extensions, and the user each belongs to. With state=1 also the phone's state now, from a copy at most 30 seconds old.
Scope: extensions.read (Extensions)
| Field | Type | Description |
|---|---|---|
| pbx_id | string | Only one PBX's extensions. |
| state | boolean | 1: also the phone's state (connected, do not disturb, forward always, recording). null: the PBX did not answer for it. |
curl "https://app.b-smart.org.il/api/v1/extensions?state=1" \
-H "Authorization: Bearer $SPEAKAPP_API_KEY"HTTP/1.1 200 OK
{
"data": [
{
"id": "7c1d0e42-9a3b-4f6e-b5c8-1d2e3f4a5b60",
"pbx_id": "2f6a91c4-5b0e-4d7a-9c13-8e2b47d0a615",
"number": "203",
"name": "דנה לוי",
"user_id": "b8e4f1a2-3c5d-4e6f-8a9b-0c1d2e3f4a5b",
"state": {
"connected": true,
"do_not_disturb": false,
"forward_always": false,
"recording": true
}
}
],
"next_cursor": null
}GET/users#
Users. The organization's active users: name, e-mail, job title, department, admin or user, and their extensions. Never a phone number.
Scope: users.read (Users)
curl "https://app.b-smart.org.il/api/v1/users" \
-H "Authorization: Bearer $SPEAKAPP_API_KEY"HTTP/1.1 200 OK
{
"data": [
{
"id": "b8e4f1a2-3c5d-4e6f-8a9b-0c1d2e3f4a5b",
"name": "דנה לוי",
"email": "dana@example.com",
"job_title": "מכירות",
"department": "מכירות",
"role": "user",
"extensions": [
{
"pbx_id": "2f6a91c4-5b0e-4d7a-9c13-8e2b47d0a615",
"number": "203"
}
]
}
],
"next_cursor": null
}GET/calls#
Calls. The organization's calls, newest first. Without from and to: today. Up to 31 days a request, up to 200 calls a page.
Scope: calls.read (Calls)
- extension: the organization's extension that took part. other_party: the other side (an outside number, or the other extension of an internal call). initiated_by: who called.
- direction: in, out or internal. result: answered, missed, busy, failed, or active for a call still going on.
- The next page: send only cursor=next_cursor. When it is null, this is the last page.
| Field | Type | Description |
|---|---|---|
| from | string | The first day, YYYY-MM-DD (Israel time). |
| to | string | The last day. Default: today. |
| direction | string | in, out or internal. |
| extension | string | Only one extension's calls. |
| number | string | A phone number, written either way (0545550172 or +972545550172). |
| pbx_id | string | Only one PBX's calls. |
| limit | integer | Calls a page, 1 to 200. Default: 100. |
| cursor | string | The previous page's next_cursor, alone. |
curl "https://app.b-smart.org.il/api/v1/calls?from=2026-11-01&to=2026-11-19&direction=in" \
-H "Authorization: Bearer $SPEAKAPP_API_KEY"HTTP/1.1 200 OK
{
"data": [
{
"id": "2f6a91c4-1763540000.1234",
"pbx_id": "2f6a91c4-5b0e-4d7a-9c13-8e2b47d0a615",
"started_at": "2026-11-19T10:13:20+02:00",
"direction": "in",
"result": "answered",
"extension": {
"number": "203",
"name": "דנה לוי"
},
"other_party": {
"number": "0545550172",
"name": "אבי"
},
"initiated_by": "other_party",
"number_dialed": "0733334560",
"duration_seconds": 130,
"talk_seconds": 120
}
],
"next_cursor": "eyJmcm9tIjoiMjAyNi0xMS0wMSIsInRvIjoiMjAyNi0xMS0xOSIsIm9mZnNldCI6MTAwfQ"
}GET/calls/{id}#
A call and its path. One call, and its path in the PBX: the number dialled, a menu, a queue, the extensions that rang and who answered.
Scope: calls.read (Calls)
- kind: number, menu, queue, extension, outside, voicemail or other. label is in Hebrew, as on the screen.
| Field | Type | Description |
|---|---|---|
| id | string | The call's id from GET /calls. |
curl "https://app.b-smart.org.il/api/v1/calls/2f6a91c4-1763540000.1234" \
-H "Authorization: Bearer $SPEAKAPP_API_KEY"HTTP/1.1 200 OK
{
"id": "2f6a91c4-1763540000.1234",
"pbx_id": "2f6a91c4-5b0e-4d7a-9c13-8e2b47d0a615",
"started_at": "2026-11-19T10:13:20+02:00",
"direction": "in",
"result": "answered",
"extension": {
"number": "203",
"name": "דנה לוי"
},
"other_party": {
"number": "0545550172",
"name": "אבי"
},
"initiated_by": "other_party",
"number_dialed": "0733334560",
"duration_seconds": 130,
"talk_seconds": 120,
"path": [
{
"at": "2026-11-19T10:13:20+02:00",
"kind": "number",
"label": "מספר 073-3334560 · ראשי",
"wait_seconds": 0,
"talk_seconds": 0,
"answered": false
},
{
"at": "2026-11-19T10:13:24+02:00",
"kind": "queue",
"label": "תור מכירות (8800)",
"wait_seconds": 6,
"talk_seconds": 0,
"answered": false
},
{
"at": "2026-11-19T10:13:30+02:00",
"kind": "extension",
"label": "שלוחה 203 · דנה לוי",
"wait_seconds": 4,
"talk_seconds": 120,
"answered": true
}
]
}GET/calls/{id}/recording#
A recording. A link to the call's recording. The link works without the key, for this recording only, for 5 minutes. A GET on it returns the file (WAV, MP3 or GSM, by Content-Type).
Scope: recordings.read (Recordings)
- Each link is logged in the organization's activity log as a download, in the key's name. Up to 300 links an hour a key.
- A call with no recording: 404 with no_recording. SpeakApp keeps no recordings: one is there as long as the PBX keeps it.
| Field | Type | Description |
|---|---|---|
| id | string | The call's id from GET /calls. |
curl "https://app.b-smart.org.il/api/v1/calls/2f6a91c4-1763540000.1234/recording" \
-H "Authorization: Bearer $SPEAKAPP_API_KEY"HTTP/1.1 200 OK
{
"url": "https://app.b-smart.org.il/api/v1/recordings/q3VbT…",
"expires_at": "2026-11-19T08:20:00.000Z",
"call_id": "2f6a91c4-1763540000.1234"
}GET/queues#
Queues. The organization's queues. With state=1 also their state now: who waits, the longest wait, today's answered and abandoned, and the agents by state.
Scope: queues.read (Queues and agents)
| Field | Type | Description |
|---|---|---|
| state | boolean | 1: also the state now, from a copy a few seconds old. |
curl "https://app.b-smart.org.il/api/v1/queues?state=1" \
-H "Authorization: Bearer $SPEAKAPP_API_KEY"HTTP/1.1 200 OK
{
"data": [
{
"id": "2f6a91c4-865",
"pbx_id": "2f6a91c4-5b0e-4d7a-9c13-8e2b47d0a615",
"number": "8800",
"name": "מכירות",
"state": {
"waiting": 2,
"longest_wait_seconds": 42,
"answered_today": 86,
"abandoned_today": 5,
"agent_counts": {
"total": 6,
"available": 2,
"on_call": 3,
"paused": 1
}
}
}
],
"next_cursor": null
}GET/queues/{id}/state#
A queue now. One queue now: who waits, in order (the number and the wait), and its agents: available, on_call, ringing, paused or offline, with the pause's reason.
Scope: queues.read (Queues and agents)
| Field | Type | Description |
|---|---|---|
| id | string | The queue's id from GET /queues. |
curl "https://app.b-smart.org.il/api/v1/queues/2f6a91c4-865/state" \
-H "Authorization: Bearer $SPEAKAPP_API_KEY"HTTP/1.1 200 OK
{
"id": "2f6a91c4-865",
"pbx_id": "2f6a91c4-5b0e-4d7a-9c13-8e2b47d0a615",
"number": "8800",
"name": "מכירות",
"waiting": 1,
"longest_wait_seconds": 42,
"answered_today": 86,
"abandoned_today": 5,
"agent_counts": {
"total": 2,
"available": 0,
"on_call": 1,
"paused": 1
},
"callers": [
{
"position": 1,
"number": "0355550188",
"wait_seconds": 42
}
],
"agents": [
{
"extension": "203",
"name": "דנה לוי",
"state": "on_call",
"paused": false,
"pause_reason": null,
"pause_seconds": null,
"calls_taken": 31
},
{
"extension": "207",
"name": "רונית כהן",
"state": "paused",
"paused": true,
"pause_reason": "הפסקת צהריים",
"pause_seconds": 300,
"calls_taken": 4
}
]
}GET/agents#
Agents. Every agent of the organization's queues once: the state now and for how long, its queues (logged in or not, paused and why), and today's work.
Scope: queues.read (Queues and agents)
- state: available, on_call, ringing, paused, do_not_disturb, offline or logged_out.
curl "https://app.b-smart.org.il/api/v1/agents" \
-H "Authorization: Bearer $SPEAKAPP_API_KEY"HTTP/1.1 200 OK
{
"data": [
{
"extension": "203",
"pbx_id": "2f6a91c4-5b0e-4d7a-9c13-8e2b47d0a615",
"name": "דנה לוי",
"state": "on_call",
"seconds_in_state": 95,
"queues": [
{
"id": "2f6a91c4-865",
"name": "מכירות",
"logged_in": true,
"paused": false,
"pause_reason": null
}
],
"today": {
"answered": 31,
"outgoing": 12,
"talk_seconds": 5400,
"missed": 2
}
}
],
"next_cursor": null
}Changelog#
- 2026-11-20 · Version 1.1: webhooks for a missed call, an ended call and a ready recording, signed and retried.
- 2026-11-20 · Version 1.0: organization keys, calls, call paths, recordings, extensions, users, queues and agents. Read only.
SpeakApp