logo

@(udesk)[CTI|API|CTI CLOUD]

General Specifications

Request Format

Base URL https://{host}/{Type}/{version}/{api}?Timestamp={Timestamp}&AppId={AppId}

  • host: The API domain name.
  • Type: ccapi
  • version: The API version, currently v2.
  • api: See the specific API URI.
  • Timestamp: UTC timestamp, accurate to the millisecond.
  • AppId: A UUID string used to specify which APP to operate on, required for all operations except creating an APP. Note: The IP and port (port number) in the example are project-related. Please contact the pre-sales or after-sales manager for confirmation. HTTP Header
  • Accept: "application/json"
  • Content-Type: "application/json;charset=utf-8" HTTP METHOD
  • GET (SELECT): Retrieve resources (one or more) from the server.
  • POST (CREATE): Create a new resource on the server.
  • PUT (UPDATE): Update a resource on the server (the client provides the complete resource with changes).
  • PATCH (UPDATE): Update a resource on the server (the client provides the attributes that have changed).
  • DELETE (DELETE): Delete a resource from the server. HTTP Status Code
  • 200 OK - [GET]: The server successfully returned the data requested by the user, and this operation is idempotent.
  • 201 CREATED - [POST/PUT/PATCH]: The user successfully created or modified data.
  • 202 Accepted - [*]: Indicates that a request has entered the background queue (asynchronous task)
  • 204 NO CONTENT - [DELETE]: The user successfully deleted data.
  • 400 INVALID REQUEST - [POST/PUT/PATCH]: The request made by the user has errors, and the server did not perform any new or modified data operations, and this operation is idempotent.
  • 401 Unauthorized - [*]: Indicates that the user does not have permission (token, username, password error).
  • 403 Forbidden - [*] Indicates that the user is authorized (opposite to 401 error), but access is forbidden.
  • 404 NOT FOUND - [*]: The request made by the user is for a non-existent record, and the server did not perform any operations, and this operation is idempotent.
  • 406 Not Acceptable - [GET]: The format requested by the user is not available (for example, the user requests JSON format, but only XML format is available).
  • 410 Gone - [GET]: The resource requested by the user has been permanently deleted and will not be obtained again.
  • 422 Unprocessable Entity - [POST/PUT/PATCH] When creating an object, a validation error occurs.
  • 500 INTERNAL SERVER ERROR - [*]: An error occurred on the server, and the user will not be able to determine if the request was successful.

Response Format

General

  • Responses are in UTF-8 encoded JSON format.
  • See [Response Codes](Response Codes.md) for response codes. Correct Response Format
{
  "ErrCode": "000000", // Response code (required)
  "ErrDesc": "OK",   // Response description (required)
  "Result": {
    // Data...
  }
}

Error Response Format

{
  "ErrCode": "000001",     // Response code (required)
  "ErrDesc": "Parameter error", // Response description (required)
  "Result": {
    // Data...
  }
}

WebSocket Message Format

Request Message Standard Header

{
    "Ver": "1.0",   // Protocol version number
    "UA": "Chrome 62;uvcsdk-js-1.0",  // Optional, <browser or mobile operation>;<SDK>
    "SeqId": 1,        // Sequence ID, defined by the message sender, incrementally ordered. The response sequence ID is the same as the sent sequence ID
    "MsgId": "uuid",   // Message ID, a unique identifier for each message, defined by the message sender. The response message ID is the same as the sent message ID
    "MsgType":"REQ", // Request message: REQ
    "AppId": "f781fd92-9e96-4195-7a7e-257307edb4ad",
    "AgentId": "1443",
    "Timestamp": 1511069652789, // UTC timestamp, accurate to the millisecond
}

Response Message Standard Header

{
    "Ver": "1.0",   // Protocol version number
    "SeqId": 1,        // The response sequence ID is the same as the sent sequence ID
    "MsgId": "uuid",        // The response message ID is the same as the sent message ID
    "MsgType":"REP", // Response message: REP
    "Timestamp": 1511070594789, // UTC timestamp, accurate to the millisecond
    "ErrCode": "000000",        // Success: 000000,
    "ErrDesc": "OK",          // Error description, success is: OK
}

Notification Message Standard Header

Notification messages do not require a response

{
    "Ver": "1.0",   // Protocol version number
    "SeqId": 1,        // Sequence ID, defined by the message sender, incrementally ordered. The response sequence ID is the same as the sent message ID
    "MsgId": "uuid",   // Message ID, a unique identifier for each message, defined by the message sender. The response message ID is the same as the sent message ID
    "MsgType":"NTF", // Notification message: NTF
    "Timestamp": 1511069652789, // UTC timestamp, accurate to the millisecond
}

Event Message Standard Header

Event messages require an evtAck response

{
    "Ver": "1.0",   // Protocol version number
    "SeqId": 1,        // Sequence ID, defined by the message sender, incrementally ordered. The response message ID is the same as the sent message ID
    "MsgId": "uuid",   // Message ID, a unique identifier for each message, defined by the message sender. The response message ID is the same as the sent message ID
    "MsgType":"EVT", // Event message: EVT
    "Timestamp": 1511069652789, // UTC timestamp, accurate to the millisecond
}

Event Response Message

{
    "Ver": "1.0",   // Protocol version number
    "SeqId": 1,        // Sequence ID. The response sequence ID is the same as the sent sequence ID
    "MsgId": "uuid", // Message ID, a unique identifier for each message, the response message ID is the same as the sent message ID
    "MsgType":"ACK", // Event response message: ACK
    "Timestamp": 1511069652789, // UTC timestamp, accurate to the millisecond
    "Method": "{EvtMethod}"
}

Data Format Conventions

PSTN Numbers

  • Landline format: 0{area code}{local number}
  • Mobile format: {11-digit mobile number}
  • International number: 00{international country code}{national area code}{local number}
  • Agent SIP number: {company number prefix}{agent extension number}
  • Company number prefix: 9{9 digits}
  • Agent extension number: {4 digits} Examples
"01067654637" # Landline number
"13676546374" # Mobile number

Extension Numbers

  • Four-digit number starting with a non-zero digit: [1-9]\d{3} Example
"8001"      # Extension number

Queue ID (QueueId)

  • 4-digit number starting with 9: 9\d{3} Agent ID (AgentId)
  • Digits: \d+
  • Maximum length: 32 characters Agent Work Number (WorkId)
  • Digits or characters: \w+
  • Maximum length: 32 characters Timestamp (Timestamp)
  • Uses UTC time
  • Format: Unix Time, which is the number of milliseconds since "1970-01-01 00:00:00.000".

Authentication Methods

Server-Side API Authentication

  • All interfaces use HTTPS encryption
  • Sign: SHA1(Sid + AuthToken + Timestamp)
  • Sid: Account
  • AuthToken: Authentication token
  • Timestamp: Timestamp, valid within 10 minutes, in milliseconds

Parameters (URL Query String)

  • Timestamp
  • AppId
  • Sid
  • Sign Example GET request
curl https://xxx.udesk.cn/ccapi/v2/agents?Timestamp=1519468251&AppId=6f142ddb-47ed-442e-83e7-6d2574d77aa2&Sid=1234567890&Sign=9416b06a42d56dc3be412fa084e787dba52a2769

Front-End API Authentication

  • All interfaces use HTTPS encryption
  • The front end needs to request Sign from the business server
  • The method for the business server to calculate the front-end Sign: SHA1(AgentId + AuthToken + Timestamp)
  • Parameters (URL Query String)
  • Timestamp: Timestamp, valid within 10 minutes
  • AgentId: Agent ID
  • AuthToken: Authentication token Example
