API
A clean API for your platform.
Link our games to your platform and your wallet. Every call is named for what it does. Every field has a reason.
At a glance
The facts a developer needs.
How it works
Seven calls on your side.
Your platform starts a game. We run it on the player's screen. We call your wallet for every round, and tell you when the session closes.
session.startwallet.balancewallet.stakewallet.winwallet.losswallet.refundsession.closedWhat you get
Clean by design.
Named calls
Every call says what it does. The version is in the address.
Safe to send again
Send a change twice, and it happens once.
Clear sessions
Active or closed. Every close says who closed it, and why.
Every round ends
Every round reaches a final state. No bet is left without a result.
Many test environments
Live, plus as many sandboxes as you need: staging, UAT, one per branch.
Signed both ways
Key pairs on both sides. No secret is ever shared.
Support built in
Find any round, replay it, and see every wallet call.
Your team
Invite people as owners or members. Enterprise: SSO on request.
Live when you are ready
Test in Sandbox. Ask for Live when your wallet passes every check.
Starting a game
How a game starts.
- Your server calls
session.start.With the player, the game and the bet settings. - We answer with a game link.With our
sessionId, and the time the link expires. - You open the link.In your web site, or in a web view in your iOS or Android app.
- Our server calls your wallet.For the balance first. Then a stake, and a win or a loss, for every round.
The game link works once, and must be opened within 2 minutes. A copied link can't be used to play with your player's money.
Your wallet
Five calls on your server.
You build five calls at your server address. Our server calls them. Your balance is the only balance.
| Call | We send it when |
|---|---|
| wallet.balance | The game opens. |
| wallet.stake | A round starts. |
| wallet.win | A round ends with a win. |
| wallet.loss | A round ends with no win. |
| wallet.refund | A stake had no answer in time. |
A stake with no answer in time is refunded. A win, a loss or a refund is sent again with the same transactionId until you accept it. Nothing is paid twice, and nothing is lost.
Not accepted after 1 hour? It goes on your stuck list, and we email the owners of your account.
wallet.balance must answer within 3 seconds. Every other call within 5 seconds.
Sessions
Active or closed. Nothing else.
A session is one player playing one game. Our server owns it. A closed session never opens again.
| Who | Reason |
|---|---|
| casino | your own text, e.g. logout |
| player | exit |
| system | not_opened |
| system | idle |
| system | replaced |
| system | environment_deleted |
Every close is sent to your server as session.closed, with who closed it and why. Your session and ours never drift apart.
We send it again until you accept it, for up to 30 days.
Rounds
Every round ends.
A round is one spin, or one Mines game from the bet to collect or a mine.
A state ending in -ing waits for your wallet's answer. Every round reaches a final state: ended, declined or refunded.
A slot round goes from staking straight to ending. Only a Mines round is open, while the player picks tiles.
A result that exists is always paid. A round is refunded only if no result was made.
Free spins are part of the round that won them: one bet, one win. The round shows the paid spin's win, the number of free spins, and what they won.
A Mines round left open finishes by itself after 24 hours. The player gets what they collected so far. It is never a loss.
Every call
The whole API on one page.
You call us
→You → usgames.listYour games, their images and the settings you chose.session.startStarts a game for a player. Returns the game link.session.updateBetSettingsChanges a player's bet settings during play.session.closeCloses a session.sessions.closeCloses all of a player's sessions. For example, when a player excludes themselves.session.getOne session: its state, times and totals.round.getOne round: its bet, its win, its free spins and every wallet call.rounds.listA player's rounds, by time and state.money.listEvery bet, win and refund in your account, by time. For your finance system.
We call your wallet
→We → youwallet.balanceGets the player's balance.wallet.stakeTakes the bet when a round starts.wallet.winPays a win.wallet.lossTells you a round ended with no win.wallet.refundGives a bet back when a stake had no answer.
We tell your server
→We → yousession.closedA session closed: who closed it, and why.
Your environments
→You → usSandbox only. By hand, or from your build pipeline.
environment.createA new environment, with your server address. It can copy another one.environment.updateChanges its server address or its settings.environment.deleteDeletes an environment. Its sessions close. Wins still owed are still sent.environments.listAll your environments and their settings.
The game and your app
⇄Game ⇄ your appIn your web site, and in iOS, Android, React Native and Flutter apps.
game.loadedThe game is on screen. Hide your loading screen.game.failedThe link was used or expired: start a new session. The session closed: go back to the lobby.balance.changedThe balance changed. Show the new one.player.exitThe player pressed exit. Close the game.balance.refreshYou tell the game the player added money.
Answers
One shape for every answer.
Your code checks ok, and acts on a fixed list of error codes, never on text.
Each error code comes with what to do next.
traceId finds every call and retry that one action caused, on both sides.
Every call, both ways, is signed with the sender's private key. A call older than 5 minutes is refused.
API keys
Your keys, in your back office.
Create API keys in your back office. Each key pair is made in your browser. You keep the private key. We keep only the public key.
Each key has a name, the environments it may use, what it can do, and the IP addresses it may call from. It can play, manage environments, or read money.
On Live, every key needs its IP addresses.
To change a key: create a new one, move your servers to it, then delete the old one.
Going live
From Sandbox to Live.
- Build your five wallet calls.And the
session.closedaddress. - Run the wallet test run in Sandbox.We call your wallet with test players and test money, and check each rule.
- Ask for Live.Tell us what you need: games, markets, players.
- We send you a price.After you pay, we turn on Live and email you.
Live has real players and real money. Nothing is copied from Sandbox: you create new API keys for Live.
Limits
Clear limits, clear answers.
Each account may make 20 calls a second in Sandbox, and 200 in Live. It may create 100 environments an hour.
A call over a limit gets rate_limited, with retryAfter in seconds. Wait that long, then send the call again.
A refused call does not count. session.close and sessions.close never count, so a player can always be closed.
Our calls to your wallet never count against your limits. Live limits can be raised.
Link our games.
Tell us what you need. We send you a price.
contact@nartifacts.com