Introduction

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.

REST
JSON over HTTPS, OAuth 2.0
WSS
Live events via SockJS
100/60s
Rate limit per access token
Quick start

Three steps to your first request

Most integrations exchange credentials for an access token, then call REST endpoints with a bearer header.

  1. 1

    Authenticate

    POST username and password to /oauth2/user-credentials to receive an access_token.

  2. 2

    Call an endpoint

    Send Authorization: Bearer <token> with each request.

  3. 3

    Refresh as needed

    Tokens last 24h. Use the refresh token to get a new pair without re-prompting credentials.

Authentication

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
POST /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.

POST /oauth2/refresh-token
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
GET /country Authenticated request example
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:

Authenticated Simple API request
curl -H 'Authorization: Bearer SIMPLE_API_TOKEN' \
  'https://api-nguc.weblink.se/simple/company/extensions'
Rate limits

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.

Window
60s

Sliding window per access token

Throttled response
HTTP/1.1 429 Too Many Requests
Retry-After: 42
Errors

Status codes

Code Meaning When you'll see it
200OKRequest handled successfully.
401UnauthorizedBad password or expired token.
402Payment RequiredMissing, incorrect or expired 2FA code.
429Too Many RequestsRate limit exceeded — see Retry-After.
Guides

Queue statistics

Aggregate metrics, per-agent performance, and individual call records for any PBX queue. All endpoints require the read queue statistics permission.

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.

Query parameters
NameTypeRequiredDescription
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
Required permissions
read queue statistics
Request example
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"
Response example
{
    "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.

Query parameters
NameTypeRequiredDescription
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]
Required permissions
read queue statistics
Request example
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.

Path parameters
NameTypeRequiredDescription
qsCallUniqueId string yes unique call id
Required permissions
read queue statistics
Request example
curl -H 'Authorization: Bearer <>' \
https://api-nguc.weblink.se/company/queuestat/calls/s1-1712673123.342
Response example
[
    {
        "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.

Path parameters
NameTypeRequiredDescription
qsCallUniqueId string yes unique call id
Query parameters
NameTypeRequiredDescription
downloadtype string -enum no fileformat used to generate report in.
Allowed: [html, csv, excel, xlsx, xls, pdf]
Required permissions
read queue statistics
Request example
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.

Query parameters
NameTypeRequiredDescription
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.
Required permissions
read queue statistics
Request example
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
Response example
{
    "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

Browse, stream and download call recordings. The endpoints under /recording support pagination and filtering by user, queue and date range.

Endpoint details

get /company/recordings List recordings with search and pagination List all available recordings
Query parameters
NameTypeRequiredDescription
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)
Required permissions
read company recording
Request example
    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"
Response example
    {
        "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
Path parameters
NameTypeRequiredDescription
recordingId integer yes unique recording id
audioType string -enum no fileformat of the requested recording.
Allowed: [mp3, wav]
Default: mp3
Required permissions
read company recording
Request example
    curl -H 'Authorization: Bearer <>' \
        "https://api-nguc.weblink.se/recording/stored/{RECORDING_ID}/mp3" \
        -o 'recording.mp3' \

Reports

Schedule and generate reports across queues, users and date ranges.

Endpoint details

post /company/report/{id}/argument Create a new argument for a report
Path parameters
NameTypeRequiredDescription
id integer yes The id
Required permissions
create company report
post /company/report Create a new report with arguments
Required permissions
create company report

AI transcripts

Generate and retrieve AI-powered transcripts for call recordings, including summaries and detected entities.

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"

Path parameters
NameTypeRequiredDescription
number string yes the phone number to search for.
Required permissions
read user call history read user transcript_access
Request example
    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"

Path parameters
NameTypeRequiredDescription
userId integer yes
Query parameters
NameTypeRequiredDescription
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.
Required permissions
read user call history read user transcript_access
Request example
    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"

Query parameters
NameTypeRequiredDescription
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]
Required permissions
read queue monitor
Request example
    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.

Path parameters
NameTypeRequiredDescription
transcriptId integer yes the id of the transcript to retrieve.
Required permissions
read queue monitor read user transcript_access read company transcript_access
Request example
    curl -G -H 'Authorization: Bearer <>' \
    "https://api-nguc.weblink.se/transcript/123456"
Real-time events

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.

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.

Endpoint
wss://event-nguc.weblink.se/id1/id2/websocket
Generate IDs (PHP)
rand(100, 999) . "/" . substr(md5(microtime()), 0, 8)
Authenticate frame
["[\"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.

Event payload shape
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
Example payload
{
    "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"
}
Reference

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.

?only[]= filter to specific categories   ·   ?hide show category list only