Lucratividade

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.

Autorização

ClientIdAuthClientSecretAuth
headerx-client-id<token>

Client ID

headerx-client-secret<token>

Client secret

Parâmetros de query

organizationId*string

Identificador da organização (obrigatório)

startDate*string

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

Formatodate
endDate*string

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

Formatodate
gtmMotionId?string

GTM motion da organização (UUID), como listada por GET /v1/gtm-motions. Opcional: sem ele, a resposta cobre a GTM motion padrão da organização. Este endpoint ainda não é recortado por GTM motion: a motion padrão responde com os dados da organização, os mesmos números de quando o parâmetro é omitido, e qualquer outra GTM motion da organização recebe 422 GTM_MOTION_DATA_NOT_AVAILABLE. Não UUID: 400. GTM motion que não é uma motion ativa da organização: 403 GTM_MOTION_NOT_IN_ORGANIZATION.

Formatouuid

Corpo da resposta

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    }  ]}