Profitability

Get Contract Economics

GET
/v1/profitability/contract-economics

Ticket and CAC per contract of the period, from the CRM contract (V4MOS-3186), for the Decisão tab of the leadgen audit. averageTicket = the value signed (SUM(faturamento)) over the contracts (SUM(sales_won)), both from the Painel Comercial (analytics.obt_crm_commercial_daily) and counted on dt_signed. cac = the investment of the campaigns classified as acquisition (organization_campaign_classification) in the period over the contracts SIGNED in the period (dt_signed), that is, acquisition investment per signed contract. Renewals are in the denominator on purpose: the Painel Comercial has no field that tells a new contract from a renewal (none of the 33 columns of crm_v4_commercial_panel_opportunities carries the contract type), and no heuristic is applied to guess them out. A figure never comes back as 0 for lack of data: it is null with its *UnavailableReason (no_commercial_panel, no_contracts, no_contracted_value, no_acquisition_campaign, no_acquisition_investment). no_commercial_panel is only answered when the check concluded there is no panel; if the check itself fails (warehouse unavailable) the route answers 503. no_contracted_value means contracts with no value recorded in the panel, missing or zero (the source model already sums COALESCE(faturamento, 0), so the two are indistinguishable). A campaign counts as acquisition by its classification, whether or not it spent in the period. Without any campaign classified as acquisition the CAC is unavailable (no_acquisition_campaign), not the average CAC of all the spend; with a classified campaign but no spend in the period it is no_acquisition_investment. Only the Painel Comercial carries the signed value, so an organization without it (HubSpot included) gets both figures unavailable with no_commercial_panel. Aggregates only. Both dates are required; the period spans at most 366 days.

Authorization

ClientIdAuthClientSecretAuth
headerx-client-id<token>

Client ID

headerx-client-secret<token>

Client secret

Query Parameters

organizationId*string

Organization identifier (required)

startDate*string

First day of the period, inclusive (YYYY-MM-DD, UTC). Required.

Formatdate
endDate*string

Last day of the period, inclusive (YYYY-MM-DD, UTC). Required. At most 366 days from startDate.

Formatdate
gtmMotionId?string

GTM motion of the organization (UUID), as listed by GET /v1/gtm-motions. Optional: without it, or with the default GTM motion, the organization's figures. Any other GTM motion reads the Painel Comercial twin (analytics.obt_crm_commercial_daily_by_gtm_motion) and the motion's own campaign classification and spend.

Formatuuid

Response Body

Contract economics retrieved successfully

application/json
curl -X GET "https://example.com/v1/profitability/contract-economics?organizationId=c0ad4763-173e-4a05-9cff-5208c8ea5f6a&startDate=2026-11-01&endDate=2026-11-07&gtmMotionId=019a5b2e-7c4d-7abc-8def-0123456789ab"
{  "period": {    "startDate": "2026-10-28",    "endDate": "2026-11-26"  },  "hasCommercialPanel": true,  "contracts": 48,  "contractedValue": 182400,  "averageTicket": 3800,  "ticketUnavailableReason": null,  "acquisitionInvestment": 24000,  "acquisitionCampaigns": 6,  "cac": 500,  "cacUnavailableReason": null}