Migrating from V0 Statistics to the Insights Stats API
This guide provides advice for upgrading from the retired V0 - Statistics APIÂ of the Insight Stats API. The guide includes each of the retired endpoints in Statistics API V0 and describes how to retrieve equivalent data using endpoints in the Insights Stats API.
GET v0/{accountKey}/statistics/agentstates (RETIRED)
The GET /agentstates
 endpoint returned the following response:
{ "count":2, "stats":[ { "agentId":"10955", "groupId":"", "stateChangedAt":"2020-02-12T15:06:07Z", "state":"Ready", "duration":"00:00:09" }, { "agentId":"10955", "groupId":"44311", "stateChangedAt":"2020-02-12T15:06:16Z", "state":"Busy Inbound", "duration":"00:00:12", "callGuid":"0148e4d3-684f-b8b7-e2ba-9014639797f1" }] }
Insights Stats endpoint GET /agent-activities
 replaces GET /agentstates
. GET /agent-activities
 returns nearly all of the same data plus much more. The following example shows the same agents’ data:
{ "meta": { "page": 1, "count": 6, "pageCount": 1, "totalCount": 6 }, "items": [ { "agentId": "10955", "type": "Presence", "category": "Ready", "name": "Ready", "eligibleForRouting": true, "start": "2020-02-12T15:06:07.000Z", "status": null, "duration": 9000, "reason": null, "interaction": null, "channel": null, "workload": null }, { "agentId": "10955", "type": "Workload", "category": null, "name": null, "eligibleForRouting": null, "start": "2020-02-12T15:06:16.000Z", "status": null, "duration": 12000, "reason": null, "interaction": null, "channel": null, "workload": { "calls": 1, "semiLive": 0, "nonLive": 0 } }, { "agentId": "10955", "type": "Interaction", "category": "Ringing", "name": null, "eligibleForRouting": null, "start": "2020-02-12T15:06:16.000Z", "status": "Completed", "duration": 3000, "reason": null, "interaction": { "guid": "0148e4d3-684f-b8b7-e2ba-9014639797f1", "medium": "Phone", "mediumManager": "CC", "direction": "Inbound" }, "channel": { "guid": null }, "workload": null }, { "agentId": "10955", "type": "Interaction", "category": "Connected", "name": null, "eligibleForRouting": null, "start": "2020-02-12T15:06:19.000Z", "status": "Completed", "duration": 6000, "reason": null, "interaction": { "guid": "0148e4d3-684f-b8b7-e2ba-9014639797f1", "medium": "Phone", "mediumManager": "CC", "direction": "Inbound" }, "channel": { "guid": null }, "workload": null }, { "agentId": "10955", "type": "Interaction", "category": "Wrap", "name": null, "eligibleForRouting": null, "start": "2020-02-12T15:06:25.000Z", "status": "Completed", "duration": 3000, "reason": null, "interaction": { "guid": "0148e4d3-684f-b8b7-e2ba-9014639797f1", "medium": "Phone", "mediumManager": "CC", "direction": "Inbound" }, "channel": { "guid": null }, "workload": null }] }
The only parameter that GET /agent-activities
 does not return is groupId
