DM Champ Docs

Analytics & Reports API

These read-only endpoints pull your account’s activity into your own dashboards and reports: message-event counts, credit consumption, AI spend, conversation outcomes and costs, and the same charts and insights the in-app dashboard shows.

All paths are relative to https://api.dmchamp.com/v1, and every request is authenticated (see Authentication). Every parameter and response field is in the API Reference; errors use the standard envelope from Errors & Pagination.


Which endpoint to use

  • Summary: message-volume counters (sent, delivered, read, replied, booked, contacts created, credits), as totals and per day.
  • Credits: a paginated ledger of credit usage with totals and breakdowns. Credit balance is the balance right now.
  • AI cost: a per-day rollup of AI spend.
  • Metric series: a chart-ready time series for one or more metrics, grouped by campaign, channel, AI Agent or number.
  • Conversation outcomes: conversations over time, grouped by the contact tags they carry (the closing tags your agent applies).
  • Conversation costs: the average credit cost of a conversation the AI handled alone versus one your team stepped into.
  • Dashboard insights and Dashboard AI insights: the full data behind the in-app dashboard, including AI-written summaries.
  • Entity activity: one contact’s, deal’s or task’s timeline.
  • Aggregated event counts: a legacy, camelCase form of Summary kept for existing integrations.

Endpoints

Task Method + path Explorer
Message volume summary GET /analytics/summary Open in API Reference
Credit usage ledger GET /analytics/credits Open in API Reference
Credit balance right now GET /users/me/credits Open in API Reference
AI cost rollup GET /analytics/ai-cost Open in API Reference
Metric series GET /analytics/series Open in API Reference
Conversation outcomes GET /analytics/outcomes Open in API Reference
Conversation costs GET /analytics/conversation-costs Open in API Reference
Dashboard insights GET /analytics/dashboard-insights Open in API Reference
Dashboard AI insights GET /analytics/dashboard-ai-insights Open in API Reference
Entity activity timeline GET /analytics/entity-activity Open in API Reference
Aggregated event counts (legacy) GET /analytics/aggregate Open in API Reference

Agencies also have the sub-account rollup, GET /analytics/agency-rollup: Open in API Reference.


Date ranges and scope

  • from / to (YYYY-MM-DD, inclusive, UTC) default to the last 30 days. from must not be after to. The maximum range depends on the endpoint; Summary, Credits and AI cost refuse a wider one with 400, Dashboard insights clamps it:
Endpoint Maximum range
Summary, Credits, AI cost 366 days
Metric series, Conversation outcomes, Agency rollup 92 days
Conversation costs 31 days
Dashboard insights 92 days, clamped, not rejected
  • Dashboard insights, Dashboard AI insights and Aggregated event counts take startDate / endDate instead of from / to, because they share their implementation with the in-app dashboard. Dashboard insights and Dashboard AI insights require both (400 when missing); Aggregated event counts accepts ISO dates or date-times and defaults to the same window as Summary.
  • One scope at a time. Pass at most one of campaign_id (legacy) or agent_id where an endpoint accepts them. Sending both returns 400. An id that is not on your account returns 404 rather than 403, so other accounts’ ids stay unguessable. The dashboard endpoints also accept the camelCase spellings (campaignId, agentId). Dashboard AI insights is account-wide and takes no scope.

Only two endpoints filter by contact tag. tag_ids (with tag_match) is honoured by Dashboard insights and Aggregated event counts, the two the in-app dashboard’s All tags filter uses. Summary, Metric series and Conversation outcomes validate the parameter (a malformed id list still returns 400) but do not apply it: you get account-wide numbers back, with no error to tell you so. Do not read an unfiltered total as a tag-filtered one.

The tag filter (Dashboard insights and Aggregated event counts): tag_ids (or tagIds) is a comma-separated list of up to 25 tag ids. tag_match (or tagMatch) is any (default, the same “match any” rule the Contacts page filter uses) or all; any other value is a 400 when tag_ids is present, and it is ignored without tag_ids. It combines with a campaign or agent scope. Rows with no contact (account-level credit recharges, creditsRecharged) fall out of a tag-scoped view, and on Dashboard insights the conversation_outcomes block comes back null under a tag scope. Dashboard insights returns 400 when the tag filter is not available for the account.


Message volume and credits

The two calls most reports start with:

