# Call performance (/api-reference/calls/getCallPerformance)

## GET /api/v1/calls/performance

Operation ID: `getCallPerformance`
Call performance
Totals, connect rate, conversion, outcome and channel split, calls per hour and an agent leaderboard for the last 7, 30 or 90 days, with the range before it for comparison.

### Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `rangeDays` | query | no | Days to cover, ending today: 7, 30 or 90 (any other value means 30). |
| `agentId` | query | no | Only calls of this agent. |
| `channel` | query | no | Only calls of this channel. |
| `includeTests` | query | no | Also count test calls placed from the console. Default false. |

### Responses

#### 200 OK

Example (example):

```json
{
  "byChannel": {
    "bulk": 230,
    "inbound": 50,
    "instant": 140
  },
  "byHour": {
    "10": 64,
    "11": 88,
    "12": 71,
    "15": 90,
    "16": 107
  },
  "byOutcome": {
    "busy": 22,
    "call_failed": 40,
    "callback": 22,
    "interested": 41,
    "no_answer": 160,
    "not_interested": 95,
    "qualified": 40
  },
  "funnel": {
    "calls": 420,
    "connected": 260,
    "qualified": 81
  },
  "includeTests": false,
  "kpis": {
    "avgLengthSeconds": 83.5,
    "calls": 420,
    "connectRate": 0.62,
    "conversion": 0.31,
    "leads": 388,
    "minutesUsed": 512,
    "successRate": 0.58
  },
  "leaderboard": [
    {
      "agentId": "4f6d2c1a-9b7e-4c3d-8a21-5e0f7b9c1d23",
      "calls": 300,
      "connected": 190,
      "minutes": 380,
      "name": "Priya",
      "qualified": 62
    },
    {
      "agentId": "7c2e9a10-3b4d-4e5f-8a6b-9c0d1e2f3a4b",
      "calls": 120,
      "connected": 70,
      "minutes": 132,
      "name": "Arjun",
      "qualified": 19
    }
  ],
  "prior": {
    "calls": 365,
    "connectRate": 0.59,
    "conversion": 0.27
  },
  "rangeDays": 30,
  "recent": {
    "last24h": 26,
    "lastHour": 3,
    "today": 18
  },
  "success": true
}
```

#### 401 Unauthorized: `api_key_expired`, `invalid_api_key`, `unauthenticated`.

Example (The API key has expired.):

```json
{
  "detail": "The API key has expired.",
  "error": {
    "code": "api_key_expired",
    "docUrl": "https://docs.callmitra.ai/errors/api_key_expired",
    "message": "The API key has expired.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "authentication_error"
  }
}
```

Example (The API key is invalid or has been revoked.):

```json
{
  "detail": "The API key is invalid or has been revoked.",
  "error": {
    "code": "invalid_api_key",
    "docUrl": "https://docs.callmitra.ai/errors/invalid_api_key",
    "message": "The API key is invalid or has been revoked.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "authentication_error"
  }
}
```

Example (Authentication required.):

```json
{
  "detail": "Authentication required.",
  "error": {
    "code": "unauthenticated",
    "docUrl": "https://docs.callmitra.ai/errors/unauthenticated",
    "message": "Authentication required.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "authentication_error"
  }
}
```

#### 403 Forbidden: `api_key_scope_denied`, `permission_denied`.

Example (The API key does not have the scope required for this request.):

```json
{
  "detail": "The API key does not have the scope required for this request.",
  "error": {
    "code": "api_key_scope_denied",
    "docUrl": "https://docs.callmitra.ai/errors/api_key_scope_denied",
    "message": "The API key does not have the scope required for this request.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "permission_error"
  }
}
```

Example (You do not have permission to perform this action.):

```json
{
  "detail": "You do not have permission to perform this action.",
  "error": {
    "code": "permission_denied",
    "docUrl": "https://docs.callmitra.ai/errors/permission_denied",
    "message": "You do not have permission to perform this action.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "permission_error"
  }
}
```

#### 422 Invalid parameters: `parameter_invalid`.

Example (One or more parameters are invalid.):

```json
{
  "detail": [
    {
      "loc": [
        "body",
        "phone"
      ],
      "msg": "Field required",
      "type": "missing"
    }
  ],
  "error": {
    "code": "parameter_invalid",
    "docUrl": "https://docs.callmitra.ai/errors/parameter_invalid",
    "message": "One or more parameters are invalid.",
    "param": "phone",
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "invalid_request_error"
  }
}
```

#### 429 Too many requests: `rate_limit_exceeded`.

Example (Too many requests. Slow down and retry later.):

```json
{
  "detail": "Too many requests. Slow down and retry later.",
  "error": {
    "code": "rate_limit_exceeded",
    "docUrl": "https://docs.callmitra.ai/errors/rate_limit_exceeded",
    "message": "Too many requests. Slow down and retry later.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "rate_limit_error"
  }
}
```

#### 500 Server error: `internal_error`.

Example (Something went wrong on our side.):

```json
{
  "detail": "Something went wrong on our side.",
  "error": {
    "code": "internal_error",
    "docUrl": "https://docs.callmitra.ai/errors/internal_error",
    "message": "Something went wrong on our side.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "api_error"
  }
}
```

### Error codes

- [`api_key_expired`](/errors/api_key_expired)
- [`invalid_api_key`](/errors/invalid_api_key)
- [`unauthenticated`](/errors/unauthenticated)
- [`api_key_scope_denied`](/errors/api_key_scope_denied)
- [`permission_denied`](/errors/permission_denied)
- [`parameter_invalid`](/errors/parameter_invalid)
- [`rate_limit_exceeded`](/errors/rate_limit_exceeded)
- [`internal_error`](/errors/internal_error)
