Menu

Referência da API · CRM

Análises

crm · analytics · 2 operações

GET/v1/crm/analytics/summary

Get one section of the CRM performance overview

crm.analytics.summary

LeituraIdempotenteDesde 2026-11-01

Returns one section of the CRM performance overview for a date range (start/end in epoch ms): kpis (open pipeline value and count, won revenue and count, lost and created counts, win rate, average deal value and cycle, rotting deals, and what became of the deals created in the range; every amount in one currency, each deal converted with the rate of its close date, with the sums per original currency next to it), velocity (average days the open deals have sat in each stage), funnel (cohort conversion of the deals created in the range through the stages, optionally broken down by outcome, owner or source), activity (calls, emails, meetings, tasks, notes, WhatsApp and other per UTC day) or leaderboard (won revenue in one currency, deals won and activities per owner, with the name the CRM team shows). velocity and funnel need a pipeline_id; a pipeline_id that does not exist answers pipeline_not_found in every section. The funnel breakdown comes as segments (label → count) and segment_list (with the owner's user id). The filters mirror the Performance toolbar (owners, labels, stages, value range, creation dates, activity types, deals that entered a stage). Members without view_all_performance only get their own numbers. Heavy read: a section scans up to 30,000 deals or activities per dataset; truncated: true means partial numbers. crm.pipelines.stage_counts is not a cheap substitute: it counts every deal that points at a stage whatever its state (won, lost, archived, merged away), so for live numbers use kpis or funnel here.

Instruções para agentes

Call it once per section you need. If truncated is true, say the numbers are partial. Won and lost counts are anchored to the deals' won_at/lost_at; open deals are a current snapshot, not limited by the range.

Escopo
crm:read
Permissão
Ver o módulo · Ação do CRM: view_performance
Tool do MCP
crm_analytics_summaryNa superfície completa; na compacta, mb_execute_operation com id: "crm.analytics.summary".

Custo declarado: até 120004 leituras e 0 escritas por chamada (contam na cota diária).

Parâmetros

startintegerqueryobrigatório

Start of the date range, epoch ms (UTC).

endintegerqueryobrigatório

End of the date range, epoch ms (UTC), not before start.

sectionenumqueryopcional

Which block of the Performance screen to compute (one per call): kpis (default), velocity, funnel, activity or leaderboard. velocity and funnel need pipeline_id.

Valores: kpis, velocity, funnel, activity, leaderboard · Padrão: "kpis"

pipeline_idstringqueryopcional

Only the deals of this pipeline (Pipeline id from crm.pipelines.list.); a pipeline that does not exist answers pipeline_not_found.

owner_idstringqueryopcional

Only the records of this owner: a user_id from crm.team.list.

owner_idsarray<string>queryopcional

Only the records of these owners (user_ids from crm.team.list), up to 100.

created_fromintegerqueryopcional

Only deals created from this moment, epoch ms.

created_tointegerqueryopcional

Only deals created up to this moment, epoch ms.

label_idsarray<string>queryopcional

Only deals with any of these labels (ids from crm.labels.list), up to 100.

value_minnumberqueryopcional

Only deals worth at least this, in each deal's own currency.

value_maxnumberqueryopcional

Only deals worth at most this, in each deal's own currency.

stage_idsarray<string>queryopcional

Only deals in these stages (ids from crm.pipelines.get), up to 100.

activity_typesarray<enum>queryopcional

activity section: only these activity types (call, email, meeting, note, task, whatsapp, file, custom).

Valores: call, email, meeting, note, task, whatsapp, file, custom

activity_completed_onlybooleanqueryopcional

activity section: count only completed activities.

entered_stage_idstringqueryopcional

Only deals that entered this stage (a stage id of the pipeline) during the range.

funnel_breakdownenumqueryopcional

funnel section: split each stage by none (default), outcome (open, won, lost), owner or source channel; see segment_list.

Valores: none, outcome, owner, source

Resposta

Um objeto JSON em snake_case.

Erros

Exemplo

curl "https://api.mb-suite.com/v1/crm/analytics/summary?start=0&end=0" \
  -H "Authorization: Bearer $MB_API_KEY"

Testar com a sua API key de teste

Com uma API key de teste o pedido vai sempre para a sua organização de prática: dados de exemplo que você pode reiniciar.

curl "https://api.mb-suite.com/v1/crm/analytics/summary?start=0&end=0" \
  -H "Authorization: Bearer $MB_TEST_KEY"
POST/v1/crm/analytics/pivot

Run a CRM report (group by dimensions, compute metrics)

crm.analytics.pivot

LeituraIdempotenteDesde 2026-11-01

Runs the CRM report engine behind CRM reports, the Explorer and the dashboard widgets: groups deals, activities, outbound human WhatsApp messages and prospects (leads) of a date range by up to 4 dimensions (date, month, pipeline, stage, owner, source, lead_source, country, status, activity_type, label, product_line, attr.<attribution field> such as attr.campaignName, custom.<custom field slug>) and computes up to 10 metrics (deals_count, open_count, won_count, lost_count, total_value, won_value, weighted_value, avg_value, min_value, max_value, mrr_total, quotes_count, win_rate, avg_cycle_days, activities_count, activities_completed_count, calls_count, calls_completed_count, meetings_count, emails_sent_count, notes_count, tasks_completed_count, whatsapp_sent_count, calls_unique_count, whatsapp_unique_count, deals_activity_done_14d/30d, deals_no_activity_14d/30d, leads_count, leads_attributed). Money metrics come in currency (the organization's reporting currency: each deal converted before aggregating). Optional filters (field, operator, value), a column_dimension for a cross-tab (its cells are keyed c<index>.<metric>, the index of pivot_columns) and date_field (created_at, won_at, lost_at, closed_at or stage_moved_at) for metrics without their own date anchor. Row values are what the table shows: status as Abierto, Ganado or Perdido, and the names of pipelines, stages, owners and lead sources (label gives the label id); dimension_value_ids maps each of them to its id or code. A filter on owner, stage, pipeline or lead_source takes the id or the name; on status and source, the code or the label. Ad-spend metrics (ad_spend, cpl, cac, cost_per_deal, roas_crm…) are not available here. Members without view_all_performance only count their own records. Heavy read (up to 30,000 docs per dataset); at most 1,000 rows (sorted by the first metric, except in a cross-tab), with rows_total and rows_truncated. Use crm.attribution.facets first to know which attr.* values exist. With Google Ads, LinkedIn or TikTok, their terms limit it through the API and the MCP: what they do not allow answers 403 platform_terms_restricted (the permissions guide lists what each platform allows).

Instruções para agentes

Totals are the true numbers: with multi-valued dimensions (label, product_line) a deal can appear in several rows but counts once in totals. If truncated or rows_truncated is true, say the result is partial.

Escopo
crm:read
Permissão
Ver o módulo · Ação do CRM: view_performance
Tool do MCP
crm_analytics_pivotNa superfície completa; na compacta, mb_execute_operation com id: "crm.analytics.pivot".

Custo declarado: até 150503 leituras e 0 escritas por chamada (contam na cota diária).

Parâmetros

startintegercorpoobrigatório

Start of the date range, epoch ms (UTC).

endintegercorpoobrigatório

End of the date range, epoch ms (UTC), not before start.

metricsarray<string>corpoobrigatório

1 to 10 metric ids (the list is in the description).

dimensionsarray<string>corpoopcional

Up to 4 row dimensions: date, month, pipeline, stage, owner, source, lead_source, country, status, activity_type, label, product_line, attr.<field> (see crm.attribution.facets) or custom.<slug>. Empty: one row with the totals.

Padrão: []

filtersarray<object>corpoopcional

Up to 20 filters, all of them must match.

date_fieldenumcorpoopcional

Which deal date the range applies to for metrics without their own date: created_at (default), won_at, lost_at, closed_at or stage_moved_at. Won and lost metrics always use their own date. The earlier spellings (createdAt, wonAt…) are still accepted.

Valores: created_at, won_at, lost_at, closed_at, stage_moved_at, createdAt, wonAt, lostAt, closedAt, stageMovedAt

column_dimensionstringcorpoopcional

A dimension taken to the columns (cross-tab, up to 50 columns): each row then has one cell per column and metric, keyed c<index>.<metric> with the index of pivot_columns.

Resposta

rowsarray<object>
columnsarray<object>
totalsobject
rows_totalnumber
pivot_columnsarray<object>

The values of column_dimension in a cross-tab.

pivot_metricsarray<object>
column_totalsobject
rows_truncatedboolean
truncatedboolean
truncated_datasetsarray<string>
currencystring

Currency of the money metrics (total_value, won_value, weighted_value, avg/min/max_value, mrr_total): the organization's reporting currency; each deal is converted to it before aggregating.

fx_unconvertedarray<object>

Currencies without an exchange rate: their deals are left out of the amounts (currencies are never mixed in a sum).

dimension_value_idsobject

For the dimensions grouped by a name (pipeline, stage, owner, lead_source) or a label (status, source, activity_type): dimension → the value shown in rows (or pivot_columns) → its id or code (null when two ids share that name). Only the values of this response.

Erros

Exemplo

curl -X POST "https://api.mb-suite.com/v1/crm/analytics/pivot" \
  -H "Authorization: Bearer $MB_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "start": 0,
  "end": 0,
  "metrics": [
    "METRIC"
  ]
}'

Testar com a sua API key de teste

Com uma API key de teste o pedido vai sempre para a sua organização de prática: dados de exemplo que você pode reiniciar.

curl -X POST "https://api.mb-suite.com/v1/crm/analytics/pivot" \
  -H "Authorization: Bearer $MB_TEST_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "start": 0,
  "end": 0,
  "metrics": [
    "METRIC"
  ]
}'