NGUC API
A unified REST and WebSocket API for the Infinity PBX platform. Manage users and queues, pull statistics and recordings, and react to call events in real time.
Three steps to your first request
Most integrations exchange credentials for an access token, then call REST endpoints with a bearer header.
-
1
Authenticate
POST username and password to
/oauth2/user-credentialsto receive anaccess_token. -
2
Call an endpoint
Send
Authorization: Bearer <token>with each request. -
3
Refresh as needed
Tokens last 24h. Use the refresh token to get a new pair without re-prompting credentials.
OAuth 2.0 password grant
All NGUC API access is authenticated. Exchange your registered user account for a bearer token via the password grant flow. The credential information can be sent as either a JSON document or as URL-encoded form data.
Required parameters
- grant_type
- Must be
password. - client_id
- Format
external.<COMPANY>. - username
- Your account username.
- password
- Your account password.
- tfa
- 2FA code if enabled, otherwise empty string.
Status code semantics
401 for bad password — 402 for missing or expired 2FA code.
# POST /oauth2/user-credentials curl --data-raw '{ "grant_type": "password", "client_id": "external.COMPANY", "username": "USER", "password": "SECRET", "tfa": "" }' \ -H 'Content-Type: application/json' \ -X POST https://api-nguc.weblink.se/oauth2/user-credentials
Refresh access token
Access tokens are short-lived. Use the refresh_token from the original response to obtain a new pair without re-prompting credentials. Each refresh issues a new 24-hour access token; the same refresh token is reused and its validity is extended (up to ~6 weeks) on every refresh.
Authenticated requests
Once you have a token, every API call must carry an Authorization header.
curl --data-raw '{ "grant_type": "refresh_token", "refresh_token": "CURRENT_REFRESH_TOKEN", "client_id": "external.COMPANY" }' \ -H 'Content-Type: application/json' \ -X POST https://api-nguc.weblink.se/oauth2/refresh-token
curl -H 'Authorization: Bearer CURRENT_ACCESS_TOKEN' \ -X GET https://api-nguc.weblink.se/country
Simple API
The Simple API is different from the rest of the API: it authenticates with a token and is not tied to a user. To gain access, contact us. Send the token as a bearer header on the /simple/* endpoints:
curl -H 'Authorization: Bearer SIMPLE_API_TOKEN' \ 'https://api-nguc.weblink.se/simple/company/extensions'
100 requests per 60 seconds
Limits are scoped per access token, not per IP. Once you cross the threshold the API returns 429 Too Many Requests with a Retry-After header indicating how many seconds to wait.
Sliding window per access token
HTTP/1.1 429 Too Many Requests Retry-After: 42
Status codes
| Code | Meaning | When you'll see it |
|---|---|---|
| 200 | OK | Request handled successfully. |
| 401 | Unauthorized | Bad password or expired token. |
| 402 | Payment Required | Missing, incorrect or expired 2FA code. |
| 429 | Too Many Requests | Rate limit exceeded — see Retry-After. |
Queue statistics
read queue statistics permission.List queue call statistics with filtering and pagination Get statistics for any calls originating from specified queues
Export queue call statistics as a downloadable document Download available call statistics in specified document format
Get detailed statistics for a specific queue call Get statistics for a specific call specified by it's unique call id
Export detailed call statistics as a downloadable document Download detailed call statistics in specified document format
Get aggregated queue statistics Gets statistics for specified queues
Endpoint details
get /company/queuestat/calls List queue call statistics with filtering and pagination Get statistics for any calls originating from specified queues
Returns a paginated list of individual queue calls. Use from/to or reldays to specify the time range. When users[], includeNone, or includeExternal is set, calls are filtered by handler. The event field indicates the call outcome: ABANDON, COMPLETEAGENT, COMPLETECALLER, EXITEMPTY, EXITWITHKEY, or EXITWITHTIMEOUT.
| Name | Type | Required | Description |
|---|---|---|---|
| reldays | integer | no | Relative positive number of days before `to` query param that will be used to compute the `from` parameter. |
| from | string | no | Datetime from which calls will be included in the result, see the description for formats. |
| to | string | no | Datetime to which calls will be included in the result, see the description for formats. `NOW` will use the date and time of the API call. Default: NOW |
| from_time | string | no | Time of day in format: `HH:mm:ss` (08:00:00). For each day calls after this time will be included. Default: 00:00:00 |
| to_time | string | no | Time of day in format: `HH:mm:ss` (16:59:00). For each day calls before this time will be included. Default: 23:59:59 |
| weekdays | integer[] | no | Zero based weekday index starting with monday to include calls for. Default: 0,1,2,3,4,5,6 |
| users | integer[] | no | An array of user id's to get calls for. |
| queues | integer[] | no | an array of queue id's to get calls for. |
| includeNone | boolean | no | True indicates that we should limit calls that was not handled by any agent. Default: false |
| includeExternal | boolean | no | True indicates that we should limit calls that was handled by external phone numbers. Default: false |
| limit | integer | no | Limit the number of records returned (used for paginating result). The limit will be applied after sorting. Default: 20 |
| limit_from | integer | no | Record offset to return data from (used for paginating result). |
| order_by | string -enum | no | The data type to sort by. Allowed: [datetime, id] Default: datetime |
| order_dir | string -enum | no | The order in which to sort the data. Allowed: [ASC, DESC] Default: ASC |
curl -G -H 'Authorization: Bearer <>' \ -d 'from=2024-01-01%2008%3A00%3A00' \ -d 'to=2024-06-13%2016%3A59%3A00' \ -d 'from_time=08%3A00' \ -d 'to_time=16%3A59' \ -d 'weekdays[]=0' \ -d 'weekdays[]=1' \ -d 'weekdays[]=2' \ -d 'weekdays[]=3' \ -d 'weekdays[]=4' \ -d 'weekdays[]=5' \ -d 'weekdays[]=6' \ -d 'graphDataTypes[]=answered' \ -d 'graphDataTypes[]=abandoned' \ -d 'graphDataTypes[]=unanswered' \ -d 'graphDataTypes[]=average_wait_time' \ -d 'graphDataTypes[]=average_talk_time' \ -d 'queues[]=26355' \ https://api-nguc.weblink.se/company/4/queuestat/calls"
{
"count": "3",
"limit": 20,
"limit_from": 0,
"calls": [
{
"id": "343601609",
"datetime": "2024-04-09 16:32:03",
"datetimeconnect": "2024-04-09 16:32:03",
"datetimeend": "2024-04-09 16:32:15",
"event": "ABANDON",
"agent": "NONE",
"clid": "9863",
"pbx_name": "Molle test",
"uniqueid": "s1-1712673123.342",
"wait_time": "12",
"talk_time": "0",
"ast_queue_id": "27028",
"queue_extension": "1338",
"call_guid": null,
"callerid": null,
"did": null
},
{
"id": "359787086",
"datetime": "2024-05-28 09:22:34",
"datetimeconnect": "2024-05-28 09:22:34",
"datetimeend": "2024-05-28 09:22:37",
"event": "ABANDON",
"agent": "NONE",
"clid": "9861",
"pbx_name": "Molle test",
"uniqueid": "s1-1716880954.44",
"wait_time": "3",
"talk_time": "0",
"ast_queue_id": "27028",
"queue_extension": "1338",
"call_guid": null,
"callerid": null,
"did": null
},
{
"id": "359787050",
"datetime": "2024-05-28 09:22:35",
"datetimeconnect": "2024-05-28 09:22:35",
"datetimeend": "2024-05-28 09:22:38",
"event": "ABANDON",
"agent": "NONE",
"clid": "9861",
"pbx_name": "Molle test",
"uniqueid": "s1-1716880955.53",
"wait_time": "3",
"talk_time": "0",
"ast_queue_id": "27028",
"queue_extension": "1338",
"call_guid": null,
"callerid": null,
"did": null
}
],
}
get /company/queuestat/calls/download Export queue call statistics as a downloadable document Download available call statistics in specified document format
Downloads matching calls as a file. Requires the downloadType parameter (csv, html, pdf, xlsx, xls, excel). Uses the same filters as the browse endpoint. The export includes columns for date, queue, agent, caller/called numbers, call type, wait/talk times, service levels, and internal routing info.
| Name | Type | Required | Description |
|---|---|---|---|
| downloadtype | string -enum | no | fileformat used to generate report in. Allowed: [html, csv, excel, xlsx, xls, pdf] |
| from | string | no | datetime in format: 'YYYY-mm-dd HH:mm:ss' (2024-12-01 08:00:00) |
| to | string | no | datetime in format: 'YYYY-mm-dd HH:mm:ss' (2024-12-24 16:59:00) |
| weekdays | integer[] | no | an array of weekday index's starting with monday as zero. |
| users | integer[] | no | an array of userid's to get calls for. Specify -1 to include calls that was answered by external phone numbers. Specify 0 to include calls that was abandoned hungup without being assigned to any agent. |
| queues | integer[] | no | an array of queueid's to get calls for. |
| includeNone | boolean | no | |
| includeExternal | boolean | no | true indicates that we should include calls that was handled by external phone numbers. |
| limit | integer | no | limit the number of records returned, used for pagination. Default: 20 |
| limit_from | integer | no | used for pagination. |
| order_by | string -enum | no | the sort order in which to return the results. Allowed: [datetime, id] |
| order_dir | string -enum | no | Allowed: [ASC, DESC] |
curl -G -H 'Authorization: Bearer <>' \ -d 'downloadType=csv' \ -d 'from=2024-01-01%2008%3A00%3A00' \ -d 'to=2024-06-30%2016%3A59%3A00' \ -d 'queues[]=26355' \ https://api-nguc.weblink.se/company/queuestat/calls/download \ -o queue_calls.csv
get /company/queuestat/calls/{qsCallUniqueId} Get detailed statistics for a specific queue call Get statistics for a specific call specified by it's unique call id
Returns detailed event records for a specific call, showing each step the call took through the queue system.
| Name | Type | Required | Description |
|---|---|---|---|
| qsCallUniqueId | string | yes | unique call id |
curl -H 'Authorization: Bearer <>' \ https://api-nguc.weblink.se/company/queuestat/calls/s1-1712673123.342
[
{
"datetime": "2024-04-09 16:31:51",
"queue": "Support queue",
"agent": "",
"event": "ENTERQUEUE",
"info1": "",
"info2": "9863",
"info3": "1",
"info4": "",
"info5": ""
},
{
"datetime": "2024-04-09 16:32:03",
"queue": "Support queue",
"agent": "NONE",
"event": "ABANDON",
"info1": "1",
"info2": "1",
"info3": "12",
"info4": "",
"info5": ""
}
]
get /company/queuestat/calls/{qsCallUniqueId}/download Export detailed call statistics as a downloadable document Download detailed call statistics in specified document format
Downloads detailed event records for a single call as a file. Requires the downloadtype parameter. The export includes columns for date, queue, agent, event, and five info fields.
| Name | Type | Required | Description |
|---|---|---|---|
| qsCallUniqueId | string | yes | unique call id |
| Name | Type | Required | Description |
|---|---|---|---|
| downloadtype | string -enum | no | fileformat used to generate report in. Allowed: [html, csv, excel, xlsx, xls, pdf] |
curl -H 'Authorization: Bearer <>' \ "https://api-nguc.weblink.se/company/queuestat/calls/s1-1712673123.342/download?downloadtype=xlsx" \ -o call_detail.xlsx
get /company/queuestat Get aggregated queue statistics Gets statistics for specified queues
Returns an object keyed by queue extension number. Each entry contains the queue name, aggregate counters (answered, abandoned, etc.), member performance data, and any currently waiting callers.
| Name | Type | Required | Description |
|---|---|---|---|
| from | string | no | datetime in format: 'yyyy-MM-dd HH:mm:ss' (2024-12-27 08:00:00) |
| to | string | no | datetime in format: 'yyyy-MM-dd HH:mm:ss' (2024-12-27 16:59:00) |
| from_time | string | no | time in format: 'HH:mm:ss' (08:00:00) |
| to_time | string | no | time in format : 'HH:mm:ss' (16:59:00) |
| users | integer[] | no | an array of userid's to get data for. |
| queues | integer[] | no | an array of queueid's to get data for. |
| weekdays | integer[] | no | an array of weekday indexes starting with monday as zero. |
| includeNone | boolean | no | |
| includeExternal | boolean | no | true indicates that we should include calls that was handled by external phone numbers. |
curl -G -H 'Authorization: Bearer <>' \ -d 'from=2024-01-01%2008%3A00%3A00' \ -d 'to=2024-06-30%2016%3A59%3A00' \ -d 'weekdays[]=0' \ -d 'weekdays[]=1' \ -d 'weekdays[]=2' \ -d 'weekdays[]=3' \ -d 'weekdays[]=4' \ -d 'queues[]=26355' \ https://api-nguc.weblink.se/company/queuestat
{
"1338": {
"name": "Support queue",
"stats": {
"answered": 145,
"abandoned": 23,
"unanswered": 5,
"average_wait_time": 18,
"average_talk_time": 245
},
"member": [
{
"agent_id": "1234",
"name": "John Doe",
"answered": 42,
"talk_time": 10290
}
],
"entry": []
}
}
Recordings
/recording support pagination and filtering by user, queue and date range.List recordings with search and pagination List all available recordings
Download a stored recording file Download company recording
Endpoint details
get /company/recordings List recordings with search and pagination List all available recordings
| Name | Type | Required | Description |
|---|---|---|---|
| src | string | no | source phone number |
| dst | string | no | destination phone number |
| duration | integer | no | duration in seconds |
| date_from | string | no | datetime in format: 'yyyy-MM-dd HH:mm:ss' (2024-12-27 08:00:00) |
| date_to | string | no | datetime in format: 'yyyy-MM-dd HH:mm:ss' (2024-12-27 16:59:00) |
| order_dir | string -enum | no | Sort direction Allowed: [ASC, DESC] Default: DESC |
| order_by | string -enum | no | Field to order results by Allowed: [added, calldate, dst, src, duration] Default: added |
| limit | integer | no | limit the number of records returned (used for paginating result) Default: 2 |
| limit_from | integer | no | record offset to return data from (used for paginating result) |
curl -G -H 'Authorization: Bearer <>' \
-d 'date_from=2024-01-01%2008%3A00%3A00' \
-d 'date_to=2024-06-13%2016%3A59%3A00' \
-d 'src=' \
-d 'dst=' \
"https://api-nguc.weblink.se/company/recordings"
{
"count": "157",
"limit": 2,
"limit_from": 0,
"recordings": [
{
"id": "",
"added": "2024-06-10 12:06:43",
"downloaded": "0",
"channel_id": "",
"pbx_user_id": "",
"call_guid": "",
"duration": "0",
"uploaded": null,
"pbx_cdr_id": "",
"direction": null,
"src_callerid": "",
"src_name": "",
"dst_callerid": "",
"dst_name": ""
},
{
"id": "",
"added": "2024-05-30 16:22:12",
"downloaded": "0",
"channel_id": "",
"pbx_user_id": "",
"call_guid": "",
"duration": "25",
"uploaded": null,
"pbx_cdr_id": "",
"direction": null,
"src_callerid": "",
"src_name": "Missing",
"dst_callerid": "",
"dst_name": ""
}
]
}
get /recording/stored/{recordingId}/{audioType} Download a stored recording file Download company recording
| Name | Type | Required | Description |
|---|---|---|---|
| recordingId | integer | yes | unique recording id |
| audioType | string -enum | no | fileformat of the requested recording. Allowed: [mp3, wav] Default: mp3 |
curl -H 'Authorization: Bearer <>' \
"https://api-nguc.weblink.se/recording/stored/{RECORDING_ID}/mp3" \
-o 'recording.mp3' \
Reports
Create a new argument for a report
Create a new report with arguments
Endpoint details
post /company/report/{id}/argument Create a new argument for a report
| Name | Type | Required | Description |
|---|---|---|---|
| id | integer | yes | The id |
post /company/report Create a new report with arguments
AI transcripts
Get call interactions for a given phone number Get interactions for a given number
Get user call history Get user call history
Search queue call history Search call history for queues
Get a transcript by ID Get transcript by id You will get both the summaries and the full transcript in the same response If you are connected with websocket you get an event when the respective summary is ready, usually within 2-5 seconds
Endpoint details
get /user/call/{number} Get call interactions for a given phone number Get interactions for a given number
If an interaction has a transcript that you have the right to see, i.e. a queue conversation, or a conversation that you have participated in yourself, you will be given: "transcript_id": "xxxxx", "transcript_status": "done"
| Name | Type | Required | Description |
|---|---|---|---|
| number | string | yes | the phone number to search for. |
curl -G -H 'Authorization: Bearer <>' \
"https://api-nguc.weblink.se/user/call/1234"
get /user/{userId}/call/history Get user call history Get user call history
If a call has been transcribed, you will receive: "transcript_id": "xxxxx", "transcript_status": "done"
| Name | Type | Required | Description |
|---|---|---|---|
| userId | integer | yes |
| Name | Type | Required | Description |
|---|---|---|---|
| limit | integer | no | limit number of results Default: 20 |
| limit_from | integer | no | starting point to fetch limit number of results |
| show | string[] | no | the category of calls to show history for. |
| datetime_from | string | no | datetime in format: 'yyyy-MM-dd HH:mm:ss' (2024-12-27 08:00:00) |
| datetime_to | string | no | datetime in format: 'yyyy-MM-dd HH:mm:ss' (2024-12-27 16:59:00) |
| order_dir | string -enum | no | the direction to order the results by. Allowed: [ASC, DESC] Default: DESC |
| search | string | no | phone number to search for. |
curl -G -H 'Authorization: Bearer <>' \
-d 'limit-from=0' \
-d 'limit=50' \
-d 'order=DESC' \
"https://api-nguc.weblink.se/user/call/history"
get /queue/cdr Search queue call history Search call history for queues
If a queue conversation has been transcribed, you will receive: "transcript_id": "xxxxx", "transcript_status": "done"
| Name | Type | Required | Description |
|---|---|---|---|
| limit | integer | no | number of rows to return Default: 20 |
| limit_from | integer | no | starting point for returning limit number of rows |
| datetime_from | string | no | date of oldest call to return in format: 'yyyy-MM-dd HH:mm:ss' (2024-12-27 08:00:00) |
| datetime_to | string | no | date of newest call to return in format: 'yyyy-MM-dd HH:mm:ss' (2024-12-27 08:00:00) |
| order_dir | string -enum | no | direction to order result by. Allowed: [DESC, ASC] Default: DESC |
| users | integer[] | no | User ids to filter the results |
| queues | integer[] | no | Queue ids to filter the results |
| disposition | string -enum | no | disposition of call to filter calls by. Allowed: [ANSWERED, NOANSWERED] |
| handled_status | string -enum | no | handled status to filter calls by. Allowed: [new, handled] |
curl -G -H 'Authorization: Bearer <>' \
-d 'queues[]=20' \
-d 'queues[]=21' \
-d 'limit=40' \
-d 'limit_from=0' \
-d 'order=DESC' \
"https://api-nguc.weblink.se/queue/cdr"
get /transcript/{transcriptId} Get a transcript by ID Get transcript by id You will get both the summaries and the full transcript in the same response If you are connected with websocket you get an event when the respective summary is ready, usually within 2-5 seconds
There you get both the summaries and the full transcript in the same response. If you are connected with websocket you get an event when the respective summary is ready, usually within a few seconds.
| Name | Type | Required | Description |
|---|---|---|---|
| transcriptId | integer | yes | the id of the transcript to retrieve. |
curl -G -H 'Authorization: Bearer <>' \
"https://api-nguc.weblink.se/transcript/123456"
WebSocket event stream
Be notified instantly when users, devices, queues and calls change state. NGUC pushes events over WebSockets using the SockJS protocol. Only status changes generate events, so you should fetch the initial state via REST and apply events as deltas.
Reference specification.
Examples in many languages.
Server emits h every ~25s.
Connect & authenticate
Open a WebSocket connection to the event endpoint with two random ID segments. id1 is a 3-digit numerical value (e.g. 123); id2 is a randomly generated 10–40 character alphanumeric string unique to your connection.
The server sends o as a prompt for authentication. You must reply within a few seconds with a valid OAuth 2.0 access token, otherwise the connection is dropped. When you refresh the access token, you must issue a new authenticate message on the open socket — there is no need to reconnect.
wss://event-nguc.weblink.se/id1/id2/websocket
rand(100, 999) . "/" . substr(md5(microtime()), 0, 8)
["[\"authenticate\",{\"authorization\":\"Bearer <access_token>\"}]"]
Protocol symbols
o
Server is requesting authentication.
c[…]
Authentication failed (with error code).
a[…]
Event payload received.
h
Heartbeat — emitted every ~25 seconds.
a["[\"EventName\", { /* event data */ }]"]
Event catalog
Click any event to see its payload schema and an example.
Cdr
User Call Data Record event
Call information associated with a single user
| Field | Type | Format | Description |
|---|---|---|---|
| id | string | int32 |
Unique call identifier as integer |
| pbx_recording_id | string | int32 |
Recording identifier that is associated with the call If there are no recording present then a boolean false will be used. |
| dst_pbx_user_id | string | int32 |
Destination/callee user identifier. If the destination is a user in the PBX then this property will contain the user identifier. |
| src_pbx_user_id | string | int32 |
Source/caller user identifier. If the caller is a user in the PBX then this property will contain the user identifier. |
| remote_pbx_contact_id | string | int32 |
Remote contact identifier |
| direction | string-enum |
The direction of the call; if the call originated (OUT) or received (IN) Allowed: [IN, OUT] |
|
| dst | string |
Destination/dialed number |
|
| calldate | string | date-time |
Date and time when the call was created |
| src | string |
Source number/ANI |
|
| billsec | string | int32 |
Billable seconds Number of seconds the call has lasted that will be used for billing. |
| disposition | string-enum |
Current disposition of the call The result/outcome of the call. Allowed: [INVALID, ANSWER, NO ANSWER, BUSY, CANCEL] |
|
| call_guid | string |
Call identifier as string Call identifier as string. Max chars: 40 |
{
"id": "1019433380",
"pbx_recording_id": false,
"dst_pbx_user_id": null,
"src_pbx_user_id": "86480",
"remote_pbx_contact_id": null,
"direction": "OUT",
"dst": "90510",
"calldate": "2024-09-10 09:03:09",
"src": "3024",
"billsec": "12",
"disposition": "ANSWER",
"call_guid": "92d76de54e02a5c6ef439bd7459f07316c5b0536"
}
Simple API
The simple endpoints are different from the rest of the API: they authenticate with a token and are not tied to a user. They are intended for server-to-server integrations.
To gain access, contact us.
Full API reference
Every endpoint, every parameter, every response — fully interactive. Try requests directly from the browser.
Swagger UI
Live, interactive OpenAPI explorer with grouped controllers and request/response samples.