WASync Reports API
Aggregates for BI tools (Looker Studio, Power BI, spreadsheets) — the same numbers as the Reports page in the app.
Aggregates for BI tools (Looker Studio, Power BI, spreadsheets) — the same numbers as the Reports page in the app.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/wasync-app:wasync-app-reports-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: WASync WhatsApp Platform Reports API
version: 1.0.0
description: 'Send and receive WhatsApp from your app or AI agent — beyond Bitrix24.
The same WhatsApp connections WASync runs inside Bitrix24 CRM are exposed here as a REST API (and a remote MCP server at `https://cloudapi.wasync.app/api/mcp`).
**Auth — start with an API key.** Create one at https://developers.wasync.app/keys and send it as `Authorization: Bearer wsk_live_…`. That is the whole setup for a partner automating their OWN account: no redirect URI, no PKCE, no consent screen, no token refresh. Keys carry scopes and an optional IP allowlist, and are revocable from the same page.
**OAuth 2.0 is the other path**, for an app that OTHER WASync customers install: Authorization Code with **PKCE (S256 required)**, token endpoint `client_secret_post`, discovery at `https://cloudapi.wasync.app/.well-known/oauth-authorization-server`. Use it when a third party must consent to connections they own; use a key otherwise. Both credential types are accepted on every endpoint in this spec, in the same `Authorization: Bearer` header.
**Access gate:** only connections with an active licence / per-connection API add-on are visible and sendable. Pricing and activation: https://developers.wasync.app/billing
**Base URL.** The canonical host is `https://developers.wasync.app/api/v1`. The older `https://cloudapi.wasync.app/api/v1` is a permanent alias for the same API and remains valid indefinitely — existing integrations pointed at it need no change. (The OAuth endpoints, the `/.well-known/…` discovery documents and the MCP server URL are protocol identifiers already registered by clients: they stay on `cloudapi.wasync.app` and are unchanged.)
**Provisioning:** `POST /connections` (create + initial QR) → `GET /connections/{id}` (poll status/QR) → `POST /connections/{id}/pairing-code` (an 8-character code the customer types into WhatsApp instead of scanning — for the very common case where the phone running WhatsApp is the same device your flow is open on; **a code is not always available, so keep the QR flow as a fallback**) → `POST /connections/{id}/restart` (re-pair a broken session) → `POST /connections/{id}/logout` (clear credentials) → `DELETE /connections/{id}` (permanent). With an API key you can create a workspace''s very first connection over the API — nothing has to be clicked in a portal UI first. `GET /account` reports the slot quota before you provision.
**Webhooks:** set your endpoint with `PUT /webhook` and you get a signing secret back; rotate it with `POST /webhook/rotate`. Five event types are delivered: `message.received`, `message.status`, `connection.disconnected`, `connection.connected` and `message.transcribed` (a voice note''s transcript is ready — schema `MessageTranscribedEvent`). The first four fire for **QR/WAPP connections (`provider: qr`) only** — Meta/WABA connections (`provider: cloud_api`) emit no message webhooks today; poll `GET /messages` and `GET /connections/{id}` for those. `message.transcribed` fires on every connection whose portal has voice-note transcription on. An endpoint configured before an event type existed receives it after `PUT /webhook` is called again. Disconnect detection is typically **≤ 5 minutes** (status probe) and can take **~15–20 minutes** on the restart-failure path. Full contract: https://developers.wasync.app/docs/webhooks
Quickstart: https://developers.wasync.app/docs'
contact:
name: WASync Developers
url: https://developers.wasync.app/docs
servers:
- url: https://developers.wasync.app/api/v1
description: Production REST v1 (canonical host)
- url: https://cloudapi.wasync.app/api/v1
description: Production REST v1 — legacy alias. Identical API, kept working indefinitely; existing integrations need no change.
security:
- apiKey: []
- oauth2:
- whatsapp.read
tags:
- name: Reports
description: Aggregates for BI tools (Looker Studio, Power BI, spreadsheets) — the same numbers as the Reports page in the app.
paths:
/reports/agents:
get:
tags:
- Reports
summary: Replies by employee
operationId: getAgentReport
description: 'The Reports page''s "Replies by employee" table as JSON, for agent-occupancy dashboards: replies sent, conversations and median first response per employee, plus one unattributed row. Days are UTC calendar days. Scoped like `GET /messages` (the token''s connections with an active API add-on). Rate limit: 30 requests per minute per API key / OAuth client (429 `rate_limited` + `Retry-After`).'
security:
- apiKey: []
- oauth2:
- whatsapp.read
parameters:
- name: from
in: query
required: false
description: 'First UTC day, `YYYY-MM-DD`. Default: 6 days before today.'
schema:
type: string
format: date
example: '2026-11-01'
- name: to
in: query
required: false
description: 'Last UTC day, `YYYY-MM-DD`, inclusive. Default: today. At most 92 days from `from`.'
schema:
type: string
format: date
example: '2026-11-30'
- name: connectionId
in: query
required: false
description: Limit to one connection (must be inside the grant; otherwise the report is empty).
schema:
type: string
responses:
'200':
description: The report.
content:
application/json:
schema:
$ref: '#/components/schemas/AgentReportResponse'
example:
range:
from: '2026-11-01'
to: '2026-11-30'
totals:
conversations: 212
repliesSent: 540
customerTurns: 388
answeredTurns: 351
medianFirstResponseSec: 290
agents:
- userId: '17'
name: Ana Pop
unattributed: false
repliesSent: 301
conversations: 118
medianFirstResponseSec: 240
- userId: '22'
name: Ion Rusu
unattributed: false
repliesSent: 221
conversations: 90
medianFirstResponseSec: 355
- userId: null
name: null
unattributed: true
repliesSent: 18
conversations: 11
medianFirstResponseSec: 610
attributionSince: '2026-08-14T09:12:00.000Z'
'400':
description: '`invalid_date` (not `YYYY-MM-DD`), `invalid_date_range` (`to` before `from`) or `range_too_large` (more than 92 days).'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
range_too_large:
value:
error: range_too_large
'401':
$ref: '#/components/responses/Unauthorized'
'403':
description: Missing scope (`insufficient_scope`), or the requested `connectionId` has no effective API add-on (`addon_required`).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'429':
description: More than 30 report requests in a minute for this key / client. Honour `Retry-After` (seconds).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
rate_limited:
value:
error: rate_limited
'500':
$ref: '#/components/responses/ServerError'
components:
schemas:
AgentReportRow:
type: object
required:
- userId
- name
- unattributed
- repliesSent
- conversations
- medianFirstResponseSec
properties:
userId:
type:
- string
- 'null'
description: Bitrix24 user id; null on the unattributed row.
example: '17'
name:
type:
- string
- 'null'
example: Ana Pop
unattributed:
type: boolean
description: True on the single row for replies written by a person but not linked to an employee (sent before attribution started, or typed on the phone).
repliesSent:
type: integer
description: Outgoing messages this person wrote in the range (no automated messages, no internal notes, no failed sends; 1:1 chats only).
example: 128
conversations:
type: integer
description: Distinct customers this person replied to in the range.
example: 41
medianFirstResponseSec:
type:
- integer
- 'null'
description: Median seconds from a customer's first unanswered message to this person's reply, over the turns they answered first. Automated replies do not stop the clock. Null when they answered no turn that started in the range.
example: 312
Error:
type: object
required:
- error
description: All errors carry a stable `error` code. On 400 `invalid_request`, the optional `field` and `hint` properties identify the specific failing input. Branch on `error`; treat `field`/`hint` as informational.
properties:
error:
type: string
description: A stable, machine-readable error code. Never branch on human-readable text.
field:
type: string
description: 'On 400 `invalid_request`: the name of the request body field that failed validation (e.g. `connectionId`, `to`, `text`). Additive — present only when the server knows the exact failing field.'
example: connectionId
hint:
type: string
description: 'On 400 `invalid_request`: a short human-readable tip about what to fix. Additive — may be absent.'
example: expected string; did you send `connection` instead of `connectionId`?
AgentReportResponse:
type: object
required:
- range
- totals
- agents
- attributionSince
properties:
range:
type: object
required:
- from
- to
properties:
from:
type: string
format: date
example: '2026-11-01'
to:
type: string
format: date
example: '2026-11-30'
totals:
type: object
required:
- conversations
- repliesSent
- customerTurns
- answeredTurns
- medianFirstResponseSec
properties:
conversations:
type: integer
description: Distinct customers who wrote in the range.
repliesSent:
type: integer
description: All human replies in the range (the sum of `agents[].repliesSent`).
customerTurns:
type: integer
description: Customer turns that started in the range (consecutive customer messages count once).
answeredTurns:
type: integer
description: Of those, turns a person answered.
medianFirstResponseSec:
type:
- integer
- 'null'
agents:
type: array
description: Most replies first; the unattributed row (if any) last.
items:
$ref: '#/components/schemas/AgentReportRow'
attributionSince:
type:
- string
- 'null'
format: date-time
description: When employee attribution started on this account. Replies before it are in the unattributed row.
responses:
Unauthorized:
description: 'Missing or invalid credential. Carries a `WWW-Authenticate: Bearer` challenge.
`invalid_key` — the API key is unknown or has been revoked (create a new one at https://developers.wasync.app/keys).
`invalid_token` — the OAuth access token is expired or malformed (refresh once, then retry).
`invalid_grant` — the OAuth grant was revoked; re-authorize from scratch.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
missing_token:
value:
error: missing_token
invalid_key:
value:
error: invalid_key
invalid_token:
value:
error: invalid_token
ServerError:
description: Unexpected server error.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: server_error
securitySchemes:
apiKey:
type: http
scheme: bearer
bearerFormat: wsk_live_*
description: '**The default way to authenticate.** Create a key at https://developers.wasync.app/keys and send it as `Authorization: Bearer wsk_live_…`.
The key is shown once at creation and stored only as a hash — lose it and you revoke it and create another. Each key carries its own scopes (`whatsapp.read`, `whatsapp.send`, `whatsapp.events`, `whatsapp.manage`) and an optional **IP allowlist**.
Errors: an unknown or revoked key returns **401 `invalid_key`**; a key whose IP allowlist does not cover the calling address returns **403 `ip_not_allowed`** (a distinct code on purpose — the key is fine, the address is not). Both carry a `WWW-Authenticate: Bearer` challenge. Scopes and the connection list are resolved live on every request, so revoking a key or narrowing it takes effect on the next call.'
oauth2:
type: oauth2
description: 'OAuth 2.0 Authorization Code flow — **for apps that other WASync customers install**, where a third party must consent to connections they own. If you are automating your own account, use an API key instead (see `apiKey`).
**PKCE with `S256` is required.** The token endpoint uses **`client_secret_post`** (send `client_id` + `client_secret` + `code_verifier` in the form body). Consent happens either in the connection owner''s Bitrix portal (Settings → "API & Agents": the admin enters the short code shown during authorization and picks the connections + scopes) or, for standalone workspaces, at https://developers.wasync.app/authorize.
`access_token` TTL is 15 minutes; `refresh_token` TTL is 30 days and ROTATES on use — persist the new one atomically and never refresh concurrently.'
flows:
authorizationCode:
authorizationUrl: https://cloudapi.wasync.app/oauth/authorize
tokenUrl: https://cloudapi.wasync.app/oauth/token
refreshUrl: https://cloudapi.wasync.app/oauth/token
scopes:
whatsapp.read: Read connections and messages
whatsapp.send: Send WhatsApp messages (text and media)
whatsapp.events: Receive incoming messages via webhooks
whatsapp.manage: Create, inspect, restart, log out, and delete WhatsApp connections