Skip to main content

Campaigns API

Examples below show the wire-format Authorization: P2S-SIGN-V1 API_KEY:TIMESTAMP:SIGNATURE header. To compute the signature in your code, use the signedRequest helper in Authentication.
The Campaigns API lets your backend read your company’s incentive campaigns in SalesOS — which ones are running, what the reward catalog offers, how much each collaborator has to spend, and how many rewards they already qualify for. It was built for composing your own screens before the user ever opens the SalesOS module. It is a read-only, server-to-server API: you look collaborators up by CPF or email, in batch, and SalesOS answers with the running campaigns and each person’s state in them.
A campaign is configured by your company: name, catalog, prices in points, categories, level rules and even the currency name. This API returns whatever is configured — it knows no specific campaign.

How It Works

  1. You get an API Key with the campaigns:read scope (Admin > Integrations > API Keys)
  2. Your backend asks for the state of one or many collaborators (by CPF or email)
  3. SalesOS answers with the running campaigns — campaign data once, then each collaborator’s state
Campaign metadata comes back once at the top, not repeated per person. On a 500-collaborator batch that is the difference between a lean response and a multi-megabyte one.
This endpoint does not redeem rewards or accept terms. It is read-only — pair it with a deep link into the SalesOS module for the action itself.

Authentication

See the Authentication page to create and manage API Keys.

Environments

Base URL: https://api.play2sell.com

Endpoint Reference

Two actions via the action field: campaign_status and campaign_catalog. Each collaborator is identified by CPF (any format — digits are normalized) or email. When both are sent, CPF wins.

Action: campaign_status

Your company’s running campaigns and each collaborator’s state in them.

Request Schema

string
required
Must be "campaign_status"
array
required
Array of collaborator references (max 500)
string
CPF, any format (52998224725 or 529.982.247-25). Must contain exactly 11 digits.
string
Email — used only when cpf is absent
string
Filter to a single campaign. Absent = every running campaign.
string
Language for the configurable texts. Absent = the campaign’s default.

Example

Response (200):

Campaign fields

Collaborator fields

spendable: 0 does not mean “no points”. The wallet is enabled per company; until it is, the balance comes back as zero even for people who have a score. Always read wallet_enabled before writing “no balance” on the screen — otherwise it states an absence that isn’t true.
Qualifying and affording are different counts. A reward can be unlocked by level and still cost more than the collaborator has. That is why eligible_rewards and affordable_rewards are separate fields.

Action: campaign_catalog

The same content with the catalog cut. Because the catalog grows per collaborator, the batch limit drops to 100.

Self mode (federated session)

With a federated user token, 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 require a partner API key — otherwise any signed-in user could read other people’s balance by CPF.

Error Handling

Two shapes, not one. The block above is the endpoint error. Failures in the authentication layer answer before the endpoint runs, with error as a string:
Code that assumes error.code reads undefined on every auth failure. Branch on the type — see API Conventions.
Invalid body, batch over the limit, CPF without 11 digits, an item with neither cpf nor email, or a malformed campaign_slug. The details array points to the item index.
A collaborators list was sent together with a user token.
API key is missing, invalid, or expired, or the signature does not match.
API key is valid but lacks the campaigns:read scope.
Only POST is accepted.
Too many requests this hour. Wait retry_after seconds.
Internal server error. Retry with exponential backoff (2s, 4s, 8s).
No running campaign is not an error. The response comes back with campaigns: [] and status 200 — the company may simply have nothing live.

Rate Limits


Security

  • Read-only: this API never creates redemptions, accepts terms, or changes balances
  • Each key is scoped to a single company — a CPF from another company answers found: false, and other companies’ campaigns never appear
  • Requests are HMAC-signed (P2S-SIGN-V1) and logged for audit; documents are never written to logs
Never expose your API key in client-side code. This API must only be called from your backend server.

Next Steps

Missions API

The progress that generates the points spent here

Authentication

How to create and manage API Keys