Get Call Counter Metrics for a Project - Cognigy Documentation

Get Call Counter Metrics for a Project

Endpoint

GET /v2.0/projects/{projectId}/callcounter

Description

Retrieve call counter metrics for a specified project using the API.

Request Example

cURL

curl --request GET \
  --url https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/callcounter \
  --header 'X-API-Key: <api-key>'

Python

import requests

url = "https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/callcounter"

headers = {"X-API-Key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)

JavaScript Fetch

const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};

fetch('https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/callcounter', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

PHP

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api-trial.cognigy.ai/new/v2.0/projects/{projectId}/callcounter",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "X-API-Key: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Response Codes

Success Response

{
  "items": [
    {
      "calls": 123,
      "duration": 123,
      "concurrentCalls": 123,
      "day": 123,
      "month": 123,
      "year": 123
    }
  ]
}

Error Response Structures

Bad Request

{
  "type": "Bad Request",
  "title": "Bad Request Error",
  "status": 400,
  "detail": "Validation failed. Missing payload.",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1000
}

Unauthorized

{
  "type": "Unauthorized",
  "title": "Unauthorized Error",
  "status": 401,
  "detail": "<string>",
}

... (similar error responses for other statuses) ...

Authorizations

X-API-Key

Headers

Path Parameters

Query Parameters