https://xxx.udesk.cn/ccapi/v2/agents?Timestamp=1519468251&AppId=6f142ddb-47ed-442e-83e7-6d2574d77aa2&AgentId=8001&Sign=9416b06a42d56dc3be412fa084e787dba52a2769

WebSocket Authentication

Server-Side API Documentation

Application Management

Create Application

URL: apps METHOD: POST Notes

  1. To call the interface to create an application, you need AppId (generated by the CRM system), Sid (provided by udesk), and AuthToken (provided by udesk). The interface depends on the CRM system and cannot be called separately.
  2. If you already have AppId and Sid, the call example is as follows
curl {{base_url}}/ccapi/v2/apps?Timestamp={{timestamp}}&AppId={{appid}}&Sign={{sign}}&Sid=123456789abcdef \
-X POST \
-H 'content-type: application/json' \
-d'
{
  "Name":"test02",
  "Type":1,
  "CallbackUrl":""
}
'
  1. There is an issue with the request parameters below.
  2. An application is a tenant in the call center platform. Request Parameters
Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
NameYstringApplication name
TypeYintegerApplication type, Call Center Platform: 1, Telemarketing Platform: 0
CallbackUrlYstring (url)Server callback URL
IsHideUserNumNbooleanHide user number on agent extension, default: False
MemoNstringDescription
Notes
  1. When calling the interface to create an application, the request parameter does not require AppId, as the application has not been created yet and there is no AppId. This is the only API interface that does not require AppId as a request parameter. Return Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectAs follows
Result
Parameter NameType (Format)Description
AppIdstring (uuid)Unique application ID
ExtensionPrefixstringAgent extension prefix
NamestringApplication name
MemostringApplication description
TypestringApplication type
CallbackUrlstringCallback URL
IsHideUserNumstringHide user number on agent extension
SecretstringApplication secret
WrapUpTimestringWrap-up time

Update Application

URL: apps METHOD: PUT Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
NameNstringApplication name
TypeNstring (enum)Application type, values: default or external, default: default
CallbackUrlNstring (url)Server callback URL
IsHideUserNumNbooleanHide user number on agent extension
MemoNstringDescription

Return Results

Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description

Get Application Details

URL: apps METHOD: GET Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID

Return Results

Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectAs follows

Result

Parameter NameType (Format)Description
AppIdstring (uuid)Application ID
NamestringApplication name
Typestring (enum)Application type, default or external
CallbackUrlstring (url)Server callback URL
IsHideUserNumbooleanHide user number on agent extension
SecretstringApplication secret
MemostringApplication description (optional)

Relay Number Management

Selection strategy for relay numbers during outbound calls:

  1. Prioritize specified relay numbers for outbound calls.
  2. Secondly, the default relay number for the agent.
  3. Then, the company's default relay number.
  4. Finally, the system randomly selects a number.

Get Relay Number List

URL: spnumbers METHOD: GET Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
Return Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectAs follows
Result
Parameter NameType (Format)Description
SpNumbers[string (uuid)]Relay number list
DefSpNumberstring (digits)Currently configured default relay number

Update Default Relay Number

URL: spnumbers/default METHOD: PUT Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
DefSpNumberNstringDefault relay number, can be any number in the relay number list
Note: For POST and PUT methods, other parameters (e.g., DefSpNumber in the Update Default Relay Number interface) in addition to url parameters and authentication parameters should be passed through the request body.
Return Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl 'http://ip:port/ccapi/v2/spnumbers/default/7763?Timestamp=1566540424&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sid=123456789abcdef&Sign=de3fec40c8671bcbab00b12e5254e378a53f646a' \
-X PUT \
-d '{"DefSpNumber" : "057126200670"}'

Delete Default Relay Number

URL: spnumbers/default METHOD: DELETE Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
Return Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl 'http://ip:port/ccapi/v2/spnumbers/default/7763?Timestamp=1566540424&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sid=123456789abcdef&Sign=de3fec40c8671bcbab00b12e5254e378a53f646a' -X DELETE

Modify Agent's Default Relay Number

URL: /spnumbers/agent/default/:agentId METHOD: PUT Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
DefSpNumberNstringDefault relay number, can be any number in the relay number list
Return Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description

Delete Agent's Default Relay Number

URL: /spnumbers/agent/default/:agentId METHOD: DELETE Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
Return Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description

Seat Management

Create Seat

URL: agents METHOD: POST Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYstringTimestamp
AppIdYstring (UUID)Application ID
AgentsYarray (Seat Object)List of seats
Seat Object
Parameter NameRequiredType (Format)Description
AgentIdYstring (digits)Seat ID
WorkIdYstring (digits)Seat job number
NameNstringSeat name
MobileNstring (phone)Seat mobile number
EmailNstring (Email)Seat Email
RoleNstring (enum)Can be agent, leader, default is agent
EnableNbooleantrue: enable, default is enabled
IsCreateExtensionNbooleanCreate and bind seat extension
Response Result
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectIf binding extension at the same time, as follows
Result
Parameter NameType (Format)Description
Extensions[Extension]List of extension numbers, as follows
Extensions
Parameter NameType (Format)Description
Extensionstring (digits)Extension number
PasswordstringExtension password
Request Example
curl -X POST 'http://ip:port/ccapi/v2/agents?Timestamp=1566446286&AppId=802411d4-2fb5-46ae-422f-d33de0059c47&Sign=891462f08d113b0b1285e985ff7a7c56ba42a18f&Sid=123456789abcdef' -d '{\"Agents\":[{\"AgentId\":\"199\",\"WorkId\":\"199\",\"Name\":\"Li\",
\"Mobile\":\"18512520714\",\"Email\":\"123@qq.com\",\"Role\":\"agent\",\"Extension\":\"2457\",\"WrapUpTime\":0},{\"AgentId\":\"200\",\"WorkId\":\"200\",\"Name\":\"Qian\",\"Mobile\":\"18512520714\",\"Email\":\"456@qq.com\",\"Role\":\"agent\",\"Extension\":\"2458\",\"WrapUpTime\":1}]}'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": null
}

Update Seat

URL: agents/{AgentId} METHOD: PUT Note: "{AgentId}" represents the URL parameter. Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYstringTimestamp
AppIdYstring (UUID)Application ID
AgentIdYstring (digits)Seat ID
WorkIdYstring (digits)Seat job number
NameNstringSeat name
MobileNstring (phone)Seat mobile number
EmailNstring (Email)Seat Email
RoleNstring (enum)Can be agent, leader, default is agent
EnableNbooleantrue: enable, false: disable, default: true
Response Result
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl 'http://ip:port/ccapi/v2/agents/7763?Timestamp=1566540424&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sid=123456789abcdef&Sign=de3fec40c8671bcbab00b12e5254e378a53f646a' \
-X PUT \
-d '{
	"AgentId": "10030",
	"WorkId": "22024",
	"Name": "test 5",
	"Mobile": "17777773333",
	"Email": "5544@qq.com",
	"Role": "agent"
}
'

Note: AgentId must be passed in both the URL and the request body. Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": null
}

Seat Login

URL: agent/login METHOD: POST Note: The seat must be bound to an extension before logging in. Request Parameters

