Leads vs Orders through REST API and MCP
Ask the same questions as the Leads vs Orders tab from your own application or an AI assistant: how many leads became customers, how fast, which channel, ad platform and campaign brings the leads that buy, and what a customer from leads costs. Every surface returns the same numbers as the tab, from the same calculation.
Access
The report needs the leads:read scope. The contacts of converted leads (e-mail, phone, name) are returned only when the token also holds lead_contacts:read and your role may see personal data in the workspace; otherwise contact is null and contacts_included is false. Authentication, envelopes, errors and rate limits follow the REST API v1 reference; full schemas are in the OpenAPI document.
Operations
REST answers one section per call: GET /api/v1/workspaces/{workspace_id}/lead-orders/{section}. Each MCP tool answers one section.
| Section | MCP tool | What it answers |
|---|---|---|
kpis | get_lead_order_kpis | kpis (leads, converted leads, lead-to-customer rate with its 95% interval, median and P90 days to order, revenue per lead, first order revenue per customer, spend, cost per customer, comparison and deltas) and coverage (where every lead of the range went). |
cohorts | get_lead_order_cohorts | cohorts (per week or month of the lead date, the share converted within 7, 30, 60, 90 and 180 days) and curve (cumulative conversion by day since the lead). |
timeline | get_lead_order_timeline | Leads and orders from leads per week or month. |
time-to-order | get_lead_order_time_to_order | P50, P90 and a histogram of the days from lead to order. |
channels | get_lead_order_channels | Channel groups with their source / medium rows. |
platforms | get_lead_order_platforms | Ad platforms with spend, CPL, cost per customer, ROAS on leads and the breakeven horizon. |
campaigns | get_lead_order_campaigns | Campaigns, ad sets and ads of one ad_platform (required), the unmatched remainder and the CPL against rate quadrant. Business and Custom plans. |
converted | list_converted_leads | The converted leads, newest first, 50 per page; follow next_cursor (REST: links.next or cursor). An order in a currency without an exchange rate to your reporting currency has amount: null and missing_rates: true on the row and the page, never 0. |
Every answer holds data_as_of (when the lead outcomes were last computed; ages and open windows are measured against it), query (the view as it was resolved) and the section. The section bodies are identical on REST, MCP and the tab.
Parameters
Every section takes the date range and comparison of the shared date picker and the filters of the tab:
range:today,yesterday,this_week,last_week,last_7_days,last_14_days,last_30_days,last_90_days(default),last_180_days,this_month,last_month,max_range,days_to_todayordays_to_yesterdaywithdays. Orfromandto(YYYY-MM-DD, workspace timezone). At most 180 days;last_N_daysis the N full days ending yesterday.compare:previous_period(default;week_earlierfor today and this week),week_earlier,year_earlier(364 days earlier, same weekdays),customwithcompare_from,modelwithcompare_model(first_clickorlast_click, the other attribution basis; Business and Custom plans), ornone.window_days: 7, 30, 60, 90 or 180 (default 30, or 60 when only trial leads are selected).basis:first_touch(default) orlast_touch.categories:inquiry,trial,registration,subscribe(default inquiry and trial; REST: comma-separated).match_basis:all(default) orconfirmed_links;include_existing_customers:trueorfalse(default).revenue_type:gross(default) ornet;revenue_horizon_days: 30, 90 (default) or 180;granularity:week(default) ormonth.
A comparison period counts each lead's orders only up to the age its mirror lead in the current range has, so a young range is compared fairly. Such deltas carry provisional: true and delta_meta.compared_at_days.
Values
- Money is
{"amount", "currency"}in the workspace reporting currency, converted at one rate date (the end of the range). - Rates and shares are fractions from 0 to 1 with 4 decimals; days have one decimal.
nullmeans no data (no leads, no spend import, no comparison data), never a hidden zero.
Example: which ad platform brings leads that buy
curl -H "Authorization: Bearer $TOKEN" \
"https://axitrace.com/api/v1/workspaces/$WORKSPACE/lead-orders/platforms?range=last_90_days&window_days=30"Analytics query
query_analytics and GET .../analytics have a lead_orders dataset with the metrics cohort_leads, customers_from_leads, lead_to_customer_rate_pct, revenue_per_lead, median_days_to_order, cpl and cost_per_customer, in total or per channel_group, source, medium, campaign, ad_platform, campaign_id, adset_id, ad_id or lead_category. It uses the tab's default filters; its totals equal the kpis section of the same range. When some revenue or spend is in a currency without an exchange rate, notes says so (missing_rates): that money is not in revenue_per_lead, cpl and cost_per_customer.
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | A parameter is outside the list above; the message names it. |
| 403 | insufficient_scope | The token has no leads:read. |
| 403 | plan_required | compare=model on a plan without attribution model comparison. |
| 403 | (body {"gated": true, "feature": "lead_orders_drilldown"}) | The campaign drilldown below the Business plan. MCP returns the same body as the tool error. |
| 404 | workspace_not_found, leads_unavailable | The workspace is not yours, or the Leads module is not enabled for the account. |
| 409 | lead_orders_unavailable | The lead outcomes of the workspace are not computed yet. They are computed every few minutes. |
| 503 | lead_orders_unavailable, report_unavailable, busy | The report is switched off for maintenance, a read failed, or AxiTrace is busy; retry later (busy carries Retry-After). |