API Documentation for CA Operations
General Information
- API Version: 1.0
- Base URL:
https://cg-dub-ca-api.callgear.ae/api/v1.0/ - Data Format: JSON
- Authentication:
- Cookie:
access_token - Bearer Token:
Bearer <token>
- Cookie:
Core Entities
- Scenarios – Sets of rules and conditions for call analysis.
- Scenario Points – Key moments in a scenario.
- Tags – Labels for categorizing scenarios and results.
- Scenario Results – Data on scenario execution for specific calls.
- Authorization Request – API access key.
| Purpose | Path | Method | Description |
| Scenario Management | /scenarios |
GET | Get a list of all scenarios |
/scenarios |
POST | Create a new scenario | |
/scenarios/{id} |
GET | Get a specific scenario by ID | |
/scenarios/{id} |
PUT | Update an existing scenario | |
/toggle_scenario |
POST | Toggle scenario state (active/inactive) | |
| Scenario Points | /scenarios/{scenario_id}/points |
GET | Get all points of a specific scenario |
/scenarios/{scenario_id}/points/{point_id} |
GET | Get a specific scenario point | |
/scenarios/{scenario_id}/text_points |
GET | Get text-based scenario points | |
/scenarios/points |
GET | Get all points across all scenarios | |
| Scenario Scores | /scenarios/{scenario_id}/scenario_score |
GET | Get the score of a specific scenario |
/scenarios/scenario_score |
GET | Get a list of scores for all scenarios | |
| Tag Management | /tags |
GET | Get a list of all tags |
/tags |
POST | Create a new tag | |
/tags/{id} |
GET | Get a tag by ID | |
/tags/{id} |
PUT | Update an existing tag | |
| Scenario Results | /scenario_result |
GET | Get a list of all scenario execution results |
/scenario_result |
POST | Create a new scenario execution result | |
/scenario_result/{id} |
GET | Get a scenario execution result by ID | |
/scenario_result/{id} |
PUT | Update a scenario execution result | |
/scenario_result/{id} |
DELETE | Delete a scenario execution result | |
| Result Analysis | /scenario_result/{id}/summary |
GET | Get a summary of a scenario execution result |
/scenario_result/summary |
GET | Get a list of result summaries | |
/scenario_result/{id}/phrase_and_words |
GET | Get phrases and words from a result | |
/scenario_result/phrase_and_words |
GET | Get a list of phrases and words from results | |
/scenario_result/{id}/success_points |
GET | Get successful points from a result | |
/scenario_result/success_points |
GET | Get a list of successful points | |
/scenario_result/{id}/tags |
GET | Get tags associated with a result | |
/scenario_result/tags |
GET | Get a list of result tags | |
/scenario_result/{id}/employees_metrics |
GET | Get employee metrics from a result | |
/scenario_result/employees_metrics |
GET | Get a list of employee metrics | |
| JSON-RPC | /rpc |
POST | Execute a JSON-RPC request (universal method for remote calls) |
| Notifications | /notification_conditions |
GET | Get conditions for notification triggers |
| Authorization Request | /api-login |
POST | Greate a new token |
Response Data Format
| Format | MIME Type |
|---|---|
| JSON | application/json |
Explanation of Core Paths (/):
/scenarios: Base path for scenario objects (CRUD operations)./scenario_result: Base path for managing scenario execution results./tags: Base path for tags (labels for data categorization)./tokens: Base path for authentication token management./rpc: Universal path for JSON-RPC requests./notification_conditions: Path for retrieving notification condition settings.
Endpoints
Scenarios
Get List of Scenarios
GET /scenarios
Parameters:
_sort(string): field for sorting (default is "id")_order(string): sort order ("asc" or "desc", default is "asc")_start(integer): starting index for pagination_end(integer): ending index for paginationfilters(object): filters
Create Scenario
POST /scenarios
Request Body:
{
"state": "active|inactive",
"scenario_text": "string",
"scenario_name": "string",
"scenario_score": number,
"tags": [TagSchema],
"filters": [FilterResponse]
}
Get Scenario by ID
GET /scenarios/{id}
Get Scenario by ID
Endpoint: GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenarios/:id
Method: GET
Description: Returns information about the scenario by its identifier.
Request Headers:
X-Trace-Id: (Optional) Identifier for tracing.Accept:application/json(Required) Indicates that the client expects a response in JSON format.
Path Parameters:
id: (Required) Scenario identifier.
Example Successful Response (200 OK):
{
"state": "inactive",
"scenario_text": "1. Оператор поздоровался...",
"id": 130,
"scenario_name": "Медицина",
"scenario_score": 70,
"tags": [
{
"id": 208,
"comagic_tag_id": 3733,
"performer": "operator",
"condition": "discuss",
"color": "special-2",
"description": "Выражал негатив, использовал нецензурную лексику",
"name": "негатив оператор"
}
],
"filters": [
[
{
"id": 203,
"name": "Длительность разговора",
"operators": "больше чем",
"data_type": "number",
"values": 5
}
]
]
}
Update Scenario
PUT /scenarios/{id}
Update Scenario
Endpoint: PUT https://cg-dub-ca-api.callgear.ae/api/v1.0/scenarios/:id
Method: PUT
Description: Updates scenario information by its identifier.
Request Headers:
X-Trace-Id: (Optional) Trace ID for tracing.Content-Type:application/json(Required) Indicates that the request body contains JSON.Accept:application/json(Required) Indicates that the client expects a response in JSON format.
Path Parameters:
id: (Required) Scenario identifier.
Request Body (Example):
{
"state": "active",
"scenario_text": "<string>",
"scenario_name": "",
"scenario_score": "<number>",
"tags": [
{
"performer": "<string>",
"condition": "<string>",
"color": "<string>",
"description": "<string>",
"name": "<string>",
"id": "<integer>",
"comagic_tag_id": "<integer>"
}
],
"filters": [
{
"id": "<integer>",
"name": "<string>",
"operators": "<string>",
"data_type": "<string>",
"values": {
"title": "Values"
}
}
]
}
The request body is similar to the one used when creating a scenario.
Get Scenario Points
GET /scenarios/{scenario_id}/points
Get List of All Scenario Points
Endpoint:GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenarios/:scenario_id/points
Parameters:
scenario_id(Required) — Scenario identifier.
Headers:
Accept: application/jsonaccess_token: {{apiKey}}(in the header)
Successful Response (200 OK):
[
{
"id": 1,
"point": "Operator greeted"
},
{
"id": 2,
"point": "Operator announced his name and position"
}
]
Get a specific point in the scenario
GET /scenarios/{scenario_id}/points/{point_id}
Get information about a specific point in the scenario
Endpoint:GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenarios/:scenario_id/points/:point_id
Parameters:
scenario_id(required) — ID of the scenario.point_id(required) — ID of the point in the scenario.
Headers:
Accept: application/jsonaccess_token: {{apiKey}}(in the header)
Successful response (200 OK):
{
"id": 1,
"point": "Operator greeted"
}
Error response (500 Internal Server Error):
{
"id": "<integer>",
"point": "<string>"
}
Get text points from scenario
GET /scenarios/{scenario_id}/text_points
Get text points of scenario
Endpoint:GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenarios/:scenario_id/text_points
Parameters:
scenario_id(required) — ID scenario.
Headers:
Accept: application/jsonaccess_token: {{apiKey}}(in headers)
Example error response (500 Internal Server Error):
{
"text": "<string>"
}
Get all points of all scenarios
GET /scenarios/points
Get list of scenarios
Endpoint:GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenarios/points
Query Parameters:
_sort(optional): Field for sorting (defaultid)._order(optional): Sorting direction (ascordesc, defaultasc)._start(optional): Starting index for pagination (number)._end(optional): Ending index for pagination (number).id__eq(optional): Filtering by scenario ID (number).
Example Request:
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenarios/points?_sort=id&_order=asc
Response:
- Status:
200 OK - Response Body: Array of scenarios, where each scenario is an array of objects with fields
idandpoint.
Example Response:
[
{
"id": 1,
"point": "Target purchase"
},
{
"id": 2,
"point": "Type of property"
}
]
Get scenario by ID
Endpoint:GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenarios/points?id__eq={id}
Query Parameters:
id__eq: Scenario ID for filtering.
Example Request:
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenarios/points?_sort=id&_order=asc&id__eq=130
Response:
- Status:
200 OK - Response Body: Array of scenarios corresponding to the specified ID.
Request Headers
X-Trace-Id(optional): Unique identifier for tracing the request.Accept: Must be set toapplication/json.
Example Usage
-
Get all scenarios:
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenarios/points?_sort=id&_order=asc -
Get scenario with ID 130:
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenarios/points?_sort=id&_order=asc&id__eq=130
Errors
404 Not Found: If the scenario with the specified ID is not found.500 Internal Server Error: In case of an internal server error.
Notes
- For pagination, use
_startand_end. - The response is always returned in JSON format.
Get List of Scenario Scores
GET /scenarios/scenario_score
Tags
Get List of Tags
GET /tags
Endpoint: https://cg-dub-ca-api.callgear.ae/api/v1.0/tags?_sort=id&_order=asc&_start=1&_end=10
Method: GET
Description: Getting list of tags with sorting and pagination capabilities.
Query Parameters
_sort: Field for sorting (default:id)_order: Sorting order (asc— ascending,desc— descending) (default:asc)_start: Starting index for pagination (default: 1)_end: Ending index for pagination (default: 10)
Headers
X-Trace-Id(optional)Accept: application/json
Example Request
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/tags?_sort=id&_order=asc&_start=1&_end=10 HTTP/1.1
Host: call-assessment.localhost.uis.st:9010
Authorization: Bearer {{apiKey}}
Example Response
[
{
"id": 181,
"comagic_tag_id": 3745,
"performer": "operator",
"condition": "discuss",
"color": "special-3",
"description": "Записал клиента, клиент записан. Озвучил дату, время записи, ФИО и специализацию врача, стоимость, адрес",
"name": "запись подытоживания"
},
{
"id": 184,
"comagic_tag_id": 3727,
"performer": "operator",
"condition": "discuss",
"color": "special-6",
"description": "Оператор отработал возражения",
"name": "возражение оператора"
},
...
]
Create Tag
POST /tags
Endpoint: https://cg-dub-ca-api.callgear.ae/api/v1.0/tags
Method: POST
Description: Creates a new tag.
Headers
X-Trace-Id(optional)Content-Type: application/jsonAccept: application/json
Request Body
{
"performer": "client",
"condition": "not discuss",
"description": "<string>",
"name": "<string>",
"color": "<string>",
"id": "<integer>",
"comagic_tag_id": "<integer>",
"is_active": true
}
Example Request
POST https://cg-dub-ca-api.callgear.ae/api/v1.0/tags HTTP/1.1
Host: call-assessment.localhost.uis.st:9010
Authorization: Bearer {{apiKey}}
Content-Type: application/json
{
"performer": "client",
"condition": "not discuss",
"description": "New tag description",
"name": "New tag name",
"color": "special-5",
"id": 208,
"comagic_tag_id": 3746,
"is_active": true
}
Example Response
{
"performer": "client",
"condition": "not discuss",
"description": "New tag description",
"name": "New tag name",
"color": "special-5",
"id": 208,
"comagic_tag_id": 3746,
"is_active": true
}
Error Handling
The API returns standard HTTP status codes and error messages in JSON format.
Common Status Codes
200 OK: The request was executed successfully.401 Unauthorized: User authentication is required.403 Forbidden: The server understood the request, but refused to authorize it.404 Not Found: The requested resource was not found.500 Internal Server Error: A non-preventable error occurred on the server.
Example Response with Error
{
"error": "Internal Server Error",
"message": "An error occurred while processing your request."
}
Get Tag by ID
GET /tags/{id}
1. Getting a tag by ID
Endpoint: https://cg-dub-ca-api.callgear.ae/api/v1.0/tags/:id
Method: GET
Description: Retrieves a specific tag by its identifier.
Path Parameters
id: The unique identifier of the tag (required parameter).
Headers
X-Trace-Id(optional)Accept: application/json
Example Request
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/tags/181 HTTP/1.1
Host: call-assessment.localhost.uis.st:9010
Authorization: Bearer {{apiKey}}
Example Response
{
"id": 181,
"comagic_tag_id": 3745,
"performer": "operator",
"condition": "discuss",
"color": "special-3",
"description": "Записал клиента, клиент записан. Озвучил дату, время записи, ФИО и специализацию врача, стоимость, адрес",
"name": "запись подытоживания"
}
Update Tag
PUT /tags/{id}
Endpoint: https://cg-dub-ca-api.callgear.ae/api/v1.0/tags/:id
Method: PUT
Description: Updates an existing tag.
Query Parameters
- Path Parameter:
id: Unique identifier of the updated tag (required)
Headers
X-Trace-Id(optional)Content-Type: application/jsonAccept: application/json
Request Body
{
"performer": "client",
"condition": "not discuss",
"description": "<string>",
"name": "<string>",
"color": "<string>",
"id": "<integer>",
"comagic_tag_id": "<integer>",
"is_active": true
}
Example Request
PUT https://cg-dub-ca-api.callgear.ae/api/v1.0/tags/181 HTTP/1.1
Host: call-assessment.localhost.uis.st:9010
Authorization: Bearer {{apiKey}}
Content-Type: application/json
{
"performer": "client",
"condition": "not discuss",
"description": "Updated description",
"name": "Updated tag name",
"color": "special-2",
"id": 181,
"comagic_tag_id": 3745,
"is_active": true
}
Example Response
{
"performer": "client",
"condition": "not discuss",
"description": "Updated description",
"name": "Updated tag name",
"color": "special-2",
"id": 181,
"comagic_tag_id": 3745,
"is_active": true
}
Results of Scenarios
Get List of Results
GET /scenario_result
General Description
API returns a list of all scenario results (scenario_result). It supports sorting, filtering, and pagination.
Method
GET
URL
https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result
Query Parameters
All query parameters are optional:
_sort– field for sorting (default isid)._order– sorting direction (ascordesc)._start– start index of the page (for pagination)._end– end index of the page (for pagination).call_session_id__eq– filter by session call ID.
Example Queries
- Get all results:
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result - Get results for a specific session:
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result?call_session_id__eq=129742035 - Get first 10 records sorted by ID:
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result?_start=0&_end=10&_sort=id&_order=asc
Response Format
The response contains an array of JSON objects. Each object includes the following fields:
id– unique result identifier.app_id– ID of the application associated with the record.call_session_id– ID of the call session.scenario_id– ID of the scenario.scenario_name– name of the scenario.result– detailed information about the execution of the scenario, including:hold– hold periods during the call (empty array).scenario– data on executed steps in the scenario (name, evaluation, timestamps).silences– silence periods in the conversation.profanity– use of profanity.phrase_list– phrase list with emotion and timestamp information.audio_sources– links to audio recordings of the call.dialog_summary– brief summary of the dialogue.scenario_score– overall score of the scenario execution (in percent).
Example Response
[
{
"id": 34612,
"app_id": 64832,
"call_session_id": 129742029,
"scenario_id": 130,
"scenario_name": "Medicine",
"result": {
"hold": { "data": [], "active_count": 0 },
"scenario": {
"data": [
{
"end": 7.84,
"name": "Operator greeted",
"score": 1,
"start": 2.72
}
],
"count": 3,
"is_successful": false,
"scenario_name": "Medicine",
"percent_completion": 15
},
"phrase_list": [
{
"end": 1.32,
"start": 1.04,
"phrase": "All right.",
"channel": 1,
"emotions_result": "neutral"
}
]
}
}
]
Errors
400 Bad Request– invalid query parameters.500 Internal Server Error– internal server error.
Notes
- Without query parameters, it returns all results.
- For pagination, use
_startand_end. - Filtering by
call_session_id__eqallows getting results for a specific call.
Request Method
POST
Create Scenario Result Query
Authentication
Access to the API requires authentication using an API key.
Authentication parameters:
- Type:
apikey - Key:
key - Value:
{{apiKey}}(passed in the header) - Location:
header
Request Headers
- X-Trace-Id: (optional) Unique identifier for tracing the request.
- Content-Type:
application/json(required) Indicates the format of the request body. - Accept:
application/json(required) Indicates the expected format of the response.
Request Body
The request body must be in JSON format and contain the following fields:
{
"call_session_id": "<integer>", // Call session ID
"scenario_id": "<integer>", // Scenario ID
"scenario_name": "<string>", // Scenario name
"result": {}, // Result of the scenario execution (may be an empty object)
"id": "<integer>", // Result ID
"app_id": "<integer>" // App ID
}
API Request
- Base URL:
https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result - Path:
https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result
Description
This endpoint is designed to save the results of a scenario execution. After successful query execution, it returns the created scenario result.
Example Request
curl -X POST \
https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result \
-H 'key: {{apiKey}}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"call_session_id": 123,
"scenario_id": 456,
"scenario_name": "Test Scenario",
"result": {},
"id": 789,
"app_id": 101
}'
Notes
- Mandatory fields:
call_session_id,scenario_id,scenario_name,id,app_id. - The field
resultcan be an empty object{}if the data is not required. - Ensure that the API key (
{{apiKey}}) is active and has the necessary access rights.
Get Scenario Result by ID
GET /scenario_result/{id}Getting Scenario Result by ID
This method allows you to get the result of a scenario execution by its unique identifier.
Query Parameters
- id (mandatory) — the unique identifier of the scenario result.
Example Request
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/34618
Example Response
{
"id": 34618,
"app_id": 64832,
"call_session_id": 129742035,
"scenario_id": 133,
"scenario_name": "Football",
"result": {
"result": {
"hold": {
"data": [],
"active_count": 0
},
"scenario": {
"data": [
{
"end": 335.25563392,
"name": "Discussed the latest transfers of the club",
"score": 1,
"start": 322.375647232
}
],
"count": 12,
"is_successful": true,
"scenario_name": "Football",
"percent_completion": 80
},
"silences": {
"data": [],
"active_count": 0
},
"profanity": {
"data": [
{
"end": 18.1694976,
"name": "profanity",
"start": 17.849499648,
"state": "active",
"duration": 0.31999795200000136
}
],
"active_count": 6
},
"tag_events": {
"events": [
{
"id": "cbc61a46-bcae-4dea-ae08-26d5381b1e0e",
"end": 314.08766976,
"score": 1,
"start": 303.8076928,
"state": "active",
"tag_id": 211
}
],
"active_count": 2
},
"phrase_list": [
{
"end": 1.96,
"start": 1.72,
"phrase": "Hello.",
"channel": 1,
"words_list": [
{
"end": 1.96,
"word": "hello",
"start": 1.72
}
],
"emotion_state": "active",
"emotions_result": "neutral"
}
]
}
}
}
Description of Response Fields
- id — the unique identifier of the scenario result.
- app_id — the identifier of the application.
- call_session_id — the identifier of the call session.
- scenario_id — the identifier of the scenario.
- scenario_name — the name of the scenario.
- result — an object containing the results of the scenario execution, including data on executed steps, usage of profanity, tag events, and a list of phrases.
Response Status Codes
200 OK— the query is executed successfully, the scenario result is returned in the response body.404 Not Found— the scenario result with the specified ID is not found.500 Internal Server Error— an internal server error occurs.
Update Scenario Result
PUT /scenario_result/{id}
Update a scenario result by its identifier.
URL Request
PUT https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/:id
URL Parameters
id(required): The identifier of the scenario result to update.
Request Body
The request body must be in JSON format and contain the following fields:
call_session_id(integer): The call session identifier.scenario_id(integer): The scenario identifier.scenario_name(string): The name of the scenario.result(object): The result of the scenario execution (may be an empty object).id(integer): The identifier of the scenario result.app_id(integer): The application identifier.
Example request body:
{
"call_session_id": 123,
"scenario_id": 456,
"scenario_name": "Test Scenario",
"result": {},
"id": 789,
"app_id": 101
}
Request Headers
Content-Type:application/jsonAccept:application/jsonX-Trace-Id: A tracing identifier (may be empty).
Response
The method returns the updated scenario result. The response format depends on the server implementation.
Delete Scenario Result
DELETE /scenario_result/{id}
Deleting a scenario result
This method allows deleting a scenario result by its identifier.
Request
- Method:
DELETE - URL:
https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/:id- Parameter
:id(required): the integer identifier of the scenario result.
- Parameter
Headers
Accept: application/jsonX-Trace-Id: an optional header for tracing the request.
Example Request
DELETE https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/123 HTTP/1.1
Host: https://cg-dub-ca-api.callgear.ae
Accept: application/json
X-Trace-Id: your_trace_id
Response
The method does not return a response body. A successful execution is confirmed by the status code 204 No Content.
Errors
404 Not Found: if the scenario result with the specified identifier does not exist.400 Bad Request: if an invalid identifier is passed.
Get Summary of Scenario Result
GET /scenario_result/{id}/summary
Get Summary by Scenario
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/:id/summary
Returns a summary of the scenario result by its identifier.
Request Parameters
id(required) — the identifier of the scenario result.
Request Headers
X-Trace-Id— an identifier for tracking the request.Accept— the expected response type (for example,application/json).
Example Successful Response
Response Code: 200 OK
Response Body:
{
"dialog_summary": "Main topic: Medical appointment\nResult: Request clarification on the appointment\nInteraction Type: Inquiry, not sales-related\nBrief Description: The customer inquires about the possibility of an appointment with Dr. Tarasenko on January 8th. The operator clarifies how to approach the customer to continue the conversation, but the appointment is not confirmed."
}
Field Descriptions
dialog_summary— a text summary of the dialogue, including the main topic, result, interaction type, and brief description.
Get Summary List
GET /scenario_result/summary
Get Summary List
The GET method returns a list of summaries for the scenario results. It supports filtering by call session, sorting and pagination (although the pagination parameters _start and _end are disabled in this example).
URL Request
https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/summary
Query Parameters
_sort(string, optional): The field to sort by (default isid)_order(string, optional): The sorting direction (asc/desc, default isasc)call_session_id__eq(string, optional): Filter by call session ID (example:129742035)_start,_end(numbers, optional): Pagination parameters (disabled in this example)
Example Queries
-
Without filters (all records):
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/summary -
With filter by session:
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/summary?call_session_id__eq=129742035 -
Sorting in descending order:
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/summary?_sort=id&_order=desc
Example Response
A successful response returns an array of summaries:
[
{
"dialog_summary": "Main topic: Discussion about the football match...",
}
]
Description of Response Fields
dialog_summary– The text summary of the dialogue, including:- Main topic of the conversation
- Final result
- Type of interaction
- Brief content
Status Codes
200 OK– Successful request400 Bad Request– Invalid parameters404 Not Found– Data not found500 Internal Server Error– Server error
Notes
- For pagination, use
_startand_end(e.g._start=0&_end=10for the first 10 records) - The filter
call_session_id__eqis useful for selecting results from a specific session
Get phrases and words from result
GET /scenario_result/{id}/phrase_and_words
Get phrases and words from scenario
This API method allows you to get a list of phrases and words associated with a specific scenario, including time stamps, channels, emotional tone, and other details.
Request parameters
- id (required): Unique identifier of the result scenario for which you want to retrieve phrases and words.
Example value:34612.
Example request
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/34612/phrase_and_words
Accept: application/json
Response format
The response is returned in JSON format and contains an array of objects, each representing one phrase. Each phrase includes the following fields:
- start: Time stamp of the start of the phrase in seconds.
- end: Time stamp of the end of the phrase in seconds.
- phrase: The text of the phrase.
- channel: Channel number (0 or 1) to which the phrase belongs.
- words_list: Array of words that make up the phrase, along with their time stamps and channel numbers.
- emotion_state: Emotional state (e.g.,
active). - emotions_result: Result of emotional coloring (e.g.,
neutral,positive).
Example response
[
{
"end": 1.32,
"start": 1.039999936,
"phrase": "Алле.",
"channel": 1,
"words_list": [
{
"end": 1.32,
"word": "алле",
"start": 1.039999936,
"channel": null
}
],
"emotion_state": "active",
"emotions_result": "neutral"
},
{
"end": 7.84,
"start": 2.72,
"phrase": "Мединский, Регина, здравствуйте. Чем могу помочь?",
"channel": 0,
"words_list": [
{
"end": 3.32,
"word": "мединский",
"start": 2.72,
"channel": null
},
{
"end": 4.4,
"word": "регина",
"start": 3.96,
"channel": null
}
],
"emotion_state": "active",
"emotions_result": "neutral"
}
]
HTTP status codes
200 OK: The request was executed successfully, the data is returned.404 Not Found: The result scenario with the specifiedidis not found.
Get List of Phrases and Words
GET /scenario_result/phrase_and_words
Getting the list of phrases and words from a scenario
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/phrase_and_words
Returns a list of phrases and words recognized within the scope of a scenario, along with timestamps, channels, and emotional coloring.
Query Parameters
_sort(optional): Field for sorting results. Defaults toid._order(optional): Sorting direction (ascordesc). Defaults toasc.call_session_id__in(required): The identifier of the call session for which you need to get data. Example:129742035.
Example Request
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/phrase_and_words?_sort=id&_order=asc&call_session_id__in=129742035
Response Format
The response is returned in JSON format and contains an array of objects, each representing a phrase with additional information:
[
{
"end": 1.96,
"start": 1.72,
"phrase": "Алло.",
"channel": 1,
"words_list": [
{
"end": 1.96,
"word": "алло",
"start": 1.72,
"channel": null
}
],
"emotion_state": "active",
"emotions_result": "neutral"
}
]
Response Fields
end: The end time of the phrase in seconds.start: The start time of the phrase in seconds.phrase: The text of the phrase.channel: The channel number (0 or 1) on which the phrase was spoken.words_list: An array of words that make up the phrase, along with their timestamps.end: The end time of the word.word: The text of the word.start: The start time of the word.channel: The channel number (may benull).
emotion_state: The emotional state (activeor other).emotions_result: The result of the emotional coloring (neutral,negativeand others).
Example Usage
Example usage for analyzing a dialogue between two participants, where you can track phrase duration, emotional coloring, and channel distribution.
Errors
400 Bad Request: Invalid request format or missing required parameters.404 Not Found: The call session with the specifiedcall_session_id__inis not found.500 Internal Server Error: An internal server error.
Get successful points from scenario result
GET /scenario_result/{id}/success_points
Get success score of the scenario
Endpoint:GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/:id/success_points
Path Parameters:
id(required) — id of the scenario result.
Request Headers:
Accept: application/jsonX-Trace-Id— optional trace identifier.
Example Successful Response:
HTTP Status Code: 200 OK
Response Body:
[
{
"name": "Operator greeted",
"start": 2.72,
"end": 7.84
},
{
"name": "Operator introduced himself, position",
"start": 2.72,
"end": 7.84
},
{
"name": "Clarified the client's name",
"start": 16.749626368,
"end": 23.749625856
}
]
Description of Response Fields:
name— name of the success criterion.start— start time of the execution (in seconds).end— end time of the execution (in seconds).
Note:
- The response contains an array of objects, each corresponding to a success criterion of the scenario.
Get Successful Points List
GET /scenario_result/success_points
Get successful points list
This method allows you to get a list of success points scores sorted by identifier (id) in ascending order (asc).
Query Parameters
_sort: The field for sorting (default isid)._order: Sorting direction (ascfor ascending,descfor descending)._start: Starting index for pagination (integer)._end: Ending index for pagination (integer).
Example Request
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/success_points?_sort=id&_order=asc&_start=0&_end=10
Response
The method returns a list of success points scores in JSON format. The response structure depends on the server implementation.
Note
- For correct request operation, valid values for
_startand_endindices are required for pagination.
Get Tags from Result
GET /scenario_result/{id}/tags
Get Tags of Scenario Result
This method allows you to get a list of tags associated with the result of executing a scenario.
Request Parameters
id(required): Unique identifier for the scenario result.
Headers Request
Accept:application/jsonX-Trace-Id: Optional identifier for tracing the request.
Example Response
The response contains an array of tags, each including:
name: Tag name.start: Start time of the tag in seconds.end: End time of the tag in seconds.color: Color of the tag (e.g.special-6).
Example Response Body:
[
{
"name": "failure to register",
"start": 37.150625792,
"end": 50.510626816,
"color": "special-6"
},
{
"name": "word parasites",
"start": 15.363750912,
"end": 33.203750912,
"color": "special-4"
}
]
Status Codes
200: Successful request. Tags are returned in the response.
Get List of Result Tags
GET /scenario_result/tags
Get List of Metric Result Tags
This endpoint allows you to get a list of tags associated with the metric results of scenarios. The data is returned in sorted order.
Request Parameters
_sort: The field to sort by. Available values:id._order: The sorting direction. Available values:asc(ascending),desc(descending)._start: The starting index for pagination. Enter a whole number._end: The ending index for pagination. Enter a whole number.
Example Request
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/tags?_sort=id&_order=asc&_start=0&_end=10
Request Headers
Accept: Indicates that the client expects a response in JSON format. Value:application/json.X-Trace-Id: Optional header for query identifier. May be empty.
Get employee metrics from scenario result
GET /scenario_result/{id}/employees_metrics
Get employee metrics
This endpoint allows you to get the employee metrics by the scenario result.
Request parameters
id(required) – the identifier of the scenario result.
Response headers
X-Trace-Id(optional) – the trace ID (optional).Accept– must be set toapplication/json.
Example response
The response contains an array of objects with employee metrics. Each object includes:
name– the name of the metric (for example, "profanity").start– the start time of the metric in seconds.end– the end time of the metric in seconds.
Example response body:
[
{
"name": "profanity",
"start": 17.849499648,
"end": 18.1694976
},
{
"name": "profanity",
"start": 49.302749184,
"end": 49.622749184
}
]
Response status
- 200 OK – the request is executed successfully.
Response headers
- Content-Type –
application/json; charset=utf-8. - Access-Control-Allow-Methods – allowed HTTP methods.
- Access-Control-Allow-Credentials – allow credentials to be sent.
- Access-Control-Allow-Headers – allowed headers.
- Access-Control-Expose-Headers – exposed headers to the client.
- Access-Control-Max-Age – time to cache CORS requests.
- Server – server information.
Get Employee Metrics List
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/employees_metrics
###### Getting the list of employee metrics
This endpoint allows you to get a list of employee metrics with sorting and pagination capabilities. All query parameters are optional.
###### URL Request
`GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/employees_metrics`
###### Query Parameters
- `_sort` (optional): The field for sorting. Available values: `id`. If not specified, no sorting is applied.
- `_order` (optional): The direction of sorting. Available values: `asc` (ascending), `desc` (descending). Default: `asc`.
- `_start` (optional): The starting index for pagination. Integer. If not specified, all records from the start are returned.
- `_end` (optional): The ending index for pagination. Integer. If not specified, all records up to the end are returned.
###### Example Request
```http
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/scenario_result/employees_metrics?_sort=id&_order=asc&_start=0&_end=10
###### Request Headers
- `Accept: application/json` - indicates that the client expects a JSON response.
- `X-Trace-Id` (optional): A unique identifier for tracing the request.
###### Response Format
The response is returned in JSON format and contains a list of employee metrics. If pagination parameters are not specified, all available records are returned.
Get Token List
GET /tokens
Get Token List
Endpoint: GET https://cg-dub-ca-api.callgear.ae/api/v1.0/tokens
Description: Returns a list of all SSO tokens.
Example Response:
[
{
"name": "<string>",
"access_token": "<string>",
"token_type": "Bearer",
"expires_in": "<string>",
"id": "<string>",
"issued_token_type": "<string>",
"created_at": "<string>",
"is_active": true
},
{
"name": "<string>",
"access_token": "<string>",
"token_type": "Bearer",
"expires_in": "<string>",
"id": "<string>",
"issued_token_type": "<string>",
"created_at": "<string>",
"is_active": true
}
]
Create Token
POST /tokens
Create Token
Endpoint: POST https://cg-dub-ca-api.callgear.ae/api/v1.0/tokens
Description: Creates a new SSO token.
Request Body:
{
"name": "<string>"
}
Example Response:
{
"name": "<string>",
"access_token": "<string>",
"token_type": "Bearer",
"expires_in": "<string>",
"id": "<string>",
"issued_token_type": "<string>",
"created_at": "<string>",
"is_active": true
}
Delete Token
DELETE /tokens/{id}
Delete Token
Endpoint: DELETE https://cg-dub-ca-api.callgear.ae/api/v1.0/tokens/:id
Description: Deletes an SSO token by the specified identifier.
Parameters:
id(string, mandatory): The ID of the token to delete.
JSON-RPC
Execute a JSON-RPC Request
POST /rpc
Request Body:
{
"id": "string",
"method": "string",
"params": object
}
Notification Conditions
Get Notification Conditions
GET /notification_conditions
Overview
The API provides access to notification conditions, which define the criteria for selecting callers based on various filters. Filters include segments of visitors, call direction, phone numbers, contacts, advertising campaigns, and others.
Base URL
https://cg-dub-ca-api.callgear.ae/api/v1.0/notification_conditions
Method
GET
Request Headers
X-Trace-Id: Trace ID for tracking the request (optional).Accept:application/json(required).
Query Parameters
None.
Example Request
GET https://cg-dub-ca-api.callgear.ae/api/v1.0/notification_conditions HTTP/1.1
Host: https://cg-dub-ca-api.callgear.ae
Accept: application/json
X-Trace-Id: your_trace_id
Response
Successful Response (code 200)
The response body contains an array of objects, each representing a notification condition with various parameters.
Example Response:
[
{
"id": 5,
"name": "Segment List",
"operators": [
{
"id": "=",
"name": "Exactly matches",
"is_default": true
},
{
"id": "in",
"name": "Includes",
"is_default": false
},
{
"id": "is_null",
"name": "Empty",
"is_default": false
},
{
"id": "is_not_null",
"name": "Not empty",
"is_default": false
},
{
"id": "intersect",
"name": "Includes",
"is_default": false
}
],
"data_type": "array",
"values": [
{
"id": 2322,
"name": "hcp.tb.ru",
"data": [
{
"id": 5739,
"name": "PC test"
},
{
"id": 4995,
"name": "Visitor viewed 5 or more pages"
}
]
}
]
},
{
"id": 7,
"name": "Call Direction",
"operators": [
{
"id": "=",
"name": "Exactly matches",
"is_default": true
}
],
"data_type": "string",
"values": [
{
"id": "in",
"name": "Incoming call"
},
{
"id": "out",
"name": "Outgoing call"
}
]
}
]
Response Fields
Each object in the array contains the following fields:
id: Unique identifier for the condition.name: Condition name.operators: Array of operators that can be applied to the condition. Each operator contains:id: Operator ID.name: Operator name.is_default: Flag indicating if the operator is default.
data_type: Data type of the condition (e.g.,array,string,number).values: Array of values that can be used for the condition. May benullif no values are defined.
Errors
400 Bad Request: Invalid request format.401 Unauthorized: Lack of authorization.500 Internal Server Error: Internal server error.
API Documentation for Notification Conditions Retrieval
For more detailed integration setup, please refer to technical support.
Data Models
TagSchema
{
"id": integer,
"comagic_tag_id": integer,
"performer": "string",
"condition": "string",
"color": "string",
"description": "string",
"name": "string"
}
ScenarioFormResponse
{
"state": "active|inactive",
"scenario_text": "string",
"id": integer,
"scenario_name": "string",
"scenario_score": number,
"tags": [TagSchema],
"filters": [FilterResponse]
}
ScenarioPoint
{
"id": integer,
"point": "string"
}
ScenarioScore
{
"scenario_score": number
}
ScenarioResult
{
"id": integer,
"app_id": integer,
"call_session_id": integer,
"scenario_id": integer,
"scenario_name": "string",
"result": object
}
Token
{
"name": "string",
"id": "string",
"access_token": "string",
"token_type": "Bearer",
"issued_token_type": "string",
"expires_in": "string",
"created_at": "string",
"is_active": boolean
}
Authorization Request
Method: POST
URL: https://cg-dub-ca-api.callgear.ae/api/v1.0/api-login
Request Body (JSON):
{
"username": "qa@comagic.dev",
"password": ">bcrjvRjvtl;br"
}
Request Headers
X-Trace-Id: Unique request identifier (optional).Content-Type: application/jsonAccept: application/json
Successful Response Example
Status Code: 200 OK
Response Body (JSON):
{
"name": ""
,
"id": "88e4364b-0fca-4276-83c4-69840cc8cdf4",
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6...",
"token_type": "Bearer",
"issued_token_type": "urn:ietf:params:oauth:token-type:access_token",
"expires_in": "2025-05-14T10:46:55.182817",
"created_at": "2025-04-14T10:39:06.568300",
"is_active": true
}
Error Examples
Code: 401 Unauthorized
{
"type": "HTTPUnauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "Incorrect login or password"
}
Code: 500 Internal Server Error
{
"type": "HTTPInternalServerError",
"title": "Server got itself in trouble",
"status": 500,
"detail": "Something went wrong. Please try again later."
}
Request Body Parameters
username(string): User login.password(string): User password.
Response Body Parameters
id(string): Unique session identifier.access_token(string): API access token.expires_in(string): Token expiration time in YYYY-MM-DDTHH:MM:SS format.created_at(string): Token creation date.is_active(boolean): Session activity status.
Status Codes
200 OK: Authorization successful.401 Unauthorized: Invalid credentials.500 Internal Server Error: Internal server error.
Response Headers
- Content-Type:
application/json; charset=utf-8 - Access-Control-Allow-Methods: List of allowed HTTP methods.
- Access-Control-Allow-Credentials: true (credentials permission).
- Access-Control-Expose-Headers: WWW-Authenticate.