Last updated on Jul 12

3 min read

Analytics API

Enhance your contact center operations and access valuable insights with the Reports API. This user-friendly API allows you to gather data quickly and efficiently, streamlining your processes.

Note For the Report API to work, an API key with type “Voice” is required. Only users with "Admin" access can create the same in the settings section. Please note that the maximum time range is 1 month.

API to get Call reports

By using our API to access call reports, you can easily obtain comprehensive data on all calls processed by Samespace.

Post https://clusterId.samespace.com/manage/api/analytics/sessions

Headers

Content-Type: application/json
{
 "authorization": {
     "x-api-key": "Nr5ux@9D4EH!rhp2O9GuuC#S#d@qlu8R"
} 
}

Body

{
   "filters": {
       "start_time": "2021-05-14T05:37:27.734Z",
       "end_time": "2021-06-14T05:37:27.734Z",
       "type": "team"
   },
   "limit": 10,
   "skip": 10
}

Response

{
   "_id" : ObjectId("5ff4093743e9410210f60350"),
   "x_origin_id" : "7f1d5a71-4f20-11eb-91c1-d5cff0c418c7",
   "uuid" : "7f1d5a71-4f20-11eb-91c1-d5cff0c418c7",
   "channel" : "voice",
   "direction" : "out",
   "type" : "team",
   "endpoint_type" : "WEB",
   "endpoint_id" : "WEB",
   "user_system_id" : "5f742f185dc78c9e085d4a77",
   "user_display_name" : "Sarah Taylor",
   "user_login_id" : "sarah",
   "caller" : "sarah",
   "callee" : "14156369898",
   "team_system_id" : "5e8433a3f010817962f28189",
   "team_name" : "Sales",
   "recording_filename" :
"919664590918_5f742f185dc78c9e085d4a77_1609828655511.wav",
   "recording_url" :
"/router/api/open-recording-url/7f1d5a71-4f20-11eb-d5cff0c418c7/1455",
   "start_time" : ISODate("2021-01-05T06:37:36.936Z"),
   "progress_duration" : 0,
   "duration" : 0,
   "answer_time" : null,
   "conference_duration" : 0,
   "end_time" : ISODate("2021-01-05T06:37:43.256Z"),
   "status" : "failed",
   "terminated_by" : "agent",
   "termination_cause" : "NORMAL_CLEARING",
   "codec" : "PCMU",
   "mos" : 4.5,
"dock_version" : "3.0.0",
   "domain_id" : 1455,
   "space_id" : "beta",
   "hold_duration" : 0,
   "custom_data" : {}
}

Get Session Report

Access valuable team/user statistics related to conversations with our Sessions Report API. By utilizing this API, you can quickly retrieve data on overall team and user performance.

POST URL https://clusterid.samespace.com/manage/api/analytics/logs

Headers

Content-Type: application/json
{
 "authorization": {
     "x-api-key": "Nr5ux@9D4EH!rhp2O9GuuC#S#d@qlu8R"
 }
}

Body

{
   "filters": {
       "user_display_name": ["Sarah Taylor"]
   }
}

Response

{
    "_id" : ObjectId("62bdac0dfa59dc030b9b808d"),
    "domain_id" : 1703,
    "space_id" : "polygon",
    "session_id" : "bd06dee0-f87c-11ec-88bf-29c100de7a90",
    "endpoint_type" : "WEB",
    "endpoint_id" : "WEB",
    "user_system_id" : "61efa2871b1efd23137b07be",
    "user_login_id" : "",
    "user_display_name" : "Sarah Taylor",
    "ip_address" : "0.0.0.0",
    "start_time" : ISODate("2022-06-30T13:58:37.276Z"),
    "end_time" : ISODate("2022-06-30T13:59:37.446Z"),
    "activity" : "login",
    "dock_version" : "5.0",
    "logout_reason" : "Network Loss",
    "session_duration" : 60
}

Get Productivity Report

The API to get Productivity will return all the productivity metrics captured by Samespace.

POST https://clusterid.samespace.com/manage/api/analytics/productivity/v2

Headers

Content-Type: application/json
{
 "authorization": {
     "x-api-key": "Nr5ux@9D4EH!rhp2O9GuuC#S#d@qlu8R"
 }
}

Body

{
   "filters": {
       "start_time": "2021-06-03 13:19:00",
       "end_time": "2021-06-04 14:19:00",
       "direction": [],
       "team_name": [],
       "channel": [],
       "user_display_name": []
   }
}

Response

{
    "_id": "5e97fbfafee6373b23aa51ae",
    "user": "Sarah",
    "session_duration": 89,
    "away_time": 0,
    "acd": 0,
    "acw": 0,
    "asa": 0,
    "avg_hold_time": 0,
    "avg_ring_duration": 0,
    "inbound_conversations": 0,
    "outbound_conversations": 1
}

CSAT Reports API

With this API, you can easily retrieve data and gain insights on your customer satisfaction levels.

POST https://clusterId.samespace.com/manage/api/analytics/csat

Body

Content-Type: application/json
{
 "filters": {
      "start_time": "2022-12-18 14:19:00",
      "end_time": "2023-01-18 14:19:00",
} 
}

Response

{
"total": 1,
"data": [ {
           "_id": "53cb7b33-a289-4572-84f5-f10dd9968e62",
           "csat": [
               {
                   "_id": "63b2d22bc6e3fe49eb4130a0",
                   "timestamp": "2023-01-02T12:46:33.130Z",
                   "uuid": "53cb7b33-a289-4572-84f5-f10dd9968e62",
                   "question": "SURVEY_ANSWER_3:How courteous was the agent?",
                   "answer": "5"
}, {
"_id": "63b2d22bc6e3fe49eb41308e",
"timestamp": "2023-01-02T12:46:28.848Z",
"uuid": "53cb7b33-a289-4572-84f5-f10dd9968e62",
"question": "SURVEY_ANSWER_2:How knowledgeable was the agent?",
               }
"answer": "1"
    "answer": "4"
},
{
    "_id": "63b2d22bc6e3fe49eb41308b",
    "timestamp": "2023-01-02T12:46:24.255Z",
    "uuid": "53cb7b33-a289-4572-84f5-f10dd9968e62",
    "question": "SURVEY_ANSWER_1:How would you rate the support you received?",
           ],
           "direction": "in",
           "caller": "+918530610172",
           "callee": "18886669555",
           "user_display_name": "Admin",
           "team_name": "Helpdesk",
           "start_time": "2023-01-02T12:45:55.854Z",
           "end_time": "2023-01-02T12:46:13.114Z",
           "duration": 14,
           "acw_duration": 47,
           "conversation_tags": [
               "Not Interested"
],
"notes": "" }
] 
}