Parameter NameType (Format)RequiredDescription
agent_Idstring (digits)YSeat ID
WorkerIDstring (digits)NSeat job number
QueueIDs[string (digits)]NArray of queue identifiers
Numberstring (digits)NSeat contact information, PSTN number or VOIP account
Statestring (digits)N
MsgIdstringNTimestamp
Response Result
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
msg_idstringThe MsgId sent during login
resultstringNonsensical
datanilNonsensical
Request Example
curl -X POST 'http://ip:port/ccapi/v2/agent/login?Timestamp=1566554019&AppId=d30fe35c-995d-4921-55b8-ad21b476bbb8&Sign=597ba974a48f49ca8ae95eee2d725a5bf6211520&Sid=123456789abcdef&MsgId=123456789' -d ' { "agent_Id": "10032" }'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "msg_id": "123456789",
    "results": "",
    "data": null
}

Seat Logout

URL: agent/logout METHOD: POST Request Parameters

Parameter NameType (Format)RequiredDescription
agent_Idstring (digits)YSeat ID
Note: In the request URL, the application ID is "app_id", which is different from the previous "AppId".
Response Result
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl -X POST 'http://ip:port/ccapi/v2/agent/logout?Timestamp=1566554019&app_id=d30fe35c-995d-4921-55b8-ad21b476bbb8&Sign=597ba974a48f49ca8ae95eee2d725a5bf6211520&Sid=123456789abcdef&MsgId=123456789' -d '{"agent_Id":"10032"}'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "msg_id": "123456789",
    "results": "",
    "data": null
}

Delete Seat

URL: agents/{AgentId} METHOD: DELETE Request Parameters

Parameter NameType (Format)RequiredDescription
Timestampnumber (Timestamp)YTimestamp
AppIdstring (UUID)YApplication ID
AgentIdstring (digits)YSeat ID, numeric
IsDelExtensionsbooleanNWhether to delete the bound extensions at the same time, "true" - delete all extensions bound to the seat; "false" (default) - do not delete extensions bound to the seat
Response Result
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl -X DELETE 'http://ip:port/ccapi/v2/agents/7777?Timestamp=1566446286&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=891462f08d113b0b1285e985ff7a7c56ba42a18f&Sid=123456789abcdef' -d '{"AgentId":"7777"}'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": null
}

Get Seat Details

URL: agents/{AgentId} METHOD: GET Note: AgentId is a URL parameter. Request Parameters

Parameter NameType (Format)RequiredDescription
Timestampnumber (Timestamp)YTimestamp
AppIdstring (UUID)YApplication ID
AgentIdstring (digits)YSeat ID, numeric
Note: AgentId must be passed in both the URL and the request body.
Response Result
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectAs follows
Result
Parameter NameType (Format)Description
AppIdstringApplication ID
AgentIdstring (digits)Seat ID
WorkIdstring (digits)Seat job number
NamestringSeat name
Mobilestring (phone)Seat mobile number
Emailstring (Email)Seat Email
Rolestring (enum)Can be agent, leader, default is agent
Queues[string (digits)]List of queues bound to the seat (array)
QueuesNamesstringNames of queues bound to the seat
Extensions[Extension]List of extensions bound to the seat (array)
DefSpNumber[string (digits)]Default trunk number for the seat
StateenumSeat state (refer to the State enum values below)
ExtStateenumExtension state (refer to the ExtState enum values below)
WrapUpTimeIntegerWrap-up time, in seconds
Enablebooleantrue: enabled, false: disabled, default: true
ExtenInfosstringExtension information
State Enum Values
ValueMeaning
0Ready
1Ready for work
2Locked
3In call
4Not available
ExtState Enum Values
ValueMeaning
0Extension Idle
1Extension Busy
2Extension Online
3Extension Offline
4Extension Invalid
Request Example
curl 'http://ip:port/ccapi/v2/agents/7765?Timestamp=1566446286&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=891462f08d113b0b1285e985ff7a7c56ba42a18f&Sid=123456789abcdef' -d '{"AgentId":"7765"}'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": {
        "AppId": "a54a8b77-f12d-4ac9-742d-5b2bef5c4d11",
        "AgentId": "7765@a54a8b77-f12d-4ac9-742d-5b2bef5c4d11",
        "WorkId": "7765",
        "Name": "",
        "Mobile": "",
        "Email": "",
        "Role": "agent",
        "Queues": null,
        "Extensions": null,
        "DefSpNumber": "",
        "State": 4,
        "ExtState": 3,
        "WrapUpTime": 0,
        "Enable": true
    }
}

Get Seat List

URL: agents METHOD: GET Request Parameters

Parameter NameRequiredDescription
TimestampYTimestamp
AppIdYApplication ID
Response Result
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectAs follows
Result
Parameter NameType (Format)Description
CurrPageIntegerCurrent page number
PageSizeIntegerNumber of records per page
TotalIntegerTotal number of records
TotalPageIntegerTotal number of pages
AgentListobjectSeat list, as follows
AgentList
Parameter NameType (Format)Description
AppIdstringApplication ID
AgentIdstring (digits)Seat ID
WorkIdstring (digits)Seat job number
NamestringSeat name
Mobilestring (phone)Seat mobile number
Emailstring (Email)Seat Email
Rolestring (enum)Can be agent, leader, default is agent
Queues[string (digits)]List of queues bound to the seat (array)
QueuesNamesstringNames of queues bound to the seat
Extensions[Extension]List of extensions bound to the seat (array)
DefSpNumber[string (digits)]Default trunk number for the seat
StateenumSeat state (refer to the State enum values below)
ExtStateenumExtension state (refer to the ExtState enum values below)
WrapUpTimeIntegerWrap-up time, in seconds
Enablebooleantrue: enabled, false: disabled, default: true
ExtenInfosstringExtension information
State Enum Values
ValueMeaning
0Ready
1Ready for work
2Locked
3In call
4Not available
ExtState Enum Values
ValueMeaning
0Extension Idle
1Extension Busy
2Extension Online
3Extension Offline
4Extension Invalid
Request Example
curl 'http://ip:port/ccapi/v2/agents?Timestamp=1566536708&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=2a371cf8c49560671c02116ae54ac1f9ef1e59f3&Sid=123456789abcdef'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "",
    "Result": {
        "CurrPage": 1,
        "PageSize": 439,
        "Total": 439,
        "TotalPage": 1,
        "AgentList": [
            {
                "AppId": "a54a8b77-f12d-4ac9-742d-5b2bef5c4d11",
                "AgentId": "62",
                "WorkId": "565",
                "Name": "crmtest 2",
                "Mobile": "13716429603",
                "Email": "crmdianxiao2@test.cn",
                "Role": "agent",
                "Queues": null,
                "QueuesNames": null,
                "Extensions": null,
                "DefSpNumber": "",
                "State": 1,
                "ExtState": 0,
                "WrapUpTime": 0,
                "Enable": true,
                "ExtenInfos": null
            },
            {
                "AppId": "a54a8b77-f12d-4ac9-742d-5b2bef5c4d11",
                "AgentId": "78",
                "WorkId": "",
                "Name": "diandiantest",
                "Mobile": "13935107603",
                "Email": "diandian@test.cn",
                "Role": "agent",
                "Queues": null,
                "QueuesNames": null,
                "Extensions": null,
                "DefSpNumber": "057126200670",
                "State": 1,
                "ExtState": 0,
                "WrapUpTime": 0,
                "Enable": false,
                "ExtenInfos": null
            }
        ]
    }
}

Seat Extension Binding

