Skip to main content
This page assumes the shared rules in API Conventions — authentication, the two error shapes, batching and identity resolution. It only covers what is specific to earnings.
The Earnings API lets your backend read each collaborator’s money: what has already been paid, what is on its way, and what is still owed. It was built for the earnings block of a home screen — the one with a total and a privacy toggle.
This API does not decide what counts as a “commission”. That word means different things at different companies: some call every payout a commission, others separate prizes from commissions strictly. So the response comes broken down, and your screen sums whatever your company calls a commission.

How It Works

  1. You get an API Key with the earnings:read scope
  2. Your backend asks for one or many collaborators (by CPF or email)
  3. SalesOS answers with the totals, broken down by payout type and by receivable status

Authentication


Endpoint Reference

One action: earnings_status.

Request Schema

string
required
Must be "earnings_status"
array
required
Array of collaborator references (max 500)
string
Optional. The code of one of your company’s cost centers (e.g. "PLAY2SELL"; uppercase letters, digits, _ and -). Limits every amount to that cost center. Without it, the answer covers every cost center the key can see — a key restricted to some cost centers sees only those.

Example

Response (200):

Fields

Every amount is in cents, as an integer. Never parse them as decimals: floating-point arithmetic on money is a defect, not a rounding preference. Divide by 100 only at the moment of display.

Payout types

paid.by_type splits settled money across the three types the system records:
Sum the types your company calls a commission — do not assume. At one company every payout is called a commission and the whole total_cents is the right number. At another, only COMMISSION belongs on that line, and showing the total would inflate it by orders of magnitude.A type absent from by_type means the person has none of it, not zero-by-convention.

Receivable stages

receivable covers everything still owed. by_status splits it by stage: Two stages never appear here: PAGO (already left, counted in paid) and CANCELADO (will never be paid).
ATRASO is owed money, not an error state. It is included in receivable.total_cents on purpose. Filtering it out would hide, from the person who most needs to see it, money that is late.
Cancelled amounts are excluded everywhere. Showing them would promise money that will never arrive.

Self mode (SSO user token)

With the token of a user who signed in through SSO, send Authorization: Bearer <jwt> and omit collaborators. The answer covers only the token’s own user.
Sending collaborators with a user token is rejected with SELF_MODE_NO_COLLABORATORS. Batch lookups (collaborators) are partner-only: they require a partner API key (P2S-SIGN-V1).
If the user belongs to more than one company, send X-Tenant-Id with the company’s ID; without it, the token’s default company is used. Other self-mode errors: 400 SELF_MODE_USER_ONLY (the token is not a user’s) and 400 TENANT_REQUIRED (the account is not linked to any company).

Error Handling

See API Conventions for the two shapes and the status code table.
Invalid body, batch over 500, CPF without 11 digits, or an item with neither cpf nor email.
API key missing, unknown, revoked or expired, a timestamp outside the 30-second window (any second in the future included), or a signature that does not match. The body is { "error": "<message>", "code": "<code>" }, with code such as header_missing, api_key_not_found, key_revoked, key_expired, timestamp_too_old, timestamp_in_future or signature_invalid. In self mode, an invalid or expired user token answers { "error": { "code": "UNAUTHORIZED", … } }.
The key is valid but lacks the earnings:read scope: { "error": "…", "code": "scope_insufficient", "missing_scopes": ["earnings:read"] }. In self mode, FORBIDDEN means the account has no access to the company sent in X-Tenant-Id.
The cost_center code does not exist in your company, or is outside the cost centers this key can see.
The key reached its hourly limit: { "error": "…", "code": "rate_limited" }. Wait the seconds in the Retry-After header, then retry.
Someone who has never been paid is not an error. The response comes back with zeros and empty breakdowns, at status 200 — and that zero is a measurement: the person exists and has no payments. Different from found: false.

Rate Limits


Security

  • Read-only: this API never creates, approves or changes a payment
  • Each key is scoped to a single company — money from another company never appears, even for the same person
  • Amounts and documents are never written to logs; only counts are

Next Steps

Player Progress API

Level, XP, coins and ranking

Campaigns API

The catalog those prizes come from