Profitability

Get Daily CMV Evolution

GET
/v1/profitability/cmv-evolution

Returns a daily series with each day's revenue, orders, average ticket and real cost of goods sold (COGS), using the same COGS fields as /cards and /metrics-evolution (cogs, revenueWithCmv, revenueWithoutCmv, marginBasis, blendedContribution).

  • A day on which every order has a real cost returns marginBasis = cmv_real. Days with partial cost coverage return mixed, so you can flag that the value is incomplete.
  • degraded: true with data: [] means cost data was not available at query time, not that the period is empty.

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). Applied only together with endDate; without both, the API uses the whole history.

Formatdate
endDate?string

Last day of the period, inclusive (YYYY-MM-DD). Applied only together with startDate; without both, the API uses the whole history.

Formatdate

Response Body

Daily CMV evolution retrieved successfully

application/json
  1. response
data*array<>

Daily CMV (COGS) time series, ordered by date

granularity*"daily"

Always daily. For the monthly view, use /metrics-evolution.

Value in"daily"
degraded*boolean

true when cost data was not available at query time. In that case data is empty because the query could not be answered, not because the period has no data.

marginPercent*number

Contribution margin percentage applied. 100 when no margin is configured

marginConfigured*boolean

Whether a custom contribution margin has been configured for this organization

marginCompleteness?MarginCompleteness

Completeness of the item-by-item margin (gateway, tax, shipping and COGS): complete = every item resolved; partial = some item pending, so the margin is partial; none = no item-by-item composition (margin never configured, or configured as a single percentage; tell them apart with marginConfigured).

Value in"complete""partial""none"
marginItemStatus?|

Status per item of the margin composition (synced = from the orders, configured = informed by the user, pending = not configured or missing data). null when the organization has no composition.

curl -X GET "https://example.com/v1/profitability/cmv-evolution?organizationId=c0ad4763-173e-4a05-9cff-5208c8ea5f6a&startDate=2025-01-01&endDate=2025-12-31"
{  "data": [    {      "date": "2026-09-01",      "revenue": 100000,      "orders": 250,      "averageTicket": 400,      "cogs": 38000,      "revenueWithCmv": 82000,      "revenueWithoutCmv": 18000,      "marginBasis": "mixed",      "blendedContribution": 52100    }  ],  "granularity": "daily",  "degraded": false,  "marginPercent": 35,  "marginConfigured": true,  "marginCompleteness": "none",  "marginItemStatus": null}