API v1 / Start here
Quickstart
Register a player and send a reward using an application API key.
Create a company and application
Create a company in SPG and create an application in its workspace. Copy the company ID and create an application key with players:write, players:read, ledger:write and ledger:read.
Register a player
Save the returned playerId alongside your own account identifier. The example uses shell variables for IDs and credentials.
curl -X POST "https://spg.api.sabco24.com/api/v1/companies/$COMPANY_ID/players" \
-H "Authorization: Bearer $SPG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"displayName":"Alex","externalId":"player-42"}'Post a reward
Store a distinct idempotency key with each business event. Reuse the same key and payload whenever you retry that event.
curl -X POST "https://spg.api.sabco24.com/api/v1/companies/$COMPANY_ID/ledger" \
-H "Authorization: Bearer $SPG_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: quest-8001" \
-d '{"type":"REWARD","amount":"50","currency":"PTS","toPlayerId":"<player-id>"}'Read the response
At success, the posting returns both entries and a committed transaction ID. Amounts and balances are represented as strings.
{ "id": "<transaction-id>", "type": "REWARD", "currency": "PTS", "amount": "50", "status": "POSTED" }