URL: agents/extensions METHOD: POST Note: A seat can be bound to a maximum of two extension numbers, but only one extension can be used at a time Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
AgentIdYstring (digits)Seat ID
ExtensionsY[string (digits)]List of extension numbers (array)
Note: When passing Extensions, pay attention to the "[]" (brackets)
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl -X POST 'http://ip:port/ccapi/v2/agents/extensions?Timestamp=1566446286&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=891462f08d113b0b1285e985ff7a7c56ba42a18f&Sid=123456789abcdef' -d '
{
	"AgentId" : "10031",
	"Extensions" : ["2345","9527"]
}
'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": null
}

Seat Extension Unbinding

URL: agents/extensions METHOD: DELETE Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
AgentIdYstring (digits)Seat ID
ExtensionsY[string (digits)]List of extension numbers
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl -X DELETE 'http://ip:port/ccapi/v2/agents/extensions?Timestamp=1566523582&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=f5f8dd0003c1ef1f2bc820a37c0af0dce18ee0fe&Sid=123456789abcdef' -d '
{
  "AgentId":"6655",
  "Extensions":["2345"]
}
'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": null
}

Seat Queue Binding

URL: agents/queues METHOD: POST Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
AgentIdYstring (digits)Seat ID
QueuesY[string (digits)]List of Queue IDs
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl -X POST 'http://ip:port/ccapi/v2/agents/queues?Timestamp=1566523582&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=f5f8dd0003c1ef1f2bc820a37c0af0dce18ee0fe&Sid=123456789abcdef' -d '
{
	"AgentId" : "10031",
	"Queues" : ["9008"]
}
'

Seat Queue Unbinding

URL: agents/queues METHOD: DELETE Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
AgentIdYstring (digits)Seat ID
QueuesY[string (digits)]Queue IDs
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl -X DELETE 'http://ip:port/ccapi/v2/agents/queues?Timestamp=1566523582&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=f5f8dd0003c1ef1f2bc820a37c0af0dce18ee0fe&Sid=123456789abcdef' -d '
{
	"AgentId" : "10031",
	"Queues" : ["9008"]
}
'

Queue Management

Create Queue

URL: queues METHOD: POST

NOTE: A maximum of 100 queues can be created per AppId. Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
QueueIdYstring (digits)Queue ID
QueueNameYstringQueue name
StrategyNstring (enum)Queuing strategy, defaults to longest_idle
TimeoutNnumberQueuing timeout in seconds, defaults to 60
MaxLengthNnumberMaximum queue length, defaults to 128, maximum value is 512
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl -X POST 'http://ip:port/ccapi/v2/queues?Timestamp=1566523582&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=f5f8dd0003c1ef1f2bc820a37c0af0dce18ee0fe&Sid=123456789abcdef' -d '
{
	"QueueId":"9009",
	"QueueName":"Test Create Queue 007"
}
'

Modify Queue

URL: queues METHOD: PUT Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
QueueIdYstring (digits)Queue ID
QueueNameYstringQueue name
StrategyNstring (enum)Queuing strategy, defaults to longest_idle
TimeoutNnumberQueuing timeout in seconds, defaults to 0
MaxLengthNnumberMaximum queue length, defaults to 128, maximum value is 512
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl -X PUT 'http://ip:port/ccapi/v2/queues?Timestamp=1566523582&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=f5f8dd0003c1ef1f2bc820a37c0af0dce18ee0fe&Sid=123456789abcdef' -d '
{
	"QueueId":"9009",
	"QueueName":"Test Create Queue 89757",
	"Timeout": 120
}
'

Delete Queue

URL: queues METHOD: DELETE

NOTE: Queues with bound seats cannot be deleted Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
QueueIdYstring (digits)Queue ID
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl -X DELETE 'http://ip:port/ccapi/v2/queues?Timestamp=1566523582&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=f5f8dd0003c1ef1f2bc820a37c0af0dce18ee0fe&Sid=123456789abcdef' -d '{ "QueueId":"9009" }'

Get All Queue Information

URL: queues METHOD: GET Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectAs follows
Result
Parameter NameType (Format)Description
IDIntegerID
CreatedAtdateQueue creation time
UpdatedAtdateQueue update time
AppIDstringApplication ID
QueueIDstring (digits)Queue ID
TimeoutnumberQueuing timeout in seconds
Strategystring (enum)Queuing strategy
AgentIDIntegerSeat ID
NamestringQueue name
MaxLengthnumberMaximum queue length
WaitMusicstringMusic to play while queuing

Get Queue Information (This interface has issues, temporarily ignored)

URL: queues/{QueueId} METHOD: GET Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectAs follows
Result
Parameter NameType (Format)Description
QueueIdstring (digits)Queue ID
QueueNamestringQueue name
Strategystring (enum)Queuing strategy
TimeoutnumberQueuing timeout in seconds
MaxLengthnumberMaximum queue length
Agents[AgentId]List of seat IDs bound to this queue

Batch Bind Seats to Queue

URL: queues/agents METHOD: POST, PUT Note: Batch binding seats to a queue only creates new records without deleting previous ones. Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
QueueIdYstring (digits)Queue ID
AgentIdsY[string (digits)]List of bound seat IDs (array)
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl -X POST 'http://ip:port/ccapi/v2/queues/agents?Timestamp=1566523582&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=f5f8dd0003c1ef1f2bc820a37c0af0dce18ee0fe&Sid=123456789abcdef' -d '
{
	"QueueId":"9008",
	"AgentIds":["10031", "10032"]
}
'

Extension Management

Create Extension

URL: extensions METHOD: POST Note: The extension password is generated by the system and cannot be set at the time of creation. Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
ExtensionYstring (digits)Extension number
Note: The extension number starts with a non-zero digit followed by three digits.
Response
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectAs follows
Result
Parameter NameType (Format)Description
Extensionstring (digits)Extension number
PasswordstringExtension password
NumberstringUncertain of its meaning, requires development assistance
Request Example
$ curl -X POST 'http://ip:port/ccapi/v2/extensions?Timestamp=1566446286&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=891462f08d113b0b1285e985ff7a7c56ba42a18f&Sid=123456789abcdef' -d '{"Extension":"4567"}'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": {
        "Extension": "4567",
        "Password": "5ca7561e1748f1b7",
        "Number": "90310468564567"
    }
}

Delete Extension

URL: extensions METHOD: DELETE Note: Extensions that are already bound to an agent cannot be deleted. Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
ExtensionYstring (digits)Extension number
Response
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
$ curl -X DELETE 'http://ip:port/ccapi/v2/extensions?Timestamp=1566538172&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=5d97fdd3e55f26a0aea37ca3d03819bf28093038&Sid=123456789abcdef' -d '{"Extension":"4567"}'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": null
}

Switch Phone/Mobile Mode

URL: agent/set_call_mode METHOD: POST Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
AgentIdYstringAgent ID
ContactYstringMode, see the Mode List below
NumberNstringNumber
MsgIdNstringUnique ID used to identify local calls
Mode List
ModeDescription
voipIP Phone
cellphoneMobile Phone
Response
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
msg_idstringMsgId sent during sign-in
resultstringNo significance
datanilNo significance
Request Example
curl -X POST 'http://ip:port/ccapi/v2/agent/set_call_mode?Timestamp=156655401&AppId=d30fe35c-995d-4921-55b8-ad21b476bbb8&Sign=597ba974a48f49ca8ae95eee2d725a5bf6211520&Sid=123456789abcdef&MsgId=123456789' -d '
{
	"AgentId": "10031",
	"Contact": "cellphone"
}
'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "msg_id": "123456789",
    "results": "",
    "data": null
}

IVR Configuration Management

Upload IVR Voice File