curl "https://api.dmchamp.com/v1/analytics/summary?from=2026-05-01&to=2026-05-31&apiKey=YOUR_API_KEY"
{
  "success": true,
  "from": "2026-05-01",
  "to": "2026-05-31",
  "totals": { "total": 1240, "sent": 800, "delivered": 760, "read": 540, "replied": 210, "booked": 35, "contact_created": 120, "credits_spent": 412.5, "credits_recharged": 500 },
  "by_date": [ { "date": "2026-05-01", "total": 40, "sent": 25, "…": "…" } ],
  "truncated": false
}
curl "https://api.dmchamp.com/v1/analytics/credits?from=2026-05-01&to=2026-05-31&limit=50&apiKey=YOUR_API_KEY"

Good to know

  • truncated. Summary and Credits cap how many records one request scans. When a busy range hits that cap, the response says "truncated": true and the numbers come from a partial scan: narrow the range (or page through smaller windows) for complete figures.
  • Every day in the range appears in by_date; quiet days are zero-filled.
  • Adjustments are not consumption. Bonuses, plan renewals and corrections are excluded from the Credits totals and breakdowns. They still appear in records, flagged "is_adjustment": true.
  • Totals and breakdowns appear only on the first page (no cursor). On later pages totals, by_reason, by_reason_cost and by_campaign are null and only records continues, so the whole range is not re-scanned per page. Page with next_cursor until it is null.
  • On a credit record, amount is zero for records billed to your own provider API key, and the cost and token fields (cost_usd, the token counts, ai_model, request_id) are filled only on such records. is_test marks playground and test runs, which are never billed.
  • Cost figures are only shown for AI billed to your own provider key. When cost figures are hidden for your account, the response sets "costs_redacted": true and the cost fields come back as zero (call counts stay visible).
  • Credits needs billing access for team members.

Credit balance

GET /users/me/credits is your account’s credit position in one call. Credit usage above is a history; this is the balance right now. Team members need billing access; the account owner’s key always has it.

curl "https://api.dmchamp.com/v1/users/me/credits?apiKey=YOUR_API_KEY"
{ "success": true, "balance": 1837.5, "monthly_credits": 2000, "used_this_month": null, "auto_recharge_enabled": true, "low_credit_threshold": null }

used_this_month is filled only for an allocation (agency sub-) account; for a regular account it is null, so use the Credits ledger above for what was spent. Every field is in the API Reference.

Agencies can pass sub_account_id to read a client account’s balance. Inside an automation, the Check credits step returns the same fields.

AI cost rollup

GET /analytics/ai-cost reads pre-aggregated daily totals, so it is fast even over long ranges; quiet days are zero-filled. byok_usd is spend on your own provider keys, platform_usd the part that ran on the platform, and by_provider splits USD by AI provider. For credit-paying accounts every USD field is zero and costs_redacted is true.


Charts: metric series and outcomes

curl "https://api.dmchamp.com/v1/analytics/series?from=2026-05-01&to=2026-05-31&metrics=sent,replied,booked&group_by=campaign,channel&limit=10&apiKey=YOUR_API_KEY"
{
  "success": true,
  "labels": ["2026-05-01", "2026-05-02"],
  "series": [
    { "key": { "campaign_id": "campaign123", "campaign_name": "Spring Promo", "channel": "whatsapp" }, "total": 812, "metrics": { "sent": [40, 35], "replied": [12, 9], "booked": [2, 1] } }
  ],
  "other_bucket": { "series_count": 6, "total": 340, "metrics": { "sent": [18, 20], "replied": [5, 6], "booked": [0, 1] } },
  "truncated": true
}

How metric series works

  • One call answers “sent and replied per day, per channel, for this agent”. labels is the time axis, zero-filled across the range; each series holds one array per metric aligned to it. Up to two group_by dimensions; date is accepted but has no effect, because every response already carries the time axis. Week buckets start on Monday, month buckets on the 1st.
  • Series past limit are not dropped. They collapse into other_bucket, computed as the range total minus the returned series, so a chart always adds up to your real numbers; truncated is true whenever that happens and other_bucket is null when nothing collapsed.
  • A dimension whose value is unknown for a row (a message with no campaign, an event with no channel) comes back as null in key rather than being dropped.
  • Where the numbers come from. sent, delivered, read and replied come from message records, which carry the channel and sending number. booked, contact_created and credits_spent come from the event stream, which carries no sending number, so those land in the null-number bucket when you group by number.
  • conversations counts conversations (chat sessions) that started in each bucket, and conversation_credits what they cost, counted exactly like Conversation costs. Divide one by the other per bucket for the average cost per conversation over time. When you group or filter, a conversation counts toward the campaign, agent, channel or number its first message belongs to.

