Get started
Quickstart
From a new key to your live competitions on your own page, in four steps.
Get a secret key
Request access. Your key looks like
sk_followed by 48 characters, and it is shown to you once. If you lose it, ask for a new one.Keep it on your server
Put it in an environment variable or your secrets manager. Never ship it to a browser or a mobile app: anyone holding it can act as your organisation.
Terminalexport BITRAFFLE_SECRET_KEY="sk_…"List your live competitions
curl https://www.bitraffle.io/api/v1/competitions \ -H "Authorization: Bearer $BITRAFFLE_SECRET_KEY"const res = await fetch("https://www.bitraffle.io/api/v1/competitions", { headers: { Authorization: `Bearer ${process.env.BITRAFFLE_SECRET_KEY}` }, }); const { data } = await res.json();import os, requests res = requests.get( "https://www.bitraffle.io/api/v1/competitions", headers={"Authorization": f"Bearer {os.environ['BITRAFFLE_SECRET_KEY']}"}, ) data = res.json()["data"]Response{ "data": [ { "id": 71, "title": "Win a Tudor Black Bay 58", "ticketPriceUSDCents": 200, "paymentToken": "USDC", "maxTickets": 3000, "ticketsSold": 412, "status": "active", "state": "open", "endDate": "2026-10-24T01:49:13.000Z", "imageUrl": "/uploads/1790921518423-Scf1NxFD.avif", "payment": { "acceptedTokens": [ "USDC", "USDT" ], "fiat": false } } ] }Money is always an integer in the smallest unit:
ticketPriceUSDCents: 200is $2.00.statetells you whether a competition is selling right now: onlyopencompetitions accept entries.Show them on your page
The quickest way to show them is the widget. Buyers check out in a secure popup, and your page never navigates away.
HTML<script src="https://www.bitraffle.io/widget.js" data-org="your-org"></script>
Next steps
- Sell entries inside your own product with hosted checkout.
- Get told when tickets are issued or a winner is drawn with webhooks.
- Read how errors and rate limits work before you go live.