Profitability

Get Contract Origins

GET
/v1/profitability/contract-origins

Contracts and leads of the period by the lead's origin, for organizations that publish a Painel Comercial (analytics.obt_crm_commercial_daily, V4MOS-2363): SUM(sales_won) (counted on dt_signed) and SUM(leads) (counted on lead_date) grouped by canal_origem. leadToContract is contracts over leads of the period in % (2 places), a ratio of volumes like the funnel between stages, null without leads. A contract without a registered origin (NULL canal_origem) is its own Sem origem registrada row (isUnregistered: true), always last. An organization without the Painel Comercial answers hasCommercialPanel: false with no origins: no other CRM carries the origin next to the signed contract. 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, the response covers the organization's default GTM motion. This endpoint is not split by GTM motion yet: the default motion is answered with the organization's data, the same numbers as when the parameter is omitted, and any other GTM motion of the organization returns 422 GTM_MOTION_DATA_NOT_AVAILABLE. Not a UUID: 400. Not a live GTM motion of the organization: 403 GTM_MOTION_NOT_IN_ORGANIZATION.

Formatuuid

Response Body

Contract origins retrieved successfully

application/json
curl -X GET "https://example.com/v1/profitability/contract-origins?organizationId=c0ad4763-173e-4a05-9cff-5208c8ea5f6a&startDate=2026-11-01&endDate=2026-11-07&gtmMotionId=019a5b2e-7c4d-7abc-8def-0123456789ab"
{  "period": {    "startDate": "2026-11-01",    "endDate": "2026-11-07"  },  "hasCommercialPanel": true,  "contracts": 48,  "leads": 1838,  "leadToContract": 2.61,  "origins": [    {      "origin": "Meta Ads",      "contracts": 28,      "leads": 1273,      "leadToContract": 2.2,      "isUnregistered": false    },    {      "origin": "Sem origem registrada",      "contracts": 7,      "leads": 0,      "leadToContract": null,      "isUnregistered": true    }  ]}