How conversation outcomes works

  • GET /analytics/outcomes counts conversations per contact tag per day: the tags your AI Agent applies with its tag tool, auto-tag rules, the API or your team. It is not a per-conversation label. A conversation counts under the tags its contact carries at the time of the request, so a contact with several tags counts once under each, and a tag removed later drops out of past days too.
  • Give your agent one closing tag per outcome (for example resolved_ai, handoff_asked_for_human) and this endpoint returns containment and handoff reasons over time.
  • At most 20 tags are returned, highest volume first. The row with tag and tag_id both null is conversations whose contact carries no tag (totals.unresolved).
  • totals.sessions is distinct conversations started in the range, not the sum of the tag rows. totals.human_alerted counts conversations handed over to a human.
  • group_by=tag collapses the time axis: labels and each tag’s counts are empty, total is still filled. With campaign_id, only contacts currently on that campaign count.

Reporting database unavailable. Metric series, Conversation outcomes, Conversation costs and the agency rollup return 503 with "error_code": "analytics_unavailable" when the reporting database cannot answer for your account, rather than a 200 full of zeros (a zeroed chart would read as fact). Retry shortly.


Conversation costs

What a conversation costs on average over a date range, split by how it went: the number to show a client as return on investment.

curl "https://api.dmchamp.com/v1/analytics/conversation-costs?from=2026-08-26&to=2026-09-24&apiKey=YOUR_API_KEY"
{
  "success": true,
  "sessions": 564,
  "total_credits": 5957,
  "summary": {
    "contained": { "sessions": 503, "credits": 5168, "avg_credits": 10.2744 },
    "handed_off": { "sessions": 50, "credits": 781, "avg_credits": 15.62 },
    "no_ai": { "sessions": 11, "credits": 8, "avg_credits": 0.7273 }
  },
  "sessions_truncated": false
}
  • Counts conversations that started in the range, with the credits charged inside each conversation’s window, refunds subtracted. Credits spent outside any conversation (daily summaries, monthly fees, automations not started by a contact, such as webhook or RSS triggers) are not part of it. Automation runs and AI steps started by a contact count toward that contact’s conversation since September 26, 2026.
  • contained: the AI replied and nobody from your team stepped in. handed_off: someone sent a message after the AI had replied, or the AI alerted a human. no_ai: the AI never replied (for example chats your team handles with the AI paused).
  • At most 20,000 conversations are counted; sessions_truncated is true when the range held more, so narrow it.
  • Team members need billing access. Agency keys can pass sub_account_id to report on a client account.
  • Per contact, the same split is on Get contact cost.

Dashboard insights

GET /analytics/dashboard-insights returns the whole in-app dashboard for a range in one call: a reply-rate heatmap by weekday and hour, the campaign leaderboard, per-channel volume, per-connection totals, per-day metric breakdowns, where contacts are from, inbox response time and a recent activity feed. It is the richest reporting payload on the API.

curl "https://api.dmchamp.com/v1/analytics/dashboard-insights?startDate=2026-05-01&endDate=2026-05-31&apiKey=YOUR_API_KEY"
  • Null means unavailable, not zero. numberStats, channelDailySeries, metricDailyBreakdown, contactsByCountry and ai_human_split come from the reporting database and are each independently null when it cannot answer; every other block still returns. Do not render a null block as an empty chart.
  • heatmap.buckets[].weekday runs from 0 (Sunday) to 6 (Saturday).
  • Under an agent scope, the campaign leaderboard is built from that agent’s activity only.
  • granularity (day, week Monday-based, or month) applies only to metricDailyBreakdown; its labels are then the bucket starts. Every other block is unaffected.

Dashboard AI insights (GET /analytics/dashboard-ai-insights) returns three short, AI-written insights for the range, one win, one thing to watch and one tip, generated from the account’s own message metrics. They are sentences you can paste straight into a report.

Entity activity (GET /analytics/entity-activity?entityType=contact&entityId=…) returns one contact’s, deal’s or task’s activity as a single timeline, newest first, across messages, appointments, notes and status changes. An invalid type or id returns 400; an entity not on your account returns 404, so other accounts’ ids stay unguessable.

Aggregated event counts (GET /analytics/aggregate) returns the same counts as Summary in the camelCase shape (contactCreated, byDate) some older integrations were built against. Prefer Summary for new work.


Agency sub-account rollup

GET /analytics/agency-rollup returns messaging and credit activity for every sub-account on your agency in one request (range totals plus a per-day series each), so a multi-client report no longer means one call per sub-account. It requires the Agency or Dev role (403 otherwise) and takes the same from/to range (capped at 92 days) plus an optional sub_account_id to narrow to one client. A sub_account_id that is not on your agency returns an empty roster rather than an error, so other agencies’ accounts stay unguessable. See API for Agencies for the full agency API picture.


Next steps