Profitability

Get the Best Customers by First-Purchase Channel

GET
/v1/profitability/customer-segments/channels

For each first-purchase channel (channel of analytics.obt_acquisition_customers, first touch, Orgânico included), the customers acquired in the period (first_purchase_date in the period) and how many of them are among the period's best customers: the same split as GET /v1/profitability/customer-segments (top fifth by revenue in the period, NTILE(5) over SUM(revenue) per customer of analytics.fct_transactions, days in UTC). bestCustomerShare is bestCustomers over customers, in percent. Customers are matched by e-mail (the order fact's trimmed e-mail, lowered, against the acquisition row's); a customer without e-mail is in no row. Aggregates only: no customer identifier or personal data is returned. 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 response is the organization data, exactly as before. Any other GTM motion of the organization is answered with that motion's own rows, read from the *_by_gtm_motion twins of the models behind the route (obt_profitability_daily/monthly/cohorts/product_cohorts/cohorts_by_dimension, obt_acquisition_customers, obt_acquisition_product_cohorts, fct_transactions and fct_media_daily), and the monetary figures are priced with the motion's own contribution margin (V4MOS-2707). A motion with no store linked has no orders or customers: the route answers with zeros or empty lists, never an error. Not a UUID: 400. Not a live GTM motion of the organization: 403 GTM_MOTION_NOT_IN_ORGANIZATION.

Formatuuid

Response Body

Best customers per first-purchase channel retrieved successfully

application/json
  1. response
period*
channels*array<>

One row per first-purchase channel with at least one customer acquired in the period.

curl -X GET "https://example.com/v1/profitability/customer-segments/channels?organizationId=c0ad4763-173e-4a05-9cff-5208c8ea5f6a&startDate=2025-11-01&endDate=2026-10-31&gtmMotionId=019a5b2e-7c4d-7abc-8def-0123456789ab"
{  "period": {    "startDate": "2025-11-01",    "endDate": "2026-10-31"  },  "channels": [    {      "channel": "Meta Ads",      "customers": 1200,      "bestCustomers": 300,      "bestCustomerShare": 25    },    {      "channel": "Orgânico",      "customers": 800,      "bestCustomers": 120,      "bestCustomerShare": 15    }  ]}