URL: ivrs/vfiles METHOD: POST Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
FileNameYstringFilename, must be unique
FileTypeNstringFile type, only wav is supported
FileDescNstringFile description
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description

Delete IVR Voice File

URL: ivrs/vfiles METHOD: DELETE Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
FileNameYstringFilename, must be unique
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description

Get IVR Voice File List

URL: ivrs/vfiles METHOD: GET Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectAs follows
Result
Parameter NameType (Format)Description
IvrVFiles[object]Voice file list, as follows
IvrVFiles
Parameter NameType (Format)Description
FileNamestringFilename
FileTypestringFile type
FileDescstringFile description

Set IVR Default Voices

URL: ivrs/defvoices METHOD: POST, PUT

NOTE: If IVR voices are not configured, the system uses the default configuration. Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
DefVoicesY[object]IVR prompt voices, as follows
DefVoices
Parameter NameRequiredType (Format)Description
WelcomeNobject (voice) or "default"Greeting message
ClosingTimeNobject (voice) or "default"Closing time prompt
NoAnswerNobject (voice) or "default"No answer/reject voice
VoiceMailNobject (voice) or "default"Voicemail
WaitingNobject (voice) or "default"Waiting voice
ConsultNobject (voice) or "default"Consultation voice
HoldNobject (voice) or "default"Hold voice
QueueTimeoutNobject (voice) or "default"Queue timeout voice
EvaluateNobject (voice) or "default"Satisfaction survey voice
Voice
Parameter NameRequiredType (Format)Description
TypeYstringType: tts, wav
ContentYstringContent: If Type is tts, the content is tts text; if Type is wav, the content is the filename
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description

Get IVR Default Voices

URL: ivrs/defvoices METHOD: GET Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectAs follows
Result
Parameter NameType (Format)Description
Voices[Voice]IVR prompt voices, refer to “Set IVR Voice Configuration”

Update Fast Router Configuration

URL: ivrs/fastrouters METHOD: POST, PUT Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
FastRouterY[object]Fast router configuration table, as follows
FastRouter
Parameter NameRequiredType (Format)Description
DtmfYstring (digit)Key, 0~9
DescYstringQueue description
QueueIdYstring (digits)Queue ID
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description

Get Fast Router Configuration

URL: ivrs/fastrouters METHOD: GET Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
FastRouter[object]Fast router configuration table, as follows
FastRouter
Parameter NameType (Format)Description
Dtmfstring (digit)Key, 0~9
DescstringQueue description
QueueIdstring (digits)Queue ID

Creating an Outbound Call

URL: originatev2 METHOD: POST Note: Some preparation is required to use this interface:

  1. Have an agent and switch to IP phone mode (mobile mode is also possible, but here we will use IP phone for illustration)
  2. Have an extension (an example is provided below)
{
  "Extension": "8975",
  "Password": "d0942c4e07c038f8",
  "Number": "90310468568975"
}
  1. Bind the agent to the extension
  2. Ensure the agent is in a signed-in state
  3. Download a softphone, Linphone (a PC software)
  • Open the software
  • Create a new linphone account
  • Use a linphone account
  • Username: Number
  • SIP domain: 47.94.221.132:5474
  • Transport: UDP
  • Click "USE"
  1. In the request body, fill in the relay number (the relay number bound to the agent under the tenant)
  • For example, if the relay number is 057126200670, the request body will be:
{
  "caller": "057126000000",
  "called": "17600000000",
  "called_display": "057126000000",
  "agent_id": "10032"
}
  1. Send the request Request Parameters
Parameter NameRequiredType (Format)Description
TimestampYnumber(timestamp)Timestamp
AppIdYstring(uuid)Application ID
callerYstringCaller number
calledYstringCalled number
called_displayYstringDisplayed number
agent_idYstringAgent ID
user_dataNarray(associated data object)Associated data
Associated Data Object
FieldRequiredType (Format)Description
evtYstringEvent type
dataYstringCustom data type
Response
Parameter NameType (Format)Description
ErrCodestring(digits)Response code
ErrDescstringResponse description
resultsstringCall CallID
Request Example
$ curl 'http://47.94.221.132:8043/ccapi/v2/originatev2?Timestamp=1566446286&AppId=d30fe35c-995d-4921-55b8-ad21b476bbb8&Sign=891462f08d113b0b1285e985ff7a7c56ba42a18f&Sid=123456789abcdef' -d '{\"caller\": \"057128091649\", \"called\": \"15652692674\",\"called_display\":\"057128091649\",\"agent_id\": \"91\", \"user_data\":[{\"evt\": \"user_answer\", \"data\":\"1111111\"}, {\"evt\": \"agent_answer\",\"data\": \"22222\"}]}'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "msg_id": "",
    "results": "97688e57-7a36-40f7-694a-393d4d1a10d3",
    "data": null
}

Outbound Call Control

Hold

URL: /ccapi/v2/agent/hold METHOD: POST Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
SidYstringAccount
SignYstringSignature
call_idYstringCall ID
agent_idYstring (digits)Agent ID
on_succYstringFill with any non-empty string
on_failedYstringFill with any non-empty string
Response Results
Parameter NameType (Format)Description
codestring (digits)Response Code
messagestringResponse Description
Request Example
curl -X POST 'http://ip:port/ccapi/v2/agent/hold?Timestamp=1585213823&Sign=zxccvb903ef48ef16225e436bb4a3b134567bb6&Sid=100100100100' -d '
{
  "call_id":"1a8462d7-00fc-4cc2-4567-038ced6ba580",
  "agent_id":"111",
  "on_succ":"demo",
  "on_failed":"demo"
}'

Response Example

{
  "code": "000000",
  "message": "OK",
  "results": ""
}

Resume

URL: /ccapi/v2/agent/hold METHOD: DELETE Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
SidYstringAccount
SignYstringSignature
call_idYstringCall ID
agent_idYstring (digits)Agent ID
on_succYstringFill with any non-empty string
on_failedYstringFill with any non-empty string
Response Results
Parameter NameType (Format)Description
codestring (digits)Response Code
messagestringResponse Description
Request Example
curl -X DELETE 'http://ip:port/ccapi/v2/agent/hold?Timestamp=1585214251&Sign=qweasd1bfbac11a829123e63b45fb21b3510abd2&Sid=100100100100' -d '
{
	"call_id":"123qwe-00fc-4cc2-a346-038ced6ba580",
	"agent_id":"111",
    "on_succ":"demo",
    "on_failed":"demo"
}'

Response Example

{
  "code": "000000",
  "message": "OK",
  "results": ""
}

Transfer

URL: /ccapi/v2/transfer/agent METHOD: POST Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
SidYstringAccount
SignYstringSignature
call_idYstringCall ID
agent_idYstring (digits)Agent ID
agent_typeYstringThis parameter must be "anonymous"
agent_phoneYstringTransfer phone number
on_succYstringFill with any non-empty string
on_failedYstringFill with any non-empty string
on_record_overYstringFill with any non-empty string
on_transferee_hangupYstringFill with any non-empty string
Response Results
Parameter NameType (Format)Description
codestring (digits)Response Code
messagestringResponse Description
Request Example
curl -X POST 'http://ip:port/ccapi/v2/transfer/agent?Timestamp=1585214251&Sign=ea4a2b1bfbac11a8299b1bfbac11a829912e63b45fb21b1230abd2&Sid=100100100100' -d '
{
  "call_id":"asdfg272-0afb-4136-81bc-328bbcc606c5",
  "agent_id":"111",
  "agent_type":"anonymous",
  "agent_phone":"10010001000",
  "on_succ":"demo",
  "on_failed":"demo",
  "on_record_over":"demo",
  "on_transferee_hangup":"demo"
}'