. Use the User Admin API to get group data for users (agents).
GET v0/{accountKey}/statistics/outboundcalls (RETIRED)
The GET /outboundcalls
 endpoint returned the following response:
{ "count": 1, "calls": [ { "callGuid": "017118a8-d22f-a346-0cc7-292a629ebc5c", "callStartedAt": "2020-03-26T21:04:33Z", "state": "Make Call State: Connect", "agentId": "1", "destination": "441256636451", "ringDuration": "00:00:04", "duration": "00:00:09" } ] }
Insights Stats endpoints GET /interactions
 return all of the same data plus much more. The following response shows data for the same outbound interaction:
{ "status": "Completed", "medium": "Phone", "mediumManager": "CC", "start": "2020-03-26T21:04:11.710Z", "guid": "017118a8-d22f-a346-0cc7-292a629ebc5c", "conversationGuid": "a6dcf0a9-31be-4876-9b49-74b01569ae84", "duration": 22266, "direction": "Outbound", "serviceName": null, "connectTo": "441256636451", "connectFrom": "02034631288", "interactionPlanMapping": { "addressName": null, "mappingName": null, "interactionPlanName": null }, "channels": [ { "guid": "017118a8-d22f-a346-0cc7-292a629ebc5c", "offset": 0, "duration": 22266, "endReason": "Released", "party": { "id": "1", "role": "Agent", "touchpoint": "07970303957" }, "events": [ { "type": "Ringing", "offset": 0, "name": null, "duration": 6958, "properties": null }, { "type": "Connected", "offset": 6958, "name": null, "duration": 13300, "properties": null }, { "type": "CallRecording", "offset": 10481, "name": null, "duration": 9777, "properties": null }, { "type": "Wrap", "offset": 20258, "name": null, "duration": 2008, "properties": null } ] }, { "guid": "b43c5dbe-562f-485a-942c-312813cb8595", "offset": 6980, "duration": 13478, "endReason": "Released", "party": { "id": null, "role": "External", "touchpoint": "441256636451" }, "events": [ { "type": "Ringing", "offset": 6980, "name": null, "duration": 3489, "properties": null }, { "type": "Connected", "offset": 10469, "name": null, "duration": 9989, "properties": null }, { "type": "CallRecording", "offset": 10481, "name": null, "duration": 9977, "properties": null } ] } ] }
GET v0/{accountKey}/statistics/inboundcalls (RETIRED)
The GET /inboundcalls
 endpoint returned the following response:
{ "count": 14, "calls": [ { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:25:08Z", "sequence": 10, "appletName": "Line 88 UCD", "event": "ACDDelivery", "state": "Transfer State: Connected", "ringDuration": "00:00:06", "duration": "00:00:09", "additionalParameters": { "agent Id": "1", "group Id": "", "agent Phone": "07970303957" } }, { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:25:18Z", "sequence": 11, "appletName": "Line 88 UCD", "event": "End", "state": "Caller", "duration": "00:00:42" }, { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:24:37Z", "sequence": 1, "appletName": "Welcome", "event": "NewApplet", "state": "", "ringDuration": "00:00:00", "duration": "00:00:00", "additionalParameters": { "applet Type": "Announcement" } }, { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:24:37Z", "sequence": 2, "appletName": "Start Recording", "event": "NewApplet", "state": "", "ringDuration": "00:00:00", "duration": "00:00:00", "additionalParameters": { "applet Type": "CallRecording" } }, { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:24:40Z", "sequence": 3, "appletName": "Menu", "event": "NewApplet", "state": "", "ringDuration": "00:00:00", "duration": "00:00:00", "additionalParameters": { "applet Type": "Menu" } }, { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:24:48Z", "sequence": 4, "appletName": "set optional skill", "event": "NewApplet", "state": "", "ringDuration": "00:00:00", "duration": "00:00:00", "additionalParameters": { "applet Type": "SkillTagger" } }, { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:24:48Z", "sequence": 5, "appletName": "Create Data Sources", "event": "NewApplet", "state": "", "ringDuration": "00:00:00", "duration": "00:00:00", "additionalParameters": { "applet Type": "SetDataSource" } }, { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:24:48Z", "sequence": 6, "appletName": "Set Customer Name", "event": "NewApplet", "state": "", "ringDuration": "00:00:00", "duration": "00:00:00", "additionalParameters": { "applet Type": "DataRetriever" } }, { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:24:49Z", "sequence": 7, "appletName": "Lookup Package", "event": "NewApplet", "state": "", "ringDuration": "00:00:00", "duration": "00:00:00", "additionalParameters": { "applet Type": "DataRetriever" } }, { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:24:49Z", "sequence": 8, "appletName": "Company", "event": "NewApplet", "state": "", "ringDuration": "00:00:00", "duration": "00:00:00", "additionalParameters": { "applet Type": "DataRetriever" } }, { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:24:50Z", "sequence": 9, "appletName": "Full name", "event": "NewApplet", "state": "", "ringDuration": "00:00:00", "duration": "00:00:00", "additionalParameters": { "applet Type": "SetDataSource" } }, { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:24:50Z", "sequence": 10, "appletName": "Line 88 UCD", "event": "NewApplet", "state": "", "ringDuration": "00:00:00", "duration": "00:00:00", "additionalParameters": { "applet Type": "ACD" } }, { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:24:51Z", "sequence": 10, "appletName": "Line 88 UCD", "event": "Queue", "state": "Queue State: Success", "duration": "00:00:12", "additionalParameters": { "queue Reason": "ACD", "iteration": "" } }, { "connectedTo": "02034631288", "serviceName": "Line 88", "callGuid": "0171151a-c889-4656-b227-28e0266bbb66", "origin": "01256636451", "stateChangedAt": "2020-03-26T21:24:37Z", "sequence": 0, "appletName": "Welcome", "event": "Start", "state": "" } ] }
Insights Stats endpoints GET /interactions
 return all of the same data plus much more. The following example shows the same inbound interaction’s data:
{ "status": "Completed", "medium": "Phone", "mediumManager": "CC", "start": "2020-03-26T21:24:36.564Z", "guid": "0171151a-c889-4656-b227-28e0266bbb66", "conversationGuid": "d5cf732b-a95f-4ac9-be50-f103297b98fa", "duration": 51790, "direction": "Inbound", "serviceName": "Line 88", "connectTo": "02034631288", "connectFrom": "01256636451", "interactionPlanMapping": { "addressName": "Line 88", "mappingName": "02034631288 - Line 88", "interactionPlanName": "02034631288 - Line 88" }, "channels": [ { "guid": "0171151a-c889-4656-b227-28e0266bbb66", "offset": 0, "duration": 42500, "endReason": "Released", "party": { "id": null, "role": "External", "touchpoint": "01256636451" }, "events": [ { "type": "Ringing", "offset": 0, "name": null, "duration": 0, "properties": null }, { "type": "Connected", "offset": 0, "name": null, "duration": 42500, "properties": null }, { "type": "InteractionPlan", "offset": 407, "name": "02034631288 - Line 88", "duration": 42093, "properties": { "reportingGroup": "Line 88" } }, { "type": "Applet", "offset": 465, "name": "Welcome", "duration": 0, "properties": { "appletType": "Announcement" } }, { "type": "Applet", "offset": 526, "name": "Start Recording", "duration": 0, "properties": { "appletType": "CallRecording" } }, { "type": "CallRecording", "offset": 555, "name": null, "duration": 41945, "properties": null }, { "type": "Applet", "offset": 3880, "name": "Menu", "duration": 0, "properties": { "appletType": "Menu" } }, { "type": "Applet", "offset": 11040, "name": "set optional skill", "duration": 0, "properties": { "appletType": "SkillTagger" } }, { "type": "Applet", "offset": 11304, "name": "Create Data Sources", "duration": 0, "properties": { "appletType": "SetDataSource" } }, { "type": "DataSourceValueAcquired", "offset": 11353, "name": "Full name", "duration": 0, "properties": { "value": "Unknown" } }, { "type": "DataSourceValueAcquired", "offset": 11498, "name": "Company", "duration": 0, "properties": { "value": "Unknown" } }, { "type": "DataSourceValueAcquired", "offset": 11505, "name": "ARR", "duration": 0, "properties": { "value": "a1958fab-8bdd-4bf8-5b85-469aa5b92dbf" } }, { "type": "DataSourceValueAcquired", "offset": 11511, "name": "City", "duration": 0, "properties": { "value": "Unknown" } }, { "type": "Applet", "offset": 11649, "name": "Set Customer Name", "duration": 0, "properties": { "appletType": "DataRetriever" } }, { "type": "DataSourceValueAcquired", "offset": 12178, "name": "First name", "duration": 0, "properties": { "value": "2ac872a5-7d8a-425d-6284-0f600be30e89" } }, { "type": "Applet", "offset": 12238, "name": "Lookup Package", "duration": 0, "properties": { "appletType": "DataRetriever" } }, { "type": "DataSourceValueAcquired", "offset": 12611, "name": "ARR", "duration": 0, "properties": { "value": "01b7b1dc-28fb-4899-3fae-7156468733bc" } }, { "type": "Applet", "offset": 12698, "name": "Company", "duration": 0, "properties": { "appletType": "DataRetriever" } }, { "type": "DataSourceValueAcquired", "offset": 12971, "name": "Full name", "duration": 0, "properties": { "value": "5f4fda83-c7a1-49e3-d5b3-2cd17bac079e" } }, { "type": "DataSourceValueAcquired", "offset": 12976, "name": "Company", "duration": 0, "properties": { "value": "fc9c27ef-a37b-4aa7-b3a4-750b52925679" } }, { "type": "DataSourceValueAcquired", "offset": 12981, "name": "City", "duration": 0, "properties": { "value": "e4262e0e-f65e-496b-93b6-2180700fca8f" } }, { "type": "Applet", "offset": 13066, "name": "Full name", "duration": 0, "properties": { "appletType": "SetDataSource" } }, { "type": "DataSourceValueAcquired", "offset": 13097, "name": "ARR", "duration": 0, "properties": { "value": "$" } }, { "type": "Applet", "offset": 13476, "name": "Line 88 UCD", "duration": 0, "properties": { "appletType": "ACD" } }, { "type": "Queue", "offset": 13744, "name": "Line 88 UCD", "duration": 18253, "properties": { "interactionPlan": "02034631288", "virtualQueues": [ "Broadcast" ], "presentedSkills": [ "Optional" ], "result": "Delivered" } } ] }, { "guid": "41c7da79-cc7c-45b6-b4ff-a72736d7510e", "offset": 26364, "duration": 25426, "endReason": "Released", "party": { "id": "1", "role": "Agent", "touchpoint": "07970303957" }, "events": [ { "type": "Ringing", "offset": 26364, "name": null, "duration": 5633, "properties": null }, { "type": "CallRecording", "offset": 26364, "name": null, "duration": 14508, "properties": null }, { "type": "Connected", "offset": 31997, "name": null, "duration": 8875, "properties": null }, { "type": "Wrap", "offset": 40872, "name": null, "duration": 10918, "properties": null } ] } ] }
Authentication
Authentication for using the Insights Stats API is different from V0 - Authentication API. The new method of authentication is detailed within How to authenticate with a Vonage Contact Center (VCC) API.