Prerequisites: Complete the Quickstart guide. The snippets assume
jwt, apiToken, apiBaseUrl, program, provider, txlTokenMint, and the tokenTreasuryPda, tokenTreasuryVault, and userTokenAccount derivations from the quickstart’s Subscribe On-Chain section are in scope.Overview
A subscription lets you read TxLINE data. A booking lets you prove a fixture’s data on-chain. Booking buys your wallet a ticket for one fixture, paid once in TxL. Every on-chain validation of that fixture’s stats or odds checks for the ticket. Without it, the validation fails.What You Need for Each Task
The subscription is needed in every case because the API calls that fetch data and proofs need an activated API token. Validation needs a booking even when your bundle covers the fixture: the validation instructions check for the booking, not the subscription.
How a Booking Connects to Validation
book_fixture creates a fixture_ticket account whose address is derived from your wallet and the fixture ID. Each stat or odds validation passes that account in, and the program checks it before evaluating the proof. These rules follow:
- Book with the wallet that validates. The ticket belongs to the wallet that booked. A different wallet has no ticket for the fixture, even if someone else booked it.
- The ticket covers one fixture. The fixture in the proof must match the ticket. For odds, that is the odds update’s
FixtureId. A ticket for one fixture cannot validate another. - Book once, validate as often as you like. TxL is charged only at booking. The ticket stays on-chain, and validations against it have no per-call fee and no limit.
- The check happens at the validate step. Staging a worker ticket with
validate_fixture_for_treedoes not need a booking. A missing booking shows up whenvalidate_stat_v4orvalidate_odds_v4runs. - Not every fixture can be booked. Only fixtures listed by
GET /api/fixtures-schedulecan be booked: those with both odds and scores available whose competition has a configured price. Choose fixtures from that list, not from the odds or scores feeds.
GET /api/scores/snapshot/{fixtureId} succeed for a booked fixture whether or not your bundle covers it. Access starts once the backend has indexed the ticket.
Booking Flow
1
Get TxL
Booking is paid in TxL. Buy TxL with USDT as described in Purchase TxL. On devnet, request mock USDT from the program faucet first with
request_devnet_usdt.ts.2
Subscribe and activate
Submit
subscribe and activate an API token as in the Quickstart. The booking endpoints need the guest JWT and the activated X-Api-Token.3
Choose a bookable fixture
Call
GET /api/fixtures-schedule, optionally filtered by sport, country, or competition. See List Bookable Fixtures.4
Check for an existing ticket
Derive the
fixture_ticket address for your wallet and the fixture. If the account exists, the fixture is already booked and you can go straight to validation. See One Booking per Fixture.5
Request a quote
Call
GET /api/quotes/book-fixture with the fixture and your wallet. The backend returns a signed payload with the price and a validity window. See Request a Quote.6
Book on-chain
Submit
book_fixture with the quote payload, immediately preceded by an Ed25519 verify instruction for the quote’s signature. The price is transferred in TxL and the fixture_ticket is created. See Book On-Chain.List Bookable Fixtures
GET /api/fixtures-schedule requires the same permission as GET /api/quotes/book-fixture; callers without it receive 403 Forbidden.
Filters given together all apply.
The response is an array with one entry per fixture:
Request a Quote
A
404 Not Found means the fixture does not have both odds and scores available, or its competition has no configured price. No payload is returned. This happens most often when the fixture ID was taken from the odds or scores feeds instead of from GET /api/fixtures-schedule.
Book On-Chain
book_fixture requires an Ed25519 signature-verification instruction from the network’s backend admin key immediately before it. The signature is over the SHA-256 hash of the Borsh-encoded BookFixturePayload. The price is transferred in TxL base units, so the wallet needs at least that balance.
backendAdminPubkey is the backend admin key of the network you are using; see Program Addresses. It is also the BACKEND_ADMIN_PUBKEY constant in each network’s IDL, which is where the runnable examples read it from.
One Booking per Fixture
A wallet can book a given fixture only once. A secondbook_fixture for the same (wallet, fixtureId) fails with FixtureAlreadyBooked, and no TxL is transferred. Booking a different fixture is unaffected and creates its own ticket. Check for an existing ticket before booking:
Runnable Scripts
Next Steps
- Fetch scores and odds for the booked fixture with the endpoints in Fetching Snapshots.
- Validate data on-chain against the ticket with On-Chain Validation.