Response Example

{
  "code": "000000",
  "message": "OK",
  "results": ""
}

Auto Dialing Task Management

Start Auto Dialing Task

URL: ads/task/start METHOD: POST Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (timestamp)Timestamp
AppIdYstring (uuid)Application ID
AdTaskIdYstringTask ID
AdTaskTypeYstring1 - Precision; 2 - Ratio; 3 - Prediction; 4 - Voice Broadcast; 5 - Robot
AdTaskRatioYnumber1.0~5.0, Call ratio for ratio dialing, call intensity for prediction dialing
AdQueueIdNstringQueue ID corresponding to the task
AdIvrIdNstringIVR ID corresponding to the task
AdRobotTokenNstringRobot token corresponding to the task
AdCallerNumYstringCaller number used by the dialing task
AdDispNumYstringDisplay number used by the dialing task
AdConCallLimitYnumberMaximum concurrent calls, maximum value 100
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response Code
ErrDescstringResponse Description
ResultobjectAs follows
Result
None

Update Auto Dialing Task Ratio/Intensity

URL: ads/task/update_ratio METHOD: POST Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (timestamp)Timestamp
AppIdYstring (uuid)Application ID
AdTaskIdYstringTask ID
AdTaskRatioYnumber1.0~5.0, Call ratio for ratio dialing, call intensity for prediction dialing
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response Code
ErrDescstringResponse Description
ResultobjectAs follows
Result
None

Stop Auto Dialing Task

URL: ads/task/stop METHOD: POST Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (timestamp)Timestamp
AppIdYstring (uuid)Application ID
AdTaskIdYstringTask ID
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response Code
ErrDescstringResponse Description
ResultobjectAs follows
Result
None

Force Stop Auto Dialing Task

URL: ads/task/force_stop METHOD: POST Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (timestamp)Timestamp
AppIdYstring (uuid)Application ID
AdTaskIdYstringTask ID
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response Code
ErrDescstringResponse Description
ResultobjectAs follows
Result
None

Get Auto Dialing Task Numbers

URL: cc_ad_task/numbers METHOD: POST Request Parameters

Parameter NameRequiredType (Format)Description
app_idYstring (uuid)Application ID
ad_task_idYstringTask ID
countYnumberNumber of numbers
Return Results
Parameter NameType (Format)Description
codestring (digits)Response code
messagestringResponse description
exhaustedbooleantrue/false, whether the numbers have been exhausted
results[AdNumber]List of numbers, as follows
AdNumber
Parameter NameType (Format)Description
idstringNumber ID
numberstringNumber

Automatic Dialing Task Stop Notification

URL: cc_ad_task/stop METHOD: POST Request Parameters

Parameter NameRequiredType (Format)Description
app_idYstring (uuid)Application ID
ad_task_idYstringTask ID
Return Results
Parameter NameType (Format)Description
codestring (digits)Response code
messagestringResponse description

Event Subscription

NOTE:

  • Event subscription uses the POST method
  • The same authentication method as the interface is used

Subscribe to Events

URL: /ccapi/v2/webhooks/events METHOD: POST to append subscription events, PUT to replace all events with the ones in the body, DELETE to remove all events NOTE: The application layer sends a request to CTI CLOUD to subscribe to events Pass AppId, Timestamp, sid, and sign in the URL for verification Request Parameters in the Body JSON format parameters

Parameter NameRequiredType (Format)Description
EventsY[ ]subinfoList of event names, as follows
subinfo:
Parameter NameRequiredType (Format)Description
categoryYstringEvent name, as follows: "agent_state, ext_state, agent_call_mode, call"
all_typeY[ ]stringList of event names, as follows
events
  1. agent_call_mode "agent_call_mode_change"
  2. agent_state "acd_agent_state"
  3. ext_state "ext_state"
  4. call "agent_breakout", "agent_interrupt", "asr_gather_fail", "asr_gather_succ", "begin", "call_notes", "consult_fail", "consult_succ", "dtmf_gather_fail", "dtmf_gather_succ", "eavesdrop_fail", "eavesdrop_succ", "end", "end_consult_fail", "end_consult_succ", "enqueue_succ", "extern_succ", "general_hangup", "hangup_cause", "hold_call", "play_fail", "play_succ", "record_stop", "start_dialout", "start_ivr", "substitute_fail", "substitute_succ", "three_way_fail", "three_way_succ", "transfer_agent_fail", "transfer_agent_succ", "user_answer", "user_hangup", "user_ringing", "voice_mail_fail", "voice_mail_succ"

Call Process Events

Agent Status Change Events

Queue Status Change Events

Recording Events

Return Results

Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description

Message

Message Subscription

URL: subscriptions METHOD: POST Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
subscriptionsYarray (subscription)List of subscription objects
subscription Message Subscription Object
Parameter NameRequiredType (Format)Description
callbackYstring (url)Callback URL
nameYstringName of the subscription
eventsY[string]List of subscribed events
Response Result
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Resultobject (sub_result)Mapping between name and subid
sub_result
Parameter NameType (Format)Description
sub_succarray (sub_succ)Successful subscription IDs and names
sub_failarray (string)Names of failed subscriptions
sub_succ
Parameter NameType (Format)Description
idunitSubscription ID
namestringSubscription name
Request Example
curl -X POST 'http://123.56.218.144:8043/ccapi/v2/subscriptions?Timestamp=1566446286&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=891462f08d113b0b1285e985ff7a7c56ba42a18f&Sid=123456789abcdef' -d '{\"subscriptions\": [{\"callback\": \"http://59.110.105.200:12345\",\"name\": \"sub1\",\"events\": [\"agent_ringing\", \"agent_answer\",\"start_dialout\", \"user_ringing\", \"user_answer\", \"agent_hangup\", \"user_hangup\"]},
{\"callback\": \"http://59.110.105.200:12345\",\"name\": \"sub2\",\"events\": [\"agent_ringing\", \"agent_answer\",\"start_dialout\", \"user_ringing\", \"user_answer\", \"agent_hangup\", \"user_hangup\"]},
{\"callback\": \"http://59.110.105.200:12345\",\"name\": \"sub3\",\"events\": [\"agent_ringing\", \"agent_answer\",\"start_dialout\", \"user_ringing\", \"user_answer\", \"agent_hangup\", \"user_hangup\"]},
{\"callback\": \"http://59.110.105.200:12345\",\"name\": \"sub4\",\"events\": [\"agent_ringing\", \"agent_answer\",\"start_dialout\", \"user_ringing\", \"user_answer\", \"agent_hangup\", \"user_hangup\"]}
]}'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": {
        "sub_succ":[{"id":1,"name":"sub1"},{"id":2,"name":"sub2"}],
        "sub_fail":["sub3","sub4"]
    }
}

Batch Query for Message Subscriptions

URL: subscriptions METHOD: GET Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
Response Result
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Resultarray (subscription)List of subscription events
subscription
Parameter NameRequiredType (Format)Description
callbackYstring (url)Callback URL
nameYstringName of the subscription
eventsY[string]List of subscribed events
enableYboolSubscription status: true - enabled, false - disabled
Request Example
curl -X GET 'http://123.56.218.144:8043/ccapi/v2/subscriptions?Timestamp=1566446286&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=891462f08d113b0b1285e985ff7a7c56ba42a18f&Sid=123456789abcdef'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": [
        {
            "callback": "http://59.110.105.200:12345",
            "name": "sub1",
            "events": [
                "agent_ringing",
                "agent_answer",
                "start_dialout"
            ],
            "enable": false
        },
        {
            "callback": "http://59.110.105.200:12345",
            "name": "sub1",
            "events": [
                "agent_ringing",
                "agent_answer",
                "start_dialout"
            ],
            "enable": false
        }
    ]
}

