Skip to main content

Missions 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 Missions API lets your backend read the gamification mission state of your salespeople in SalesOS — which objectives are open today, how far along each one is, what was already completed, and which mission to surface next. It was built for composing your own app screens (for example, a home widget showing “3 of 6 missions done”) 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 missions whose period window contains today, computed in your company’s timezone.

How It Works

  1. You get an API Key with the missions:read scope (Admin > Integrations > API Keys)
  2. Your backend asks for the mission state of one or many collaborators (by CPF or email)
  3. SalesOS answers with today’s missions per collaborator — progress counters, the full list, and the next active mission
Missions are advanced by activity inside SalesOS: the engine listens to events (a visit scheduled, a sale closed) and increments the matching mission. This API is for reading that state — pair it with a deep link into the SalesOS module for the action itself.
This endpoint never creates missions. If a collaborator’s daily missions have not been provisioned yet, the answer is an empty list with progress.total = 0 — not an error, and not a silent write.

Authentication

All requests require an API Key in the Authorization header:
See the Authentication page for details on creating and managing API Keys.

Environments

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

Endpoint Reference

The endpoint accepts two actions via the action field: missions_status and missions_summary. Each collaborator is identified by CPF (any format — digits are normalized) or email. When both are sent, CPF wins.

Action: missions_status

The missions whose period window contains today, per collaborator. “Today” is computed in your company’s timezone (returned as timezone / reference_date in the response) — never UTC.

Request Schema

string
required
Must be "missions_status"
array
required
Array of collaborator references (max 500 — 100 when include_missions is on)
boolean
default:"false"
Return the full missions[] array. Off by default: missions fan out per collaborator, so a large batch with the list on becomes a multi-megabyte response. progress and next_mission always come back.
string
CPF, any format (52998224725 or 529.982.247-25). Must contain exactly 11 digits.
string
Email — used only when cpf is absent

Example

Response (200):

Response fields explained

The full list is opt-in. By default the answer carries progress and next_mission only — enough to render a home screen. Ask for include_missions: true when you need every mission, and expect a tighter batch limit (100 instead of 500), because each collaborator carries several missions.
Rewards are personalized — always render points_reward, never nominal_reward. A mission’s target can be adapted per collaborator, and the reward scales with it: someone whose target was halved earns half the points. points_reward is what will actually be credited; nominal_reward is the number configured on the definition, sent only so you can show a “reduced goal” hint if you want. These are the same field names the mission.completed webhook uses, so both channels agree.
Rewards are paid in installments, so “earned” and “still to win” are different numbers. A mission worth 100 points with a target of 5 credits 20 on every step. After one step the collaborator has earned 20 and still has 80 to winpoints_earned counts the 20, points_available counts the 80. Adding the full 100 to both would count the same points twice.
pending_approval is not completed. Some missions require a manager’s approval before the points are credited, and the credit happens on the approval date. Reporting them apart lets you render “waiting for approval” without inventing the distinction.
Mission names, categories, icons, rewards, targets and display order are configured per company. Never hardcode them in your client — render whatever the response carries, so a change in SalesOS does not require an app release.

Action: missions_summary

Everything missions_status returns, plus week/month completion counters. Useful for a “your month so far” strip. Missions are counted in the period they belong to (their own window), not the date they were approved — so a mission approved late still counts in the week it was earned.

Example

Response (200) — additional block per collaborator:
missions_summary scans a month of mission rows per collaborator, so its batch limit is 100 instead of 500.

Self mode (federated session)

When your app already holds a federated SalesOS user token, send it as Authorization: Bearer <jwt> and omit collaborators. The answer covers only the token’s own user.
Sending collaborators together 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 progress by CPF.

Error Handling

All errors follow the shared structure:
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, or an item with neither cpf nor email. The details array points to the item index.
A collaborators list was sent with a user token. Omit it, or use a partner API key.
API key is missing, invalid, or expired, or the signature does not match.
API key is valid but lacks the missions:read scope.
Only POST is accepted.
Too many requests this hour. Wait retry_after seconds, then retry.
Internal server error. Retry with exponential backoff (2s, 4s, 8s).
An unknown collaborator is not an error. The request succeeds with found: false for that item, so one bad CPF never breaks a whole home-screen render.

Rate Limits


Security

  • Read-only: this API never creates, advances or provisions missions
  • Each key is scoped to a single company — a CPF from another company answers found: false
  • 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

Check-in API

Read duty presence to complete the same home screen

Authentication

Learn how to create and manage API Keys