CPAPI certification
Candidate preview. This page describes the candidate Canonical Provider API v1 contract, candidate manifest SHA-256 c85d92a38cd495f7d8a0cf1b5d4b0c2783abdd90f3c51d4827ca24e24d11ea0e. It is non-normative: it explains the contract and does not define it.
Certification is an automated run you start from the cabinet’s Pass certification step. It calls your Control API in the certification environment, tests our side, and records a report. Money moves only on a test wallet: no real money moves, and a certification transaction can never reach a real operator wallet. There is no way to submit a result from your side; only the run records one.
Certification does not test your server’s Money client. Every Money call in a run, the sandbox bet and win included, comes from our test runner: it signs with our copy of your certification Money key and calls a private instance of our Money API that only the run reaches. The production checks send no Money calls either, so the first Money call your server makes to us carries real players’ money, after you go live. Check your signer against the test vector before then.
What a run checks
Section titled “What a run checks”A run makes 40 required checks, grouped in the report by whose side each one tests:
| Group | Checks | What they test |
|---|---|---|
| Your API | 5 | Signature refusals (13 to 16) and a safe launch URL (23) |
| Our Money API | 22 | Our Money API, called by our test runner with your certification Money key on sessions opened through your API |
| Our side | 11 | Evidence from our runtime tests for the build we certify against, not run against your setup (C01 to C11) |
| Sandbox round | 2 | One bet and one win from our test runner on a test wallet |
Only the first group calls your API directly. The run also opens its sessions through your API, so if your API cannot open sessions, the run cannot finish. Certification does not test the optional demo module; optional demo play says how to check it yourself.
Checks on your API
Section titled “Checks on your API”| Check | Your API must |
|---|---|
| 13 Invalid signature | Refuse a call whose signature does not verify, with no effect. This includes a session request or recovery lookup whose Idempotency-Key was swapped: it gets 401 invalid_signature, a recovery lookup for the swapped key gets 404 session_invalid, and the original call, sent again unchanged, still succeeds |
| 14 Expired signature | Refuse a signature outside its 300-second window |
| 15 Replayed nonce | Refuse a second call that reuses a nonce |
| 16 Signed for the other environment | Refuse a call whose signature tag names the other environment |
| 23 Unsafe launch URL | Answer 201 with a working https launch URL on your launch domains, then return that same session on a replay, a read and a recovery |
These checks expect the five problems listed in CPAPI signatures, which also describes both parts of check 13. If one of these checks fails, fix your API and run again.
Common failures
Section titled “Common failures”These are the mistakes that most often fail checks 13 to 16 and 23, or stop a run before its checks start. Before the checks, a run opens two sessions on your API through the same client that player launches use. If either answer is refused, the run ends Could not finish with no check results, even though your server logged a 201. Check these before you start a run, because each failed run can take up to 15 minutes once it starts.
| Symptom | Likely cause | Fix |
|---|---|---|
The run ends Could not finish, although your server logs a 201 |
A CDN or proxy in front of your API compresses the answer, and we refuse a compressed answer | Turn off compression for your API host, or serve it without a CDN |
| The run ends Could not finish, although your API works in a browser | Your API answers a call with a redirect, for example to add or remove a trailing slash or to move to another host | Serve each call directly at its path, with no redirect |
| The run does not start | Your API URL has a path, such as https://api.example.com/cpapi |
Register the origin only and serve the calls at /v1/… from its root |
The run ends Could not finish, although your server logs a 201 |
The launch URL is on a host that is not one of your launch domains, uses http or an IP address, has an uppercase letter in its host, has a query with no path before it such as https://play.example.com?s=1, has a user name, a fragment, a space or a backslash, or is longer than 2048 bytes |
Add the exact host to your launch domains, or change the URL: write the host in lowercase and put at least / before the query |
The run ends Could not finish, although your server logs a 201 |
Your answer has a field other than session_id, state, environment, launch_url and provider_session_ref, repeats a member name, names the other environment, has a state other than active, or has a session_id or provider_session_ref outside ^[A-Za-z0-9._:-]{1,128}$ |
Answer with exactly those fields, state active, the environment of the request, and identifiers that match that pattern |
| Check 23 fails on the replay, read or recovery | A repeat with the same Idempotency-Key opens a second session, GET /v1/sessions/{session_id} does not find the session, or recovery answers 201 instead of 200 |
Store each key with the session it created and return that session unchanged |
| Check 13 fails although bad signatures are refused | Your server records the nonce before it checks the signature, so the call with the swapped Idempotency-Key uses the nonce up and the original call then gets replayed_nonce |
Verify in the order CPAPI signatures lists: record the nonce last |
| Check 13 fails on the swapped key | Your server checks the signature without the idempotency-key component, or reads the key from a normalized header |
Rebuild the signature base from the exact covered components, including idempotency-key on session requests and recovery lookups |
| Checks 13 to 16 fail with the wrong problem | The refusal is not application/problem+json, has no title or status, or its status, code, type, requirement_id or retry_class differs from the five expected problems |
Return the problems exactly as the table in CPAPI signatures lists them |
Check 14 fails, or valid calls get expired_signature |
Your server clock is off, or you check created without the 300-second tolerance |
Sync your clock with NTP and apply the window from the verification steps |
| Calls fail after a key rotation | Your server accepts only the newest Control key | Accept the previous key until its hour is over |
| Calls time out | Your API answers in more than 5 seconds, often on a cold start | Keep the API warm: we allow 3 seconds to connect and 5 seconds for the whole answer |
Our Money API refuses your server’s calls for the same kinds of reasons, but certification does not show them: check your Money client against the test vector before you go live.
Checks on our side
Section titled “Checks on our side”The other 35 checks test our side, not your API. If one fails, start a new run; if it fails again, ask in Activity under the step and include the run ID.
The 22 Money API checks follow the contract’s certification cases:
| Checks | What they prove |
|---|---|
| 1 to 4 | Exact, mismatched and concurrent duplicates make exactly one effect, or a conflict with none |
| 5, 6 | Insufficient funds is a named, final decline with no effect; an invalid or expired session is told apart from it |
| 7 | Malformed money is refused before any coercion |
| 8, 9 | A timeout before the effect allows a retry with the same key; a timeout after a possible effect recovers through status, never a blind retry |
| 10, 21 | A win before its bet gets 409 unknown_bet_reference and later applies exactly once; a win naming another session’s bet gets the same 409 with no effect |
| 11 | A zero win commits with no money moved |
| 12 | Debit and credit legs reconcile three ways |
| 13 to 18 | Bad, expired, replayed and wrong-environment signatures are refused; the previous key verifies inside its rotation overlap; a revoked key is refused at once |
| 19 | The same transaction under a new Idempotency-Key gets 409 and recovers through status |
| 20 | A session swapped in the body gets 403 before any balance read or effect |
| 22 | Duplicate JSON member names get 400 with no effect |
The 11 runtime checks are evidence from our runtime tests for the build we certify against; they do not run against your setup. They cover balance, debit and credits with an exact replay, concurrent identical requests, changed bodies and reused keys, an early win, lost acknowledgements and lost wallet responses, recovery after a crash, malformed and unauthenticated wallet answers, signatures with rotation and revocation, outages that fail closed, and a legacy retry racing the canonical path.
The sandbox round is part of every run. We open a session through your API, then our test runner, not your server, sends a bet of 1 and a win of 2, in minor units, to our Money API on a test wallet. Both must answer 201 with outcome committed, and each must appear once on our ledger and once on the test wallet.
Starting a run
Section titled “Starting a run”A run starts only when both keys, your catalog, at least one launch domain and an origin-only API URL are in place, and our side is ready. The cabinet lists whatever is still missing. After a release that changes the code our certification runs on, we may refuse a new run and cancel a queued one until we register the new build; start it again a little later. A routine release does not do this. You can have one run at a time: Run certification stays off while a run is queued or running. While your pass is current, the cabinet asks you to confirm before a new run, because the run resets it. An owner, admin or member can start a run; someone already assigned Engineer can too. No authenticator code is needed. Every session a run opens uses one title and one currency: the first title of your catalog by provider_game_id, in the first of its currencies by code, skipping any currency we have switched off. Your certification server must accept that title and currency; the simplest way is to accept every title and currency in your catalog.
On a live studio, starting a run takes the studio out of live until it goes live again, and a new run invalidates the pass it replaces. So that a member’s check never costs your studio its certification, the cabinet refuses a member’s run on a live studio and when the run would reset a pass that is still current, and also after your studio was linked to a different provider code on our side; an owner or admin, or someone already assigned Engineer, starts it then.
Engineer is no longer offered for new invitations or role changes. People already assigned older roles keep their access.
Results
Section titled “Results”Each check reads Passed, Failed, Error or No result, and a check without a result reads Pending while the run is under way. A run passes only when every required check passes:
- A run that does not finish within 15 minutes of starting ends without a result; then you can start another. A queued run waits until our worker is free, and it is cancelled if your setup or ours changes before it starts.
- Publishing a new catalog while a certification run or production checks are under way ends that run without a result; start it again.
- A missing prerequisite, a failed cleanup, a timeout or an unknown outcome never produces a pass.
- A pass belongs to what the run tested: your endpoint, the revisions of your Control and Money keys, and the contract, test suite and test runner it ran. The report also records your catalog and our build, but a new catalog or a later compatible release on our side keeps your pass current. The report holds check results, not your credentials or launch URLs.
When to run again
Section titled “When to run again”Run certification again after you change your certification endpoint or a certification key, and when the cabinet shows that your pass is no longer current, for example after a new contract, test suite or test runner. Changing only a production endpoint or key requires new production checks; your certification pass stays current if nothing else affecting it has changed. A routine release on our side does not ask you to run again. Until a run passes with your current setup, Go live stays closed. A new run also invalidates the production checks linked to the previous pass, so after it passes, run the production checks again before you go live; see CPAPI go-live.
Ordinary refund checks
Section titled “Ordinary refund checks”Arrange a certification environment and test wallet with your integration contact. The ordinary cabinet certification run exercises the base protocol. To check cpapi-refund.v1, keep one ordinary session opened before enablement, then open a second session after enablement using the same test currency.
- In the new session, place a funded bet and refund its full amount. Confirm the closing balance matches the opening balance. Repeat the refund with the same ID, key and body and a fresh nonce. Check the balance again.
- Verify that a partial refund and a refund naming a different session are refused. Try a second refund ID for the same bet and confirm that it cannot credit the wallet again.
- Refund a missing bet ID, then send the late bet with that ID. Check its terminal
refundedreason and unchanged wallet balance. Refund a definitively declined bet and confirmoriginal_declinedwith an unchanged balance. - Submit a refund in the session opened before enablement. Expect
400 validation_failed. Use the new session to check the admitted path.
Use the refund call and recovery steps to interpret each result. If the wallet outcome is indeterminate, pause the exercise and reconcile the original IDs.
US English social certification
Section titled “US English social certification”The optional cpapi-sweepstakes.v1 profile adds a separate two-session check. Use a certification operator credential to open one admitted SC session and one GC session for the same synthetic player and build. Fund the wallets independently. The profile checker signs Control create and recovery probes using the platform’s certification credential. It then acts as the studio, signing Money requests for the two previously registered operator sessions using the studio’s credential.
Run cpapi-conformance --sweepstakes config.json with those fixture IDs, the exact SHA-256 build and the authorized certification origins. The report includes each coin’s opening and closing balances. Both coins must pass fractional bet, win, original-bet refund, exact replay and cross-coin refusals. The ordinary 23-case report stays separate. Record the test operator’s signed wallet and game-build results for that environment. There is no approval to submit. While your studio is live, the published profile offers the title to every US Sweepstakes operator. Aggregator cannot limit it to some operators, brands or US states. Protocol and download.