Single Query for Message Subscription

URL: subscriptions/{id} METHOD: GET Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
Response Result
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultsubscriptionSubscription object
subscription
Parameter NameRequiredType (Format)Description
callbackYstring (url)Callback URL
nameYstringName of the subscription
eventsY[string]List of subscribed events
enableYboolSubscription status: true - enabled, false - disabled
Request Example
curl -X GET 'http://123.56.218.144:8043/ccapi/v2/subscriptions/8?Timestamp=1566446286&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=891462f08d113b0b1285e985ff7a7c56ba42a18f&Sid=123456789abcdef'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": {
        "callback": "http://59.110.105.200:12345",
        "name": "sub1",
        "events": [
            "agent_ringing",
            "agent_answer",
            "start_dialout"
        ],
        "enable": false
    }
}

Update Message Subscription

URL: subscriptions/{id} METHOD: PUT Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
subscriptionYobject (subscription)Subscription object
subscription
Parameter NameType (Format)Description
callbackYstring (url)
nameYstring
eventsYarray (string)
enableYbool
Response Result
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Result[object]Mapping between name and subscription ID
object
Parameter NameType (Format)Description
SubIdnumberUnique subscription ID
namestringName of the subscription
Request Example
curl -X PUT 'http://123.56.218.144:8043/ccapi/v2/subscriptions/7?Timestamp=1566446286&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=891462f08d113b0b1285e985ff7a7c56ba42a18f&Sid=123456789abcdef' -d '{\"callback\": \"http://59.110.105.911:12345\",\"name\": \"sub1\",
\"events\": [\"user_ringing\", \"user_answer\", \"agent_hangup\", \"user_hangup\"],\"state\":0}'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": {
        "sub1": 7
    }
}

Delete Message Subscription

URL: subscriptions/{id} METHOD: DELETE Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
Response Result
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
Request Example
curl -X DELETE 'http://123.56.218.144:8043/ccapi/v2/subscriptions/8?Timestamp=1566446286&AppId=a54a8b77-f12d-4ac9-742d-5b2bef5c4d11&Sign=891462f08d113b0b1285e985ff7a7c56ba42a18f&Sid=123456789abcdef'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": ""
}

Callback Authentication The authentication method for the callback URL is as follows: callback Request Parameters

Parameter NameRequiredType (Format)Description
TimestampYstringTimestamp, the number of seconds since the current time from UTC time, 1970-01-01 00:00:00
AppIdYstring (uuid)Application ID
SignYstringSignature
callback Signature Calculation Method
Secret is the encryption field returned when creating the application and needs to be saved by the user.
Sign: SHA1(AppId + Secret + Timestamp)

Client Interface Description

Agent Client Interface

NOTE: The client uses WebSockets, and all requests are asynchronous.

*Check-In

{
    // #include <standard_header>
    "Method": "login",
    "AppId": "xxxxxxxxxxxxxxxx",
    "AgentId": "xxxxxxxxxxxxxxxx",
    "Token": "xxxxxxxxxxxxxxxx",
    "State": "idle",   // Initial state of the Agent, optional, defaults to idle
}

*Check-Out (Go Offline)

{
  // #include <standard_header>
  "Method": "logout",
}

*Set Busy

{
  // #include <standard_header>
  "Method": "setState",
  "State": "busy",
}

*Set Idle

{
  // #include <standard_header>
  "Method": "setState",
  "State": "idle",
}

*Away (Short Break)

{
  // #include <standard_header>
  "Method": "setState",
  "State": "onBreak",
  "SubState": 0, // SubState defaults to 0, can be an integer >= 0
}

*Hang Up

{
  // #include <standard_header>
  "Method": "hangup",
}

*Set Call Mode [WebRTC]

{
  // #include <standard_header>
  "Method": "setCallMode",
  "Contact": "xxxx", // cellphone/voip
  "UserData": "xxxx",    // User data to be carried along
}

*Outbound Call

{
  // #include <standard_header>
  "Method": "dialout",
  "DestNumber": "xxxx", // Destination number
  "SpNumber": "xxxx", // Calling number displayed
  "UserData": "xxxx",    // User data to be carried along
}

Success Response

{
  "Method": "dialout",
  "DestNumberLoc": "", // Location of the called number
  "UserData": ""
}

*Get Current State

NOTE: The call state returns detailed information about the call.

{
  // #include <standard_header>
  "Method": "getState",
}

Response

{
  // #include <standard_header>
  "Method": "getState",
  "CurState": "idle",
  "StartTime": xxxxx, // timestamp - the time when the agent's state changed
  "CurMode": "", // cellphone | voip
  "CurExtState": "", // current extension state
  // If in a call state, the following information will be included:
  "DestNumber": "",
  "DestNumberLoc": "", // number location
  "SpNumber": "",
  "CallDirection": "",
  "UserData": "",
}

Agent Client Events

*Outbound Agent Phone Ringing

{
  // #include <standard_header>
  "Method": "agentRinging",
  "AgentNumber": "",
  "DestNumber": "",
  "DestNumberLoc": "", // Number location
  "SpNumber": "",
  "CallDirection": "",
  "UserData": "",
}

*Outbound Agent Off-Hook

{
  // #include <standard_header>
  "Method": "agentAnswered",
  "AgentNumber": "",
  "DestNumber": "",
  "DestNumberLoc": "", // Number location
  "SpNumber": "",
  "CallDirection": "",
  "UserData": "",
}

*Outbound User Ringing

{
  // #include <standard_header>
  "Method": "userRinging",
  "AgentNumber": "",
  "DestNumber": "",
  "DestNumberLoc": "", // Number location
  "SpNumber": "",
  "CallDirection": "",
  "UserData": "",
}

*Outbound User Off-Hook

{
  // #include <standard_header>
  "Method": "userAnswered",
  "AgentNumber": "",
  "DestNumber": "",
  "DestNumberLoc": "", // Number location
  "SpNumber": "",
  "CallDirection": "",
  "UserData": "",
}

*Agent Hang Up

{
  // #include <standard_header>
  "Method": "agnetHangup",
  "Reason": "",
}

*User Hang Up

{
  // #include <standard_header>
  "Method": "userHangup",
  "Reason": "",
}

*Agent State Change

{
  // #include <standard_header>
  "Method": "agentStateChange",
  "CurState": "",
  "CurStateSubId": 0,  // This item exists for break states
  "OldState": "",
}

*Agent Call Mode Change

{
  // #include <standard_header>
  "Method": "agentCallModeChange",
  "CurContact": "",
}

*Extension State Change

{
  // #include <standard_header>
  "Method": "extensionStateChange",
  "CurState": "",
  "OldState": "",
  "Reason": "",
}

*Server Disconnect

{
  // #include <standard_header>
  "Method": "disconnect",
  "Reason": "",
}

Data Acquisition

Obtaining Call Logs

URL: calls/logs METHOD: GET NOTE:

  1. Only fetch completed calls.
  2. Retrieve calls by CallId if specified, with priority given to CallId.
  3. Calls within a certain time range can be retrieved, up to 1 week ago. Data older than 1 week cannot be retrieved. Request Parameters
Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
CallIdNstring (uuid)Call ID, if provided, only retrieve records for this CallId
PageSizeNnumberPage size, maximum 100
PageNumNnumberPage number
StartTimeNtimestampStart time of the call
EndTimeNtimestampEnd time of the call
Note: Parameters such as CallId should be passed through a JSON-formatted request body. If not passed, an empty {} request body should be submitted, otherwise an error "100004 unexpected end of JSON input" will occur.
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectAs follows
Result
Parameter NameType (Format)Description
CallLogs[CallLog]List of call logs, as follows
CallLog
Parameter NameType (Format)Description
CallIdstring (uuid)Call identifier
StartTimetimestampStart time of the call
EndTimetimestampEnd time of the call
AgentAnswerTimetimestampAgent answer time
UserAnswerTimetimestampUser answer time
CallDurationnumberCall duration, in seconds
TotalDurationnumberTotal call duration, in seconds
DestNumberstring (digits)User number
UNProvincestringUser number province
UNCitystringUser number city
SpNumberstring (digits)Relay number
AgentIdstring (digits)Agent ID
AgentNamestringAgent name
WorkIdstringAgent extension
Emailstring (email)Agent email
CallTypestringCall type, such as: incoming, outgoing, incoming (transfer), incoming (monitor), etc.
EndTypestringCall outcome
HangupBystringParty that hung up, customer or agent
HangupReasonstringReason for hangup
HangupCodestring (digits)Hangup return code
AgentDevTypestringDevice type, either "IP phone" or "mobile, soft phone"
RobotVarsmap[string]objectAI variables
AIRecordLennumberAI recording duration
AdCallIdstringAutomatic dialing call ID
AdTaskIdstringAutomatic dialing task ID
Request Example
$ curl -X GET 'http://ip:port/ccapi/v2/calls/logs?Timestamp=1566530056&AppId=d30fe35c-995d-4921-55b8-ad21b476bbb8&Sign=e3d716dfd01e67207bb998f2b0c7dc7cdf2bf2b4&Sid=123456789abcdef' -d '{"CallId":"bc1cc555-0b24-4e1c-9979-a514888ea495","PageSize":20,"PageNum":1,"StartTime":1566316800000,"EndTime":1566489599000}'

Response Example

{
    "ErrCode": "000000",
    "ErrDesc": "OK",
    "Result": {
        "CallLogs": [
            {
                "CallId": "bc1cc555-0b24-4e1c-9979-a514888ea495",
                "StartTime": 1566298669326,
                "EndTime": 1566320334606,
                "AgentAnswerTime": 1566298674686,
                "UserAnswerTime": 0,
                "CallDuration": 0,
                "TotalDuration": 21665,
                "DestNumber": "01086482889",
                "UNProvince": "",
                "UNCity": "",
                "SpNumber": "057128091649",
                "AgentId": "",
                "AgentName": "",
                "WorkId": "",
                "Email": "",
                "CallType": "Outgoing",
                "EndType": "callResult",
                "HangupBy": "agent",
                "HangupReason": "",
                "HangupCode": "",
                "AgentDevType": "voip",
                "RobotVars": null,
                "AIRecordLen": 0,
                "AdCallId": "",
                "AdTaskId": ""
            },
            {
                "CallId": "50def7e0-cf70-411e-9e05-4381817b441c",
                "StartTime": 1566351290766,
                "EndTime": 1566351302186,
                "AgentAnswerTime": 1566351292686,
                "UserAnswerTime": 0,
                "CallDuration": 0,
                "TotalDuration": 12,
                "DestNumber": "057128091649",
                "UNProvince": "",
                "UNCity": "",
                "SpNumber": "057128091649",
                "AgentId": "",
                "AgentName": "",
                "WorkId": "",
                "Email": "",
                "CallType": "Incoming",
                "EndType": "callResult",
                "HangupBy": "agent",
                "HangupReason": "",
                "HangupCode": "",
                "AgentDevType": "voip",
                "RobotVars": null,
                "AIRecordLen": 0,
                "AdCallId": "",
                "AdTaskId": ""
            }
        ]
    }
}

Obtaining Recording Records

URL: calls/recfiles METHOD: GET

NOTE:

  1. Retrieve call recordings by CallId if specified, with priority given to CallId.
  2. Call recording lists within a certain time range can be retrieved, up to 1 week ago. Data older than 1 week cannot be retrieved. Request Parameters
Parameter NameRequiredType (Format)Description
TimestampYnumber (timestamp)Timestamp
AppIdYstring (uuid)Application ID
CallIdNstring (uuid)Call ID, if provided, only retrieve records for this CallId
PageSizeNnumberPage size, maximum 100
PageNumNnumberPage number
StartTimeNtimestampStart time of the call
EndTimeNtimestampEnd time of the call
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectAs follows
Result
Parameter NameType (Format)Description
RecFiles[RecFile]List of recording records, as follows
RecFile
Parameter NameType (Format)Description
CallIdstring (uuid)Call identifier
StartTimetimestampRecording start time
EndTimetimestampRecording end time
DurationnumberRecording duration, in seconds
RecFileUrlstring (url)Recording file URL

Obtaining Agent Status Change Logs

Filtering conditions: AgentId, or time, AppId URL: agents/statelogs METHOD: GET

NOTE:

  1. If AgentId is specified, only the status change logs for that agent are returned.
  2. If AgentId is not specified, the status change logs for all agents in the enterprise are returned.
  3. Time period limit: 1 week Request Parameters
Parameter NameRequiredType (Format)Description
TimestampYnumber (Timestamp)Timestamp
AppIdYstring (uuid)Application ID
AgentIdNstring (uuid)Agent ID
PageSizeNnumberPage size, maximum 100
PageNumNnumberPage number
StartTimeNtimestampStart time
EndTimeNtimestampEnd time
Response Results
Parameter NameType (Format)Description
ErrCodestring (digits)Response code
ErrDescstringResponse description
ResultobjectAs follows
Result
Parameter NameType (Format)Description
AgentStateLogs[AgentStateLog]List of agent state logs, as follows
AgentStateLog
Parameter NameType (Format)Description
AgentIdstring (digits)Agent ID
AgentNamestringAgent name
WorkIdstringAgent extension
CurStatestringCurrent state
CurStateSubIdnumberCurrent state sub-ID
StartTimetimestampStart time of the current state
EndTimetimestampEnd time of the current state
DurationnumberDuration of the current state, in seconds
OldStatestringPrevious state
OldStateSubIdnumberPrevious state sub-ID

Code Error Codes

Error CodeMessage InformationDescription
000001AgentId AppId WorkId BlankMissing parameters AgentId, AppId, and WorkId in the request
Parameter errorIncorrect request parameters
ParamsInvalidInvalid input parameters
File name BlankThe provided IVR filename is empty
000003System internal errorSystem internal error
000004Data does not existThe data to be deleted does not exist
100002AppId AppNotFound or forbiddenMissing AppId in the parameters or the AppId is disabled
100004Duplicate entry xxx for yyyThe agentId or queueId is duplicate with existing ones
Unexpected end of JSON inputRequest body is missing or the format is incorrect
Agent has queue or voip, can't deleteThe agent is bound to a queue or IP phone and cannot be deleted
100015NumberIsExistedThe extension number already exists
100016VoipBindAgentThe extension bound to an agent cannot be deleted
100017AppID BlankMissing AppId in the parameters
100018RecordNotFoundThe resource corresponding to the agentId in the request body could not be found, possibly an agent, queue, IVR voice record, etc.
Queue BlankThe queue corresponding to the provided queueId could not be found