Metrics
Reference for the relatorios/resumo route: conversation and message volumes, average times counted within business hours, satisfaction and figures per department and per agent, over a free period of up to one year. Each metric is explained with its exact calculation rule.
Overview
The metrics route delivers, in a single call, a snapshot of customer service over a period: how many service requests were opened and closed, how many the AI resolved on its own, how long the customer waited for the first reply and in the queue, how long each service request lasted and how the customer rated it. Times follow the same rules as the Reports screen: they count business hours only and exclude time spent waiting for the customer's reply.
Typical cases:
- BI and management dashboards: feed Power BI, Metabase, Grafana or a spreadsheet with the daily, weekly or monthly series.
- Month-end closing: export the figures per department and per agent for the board report or for variable pay.
- Target tracking: check every day whether the average first reply is within the agreed target.
| Route | Method | Key permission |
|---|---|---|
relatorios/resumo | GET (or POST) | Metrics |
The Metrics permission ("Volumes, business-hours times, satisfaction and figures per department and agent") is checked on the key, in Integrations, ChatISP API card. It gives access to aggregated numbers only: agent and department names appear, but no messages or customer data.
The call
/api_publica.php?r=relatorios/resumo| Parameter | Type | Description |
|---|---|---|
de | date | Start of the period. Default: 00:00 of 29 days ago (with the default ate, the last 30 days including today). |
ate | date | End of the period. Default: today, 23:59:59. A date without a time runs until 23:59:59 of that day. |
departamento_id | integer | Restricts all figures to one department (see Department filter). Without it, or with 0, the whole company. |
The maximum period is 366 days. Dates accept ISO 8601 (2026-09-01T00:00:00-03:00), YYYY-MM-DD or YYYY-MM-DD HH:MM:SS in the server's time zone.
curl -s -G "https://atendimento.seuprovedor.com.br/api_publica.php" \ -H "Authorization: Bearer $CHATISP_CHAVE" \ --data-urlencode "r=relatorios/resumo" \ --data-urlencode "de=2026-09-01" \ --data-urlencode "ate=2026-09-30"
<?php
$url = 'https://atendimento.seuprovedor.com.br/api_publica.php?' . http_build_query([
'r' => 'relatorios/resumo',
'de' => '2026-09-01',
'ate' => '2026-09-30',
]);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('CHATISP_CHAVE')],
]);
$resposta = json_decode(curl_exec($ch), true);import os, requests
resposta = requests.get(
"https://atendimento.seuprovedor.com.br/api_publica.php",
params={"r": "relatorios/resumo", "de": "2026-09-01", "ate": "2026-09-30"},
headers={"Authorization": "Bearer " + os.environ["CHATISP_CHAVE"]},
timeout=30,
).json(){
"ok": true,
"periodo": {"de": "2026-09-01T00:00:00-03:00", "ate": "2026-09-30T23:59:59-03:00"},
"departamento_id": null,
"conversas": {
"abertas": 2184,
"encerradas": 2161,
"em_andamento_agora": 37,
"resolvidas_pela_ia": 912
},
"mensagens": {
"recebidas": 25390,
"enviadas": 27713,
"pela_ia": 11240,
"pelos_atendentes": 12988
},
"tempos": {
"primeira_resposta_media_seg": 41.7,
"espera_fila_media_seg": 318.2,
"duracao_media_seg": 1146.9
},
"satisfacao": {
"pesquisas_enviadas": 1240,
"respostas": 433,
"media": 4.62
},
"por_departamento": [
{"departamento_id": 3, "departamento": "Suporte técnico", "abertas": 1402, "encerradas": 1381},
{"departamento_id": 2, "departamento": "Financeiro", "abertas": 611, "encerradas": 609},
{"departamento_id": 1, "departamento": "Comercial", "abertas": 171, "encerradas": 168}
],
"por_atendente": [
{
"atendente_id": 7,
"atendente": "Carlos Lima",
"atendidas": 402,
"encerradas": 398,
"duracao_media_seg": 1310.4,
"satisfacao_media": 4.71,
"avaliacoes": 151
},
{
"atendente_id": 4,
"atendente": "Paula Andrade",
"atendidas": 377,
"encerradas": 377,
"duracao_media_seg": 1022.0,
"satisfacao_media": 4.55,
"avaliacoes": 138
}
]
}Times are in seconds, with one decimal place. When there is no sample in the period (no conversation replied to, none closed), the time comes as null, not zero: treat null as "no data" in your dashboard.
Conversations block
| Field | How it is counted |
|---|---|
abertas | Service requests (protocols) opened within the period, in any state today. Includes the notice conversations that are created already closed (sent through the API or a campaign to someone who had no open conversation). |
encerradas | Service requests closed within the period, no matter when they were opened (notice conversations included). |
em_andamento_agora | Service requests not closed at the time of the call (with the AI, in a flow, in the queue or with an agent). It does not depend on the period: it is a snapshot of right now. |
resolvidas_pela_ia | Closed in the period, ended without an agent and had at least one AI message. This is the volume the AI resolved without anyone on the team taking over. |
For the AI resolution rate, divide resolvidas_pela_ia by encerradas.
Messages block
Messages created within the period. The team's internal notes are not included in any figure.
| Field | How it is counted |
|---|---|
recebidas | Messages sent by customers. |
enviadas | Everything sent by the ISP: AI, agents, flows, automatic messages, campaigns and messages sent through the API. |
pela_ia | Sent by the AI. |
pelos_atendentes | Sent by people on the team. |
The difference between enviadas and the sum of pela_ia and pelos_atendentes is the automatic volume (flows, notices, campaigns, integrations).
Times block
Business hours
The three times count only what falls within business hours: the schedule of the conversation's department applies when it has one; otherwise, the general schedule. Overnight, a closed lunch break and weekends are not counted. With no schedule configured, the clock runs 24 hours. Example: with business hours from 08:00 to 18:00, a customer who writes at 19:50 and is served at 08:05 the next day counts as 5 minutes of waiting, not 12 hours. The full rule is in Times within business hours.
| Field | From what to what | Which service requests are included |
|---|---|---|
primeira_resposta_media_seg | From the customer's first message to the company's first reply, whether from the AI or an agent. | Opened in the period, with a customer message and a reply within the period. Service requests with no reply are not included. Automatic flow messages and notices do not count as a reply. |
espera_fila_media_seg | From the opening of the service request to the first time a person took over the conversation or automatic distribution handed it to someone. | Opened in the period that were taken over or distributed within the period. Conversations resolved by the AI alone are not included. |
duracao_media_seg | From opening to closing, excluding the periods in which the conversation was marked as waiting for the customer's reply. | Closed in the period. |
Waiting for reply excluded
When the agent marks the conversation as waiting for the customer's reply (for example, "restart the router and let me know"), the time until the customer comes back does not weigh on the service request's duration. Each waiting interval is excluded, also only for the part that falls within business hours. A wait still open at closing is excluded up to the closing.
The times measure customer service, not wall-clock time. To check a specific conversation, the CSV export of the Reports screen includes the business-hours duration of each closed conversation, with the same rules.
Satisfaction block
It comes from the satisfaction survey sent at the end of the service request (when turned on in Settings), with a score from 1 to 5. See Satisfaction survey.
| Field | How it is counted |
|---|---|
pesquisas_enviadas | Surveys sent within the period. |
respostas | Of those, how many the customer answered with a score. |
media | Average score of those answers, with two decimal places; null with no answers. |
Response rate: respostas divided by pesquisas_enviadas.
Per department
por_departamento lists the departments that had service requests opened in the period, from highest to lowest volume. A department with no service requests in the period does not appear.
| Field | Description |
|---|---|
departamento_id / departamento | Department identification. |
abertas | Service requests opened in the period that are currently in this department. |
encerradas | Of those same service requests, how many are already closed. |
Here encerradas differs from the conversas block: it counts the service requests opened in the period that have already been closed (the period's cohort), while conversas.encerradas counts everything that closed in the period, including what was opened earlier. That is why the per-department sums do not match the overall total.
The department considered is the conversation's current one: a service request that started in Sales and was transferred to Support counts in Support.
Per agent
por_atendente lists the people who are assigned to service requests opened in the period, from whoever handled the most to whoever handled the least.
| Field | How it is counted |
|---|---|
atendente_id / atendente | Identification of the person. |
atendidas | Service requests opened in the period for which they are the current assignee. |
encerradas | Of those, how many are already closed. |
duracao_media_seg | Average duration, within business hours and excluding waiting for reply, of their service requests closed in the period. null if there are none. |
satisfacao_media | Average of the survey scores attributed to them and answered in the period; null if there are none. |
avaliacoes | How many scores they received in the period. |
The service request counts for the current assignee. If the conversation was transferred from one person to another, it counts only for whoever ended up with it.
Department filter
With departamento_id, all figures consider only that department: conversations, messages, times, the per-department list (which ends up with a single row) and the per-agent volumes and durations consider the service requests currently in the department; satisfaction (overall and per agent) uses the department recorded in the survey.
To build a table with all departments side by side, call once without a filter (the company total) and once per department, with the ids from departamentos/listar. The Export monthly metrics recipe does this.
Best practices
- Close complete periods. For the historical series, query days, weeks or months that have already ended and store the result in your BI. The current month changes with every service request.
- Prefer several short calls to one long one. A whole year is accepted, but a monthly series (12 calls) gives more information and each call is lighter.
- Do not poll in a tight loop. The figures are calculated on the fly; one query every 5 or 15 minutes is enough for a live dashboard. Respect the key's quota (
X-RateLimit-Remaining). - Time zone. Dates without a time zone are read in the server's time zone (see
servidor.fuso_horarioin chave/info). When building the period from another time zone, send the date in ISO 8601 with an explicit time zone. - Averages of averages. To combine periods, do not average the averages: weight them by volume (for example,
duracao_media_segtimesencerradas).
Errors
In addition to the errors common to the whole API, described in Errors:
error | HTTP | Cause |
|---|---|---|
permissao | 403 | The key does not have the Metrics permission (escopo equal to relatorios). |
periodo_invalido | 400 | ate before de, or a period longer than 366 days (the response includes maximo_dias). |
data_invalida | 400 | de or ate could not be read (see campo). |
parametro_invalido | 400 | departamento_id that is not an integer. |
{"ok": false, "error": "periodo_invalido", "maximo_dias": 366}