# Using the SourceLess API A guide for the platforms that build on SourceLess: exchanges, banking and payment services, wallets, listing sites and dashboards. The reference for every route is [`docs/API.md`](../API.md). This guide explains how to use them correctly. **What this edition covers.** Part 1, the public read API, which needs no key, and Part 2, partner keys. Later parts cover watching addresses with signed notifications and the operators' side. They are added when those layers are built, and are not described here before they exist. **The labels used here.** **MEASURED** means a value was observed on the live chain, and the date is given. Everything else describes what the code does. --- ## Part 1 — The public read API ### 1.1 Which address to use SourceLess has three public addresses for programs and people, and each one has its own job: | Address | What it is | Use it for | |---|---|---| | `https://api.xplstr.org/v1` | The **versioned REST API** described here. GET only, plain JSON, and a contract that changes only by adding things | Anything you integrate and want to keep working: balances, transfers, blocks, supply, settlement | | `https://rpc.xplstr.org` | The **JSON-RPC** door of the chain (Iris). The method names and shapes follow the node | Submitting a transaction you have already signed. Wallets and the SDKs already speak it. See `docs/JSON_RPC.md` | | `https://xplorer.xplstr.org` | The **explorer** for people. Its `/api` mirror follows its pages | Looking things up by hand. Do not integrate against the mirror: it is not versioned | `api.xplstr.org` reads the same chain as the other two. It reads it from the archive followers, which are nodes that hold the whole chain and seal nothing. ### 1.2 First calls ```sh curl -s https://api.xplstr.org/v1/network curl -s https://api.xplstr.org/v1/status curl -s https://api.xplstr.org/v1/tokens ``` `/v1/network` tells you which chain you are talking to. Check it once when your service starts, and refuse to go on if it is not the one you expect: - `network` must be `"asgard"`; - `chainId` must be `1313`; - `genesisHashHex` must be `1cf8655125cc1bbbc0ca06a491f53775499785c349b4d0f5748d5ea170e517bf`. The API makes the same check against its own upstreams before it starts. Making it yourself is what protects you from a misconfigured DNS record or a lookalike. ### 1.3 Reading values correctly - **Every amount is a decimal string in minor units.** `"amountMinor": "10000000000000"` with `"decimals": 13` is 1 STR. Never parse an amount into a floating-point number: past 2^53 it loses digits, and a balance that is wrong in its last digits is worse than none. Keep amounts as strings or big integers. - **Heights and nonces are decimal strings too.** - **The seven ledgers** are listed by `GET /v1/tokens`: STR, CCOS, WSTR, ARSS, STR_USD, WNFT and ESTR. Two rules matter to anyone moving value: - a **CCOS** transfer must carry `purpose: "financial"`, or the chain refuses it; - **WNFT** is an identity and cannot be transferred by a holder. `GET /v1/address/{address}/balance` shows each rule per ledger, as `transferable`, `restriction` and `requiresPurpose`. - **There are no transaction fees.** Value is conserved exactly. The cost of taking part is the 1000 STR locked behind an STR.domain, paid once per identity. - **"Unknown" is an answer.** A value the chain cannot state comes back with `status: "unknown"` and a reason, never as a zero. ### 1.4 Balances and history ```sh curl -s https://api.xplstr.org/v1/address/
/balance curl -s "https://api.xplstr.org/v1/address/
/transactions?limit=25" curl -s "https://api.xplstr.org/v1/address/
/transactions?offset=25&limit=25" ``` - `balance` gives all seven ledgers with balance, available and locked, plus the nonce the next signature must carry. A proved STR.domain locks 1000 STR, so `available` is what can be spent. - `transactions` is the address's **whole** history, newest first, at most 100 a page. - Offsets move when a new transfer is sealed. `total` tells you that this happened, so re-read from the top when it changes. - `history` reads only the node's recent window, and says whether that window reached genesis. Use `transactions` when you need everything. To find the address behind a name, use `GET /v1/domain/STR.sourceless/holder`. To find the name of an address, use `GET /v1/address/{address}/domain`. ### 1.5 Is a payment settled? Read this before you credit anything Ask the node about one transaction: ```sh curl -s https://api.xplstr.org/v1/tx/ ``` The answer has a `phase`: - `queued`: waiting for a block; - `settled`: in a block, not yet deep enough; - `final`: at or past the confirmation depth; - `diverged` or `abandoned`: the node gave up on it, and `reason` says why; - `unknown`: not found. **`unknown` does not mean rejected.** It may be outside the node's 1,024-block search window. The answer says how far the node looked. For any transfer, `GET /v1/tx//transfer` reads the whole chain. **Before you ship goods or credit value, act on `safeForValue`, not on `settledForGood`.** `settledForGood` is `true` only at `final`, and never while `contested` is set. It is kept, with its meaning unchanged, because existing integrations read it. On Asgard it says "12 blocks deep on this node's history", and that is not enough to move value on (see below). `safeForValue` is `true` only when `settledForGood` is `true` AND the block is either backed by a signature quorum or at least `valueDepth` blocks deep. `finalityBasis` says which: `depth` or `signatures`. On Asgard today it is always `depth`, and `valueDepth` is 600. What the phase `final` means on Asgard today: - **It is a depth: settled at depth 12.** A block reaches `final` once it is 12 deep, counting its own block (`requiredConfirmations`, which `/v1/parameters` reports). - **It is not yet backed by agreement.** `/v1/status` → `finalityBacking` says whether a quorum of seats has signed the line. MEASURED on 2026-11-09, it said `backed: false` and `irreversibleLine: -1`. While that is so, a node refuses no reorganisation by rule, and `final` means "12 blocks deep on this node's history". It is a strong signal, not an irreversible one. - **Blocks come about once a minute.** The heartbeat is 60 s. MEASURED on 2026-11-09, the median gap was 63.5 s and the mean 95.5 s, with occasional longer gaps. `/v1/status` and `/v1/live` give the live figures. No time to settlement is published, because settlement is a height and not a duration. - **Twelve blocks can be rewritten by a large enough group of seats.** Fork choice ranks two branches first on how many distinct slots each filled since they split. A branch built in private and released later replaces every block it outranks, at any depth, because no signature quorum backs the line. The audit of 2026-11-12 (finding H1) reproduced this with the built comparator: against the real 599-block live history a private branch from 45 seat keys lost and one from 50 won. A withheld branch is invisible until it is released. **Why 600 blocks.** It is the shallowest depth at which there is a measurement: against 599 blocks of real honest history, coalitions of 45 seat keys or fewer did not win. At 12 blocks there is no measurement, and a short window gives a smaller coalition a better chance. At the median interval measured on 2026-11-12 (15.6 minutes per 12 blocks), 600 blocks is about 13 hours. **No depth protects against 50 or more seat keys.** Only signature-backed settlement closes that, and it is not built yet. The depth is a node-local setting (`settlement.valueDepth` in Logberg) and is re-measured when the block cadence changes. **What to do:** 1. Show a deposit as pending until `safeForValue` is `true`. A node too old to send `safeForValue` is read as `false`; count `confirmations` against 600 yourself. 2. Before crediting, read `/v1/tx/` again, fresh. Check that `phase` is `final`, `settledForGood` is `true`, `contested` is not `true` and `safeForValue` is `true`. 3. Read `/v1/tx//transfer` and check that the amount, the ledger and the recipient are what you expected. 4. Check that `/v1/status` → `finalityConflict` and `competingBranchWon` are both `null`. While either is not, pause crediting. `finalityConflict` means a recorded fork that may still matter: a branch that is backed, would have won, has been built on, or that this node first heard of late. `competingBranchWon` means a branch outranked blocks this node had reported as `final`, so a payment you already saw at 12 blocks may be gone. An ordinary lost tie is not reported there: two producers sealed one height, this node watched fork choice keep the other block while the height was still above its depth line, nothing was built on the losing block, and most of the peers this node sees share its head. It appears under `staleBranchRejected` (with `lostTie: true`) and does not pause crediting. Ties like this happen about once every 40 minutes. The payment rule in step 2 still counts the tie: `contested` on a payment above it stays `true` until the usual bars pass, so do not skip step 2. 5. A smaller depth than 600 is a risk you choose to take, and it is unmeasured. 6. Keep the ability to reverse a credit while `finalityBacking.backed` is `false`. `finalityConflicts` (JSON-RPC, `{ limit? }`) lists the branches this node recorded below its depth line, newest first, at most 64 per answer, with `wouldHaveWon` on each. **A shorter answer, for a page that shows a sent transaction.** `GET /v1/tx//status` gives one of five states: `unknown`, `dropped` (the node no longer expects it in a block; it may need to be sent again), `seen` (in the node's queue), `in-block` (with the block height and how many of the 12 blocks deep it is) or `deep` (at least 12 blocks deep, the depth the chain treats as settled; settlement here is by depth, not by signatures). `forValue` gives the depth to wait for before shipping goods (600) and whether this reading reached it. Each answer names which archive follower read it and that follower's head height, because it is one node's reading and another node may hold a different view. `words` is a sentence you can show as it stands, and it says how deep rather than using the phase word `final`. It takes a transaction id only, never an address. It does not replace steps 2 to 4 above before you credit anything. **An idle chain is not a halted one.** If the head stops moving, compare `secondsSinceHead` with the 60 s heartbeat. A head older than a few minutes, together with `/v1/ready` answering 503, is worth alerting on. A quiet minute is not. ### 1.6 Supply, for listing sites ```sh curl -s https://api.xplstr.org/v1/supply curl -s https://api.xplstr.org/v1/supply/STR curl -s https://api.xplstr.org/v1/supply/STR/total.txt curl -s https://api.xplstr.org/v1/supply/STR/circulating.txt ``` - **Supply** is what exists on the ledger. - **Circulating** is supply that is **not locked**. On STR, locked includes the 1000 STR held behind each proved STR.domain and STR posted as a validator bond. The locked figure is not broken down by cause. That is the chain's definition, and it is the only one this API publishes. The two `.txt` routes answer one decimal number in whole units, with no rounding, for sites that poll a plain figure. **No price is published.** `GET /v1/price` says so in words. It publishes no market capitalisation, and no circulating figure that leaves out treasury or service accounts. If a listing needs a price, it comes from that listing's own market data, not from this API. ### 1.7 Limits, errors and retries - Each caller has a budget. Over it you get **429** with `Retry-After`. Wait that long and retry. It is a wait, not a ban. - The budget counts your requests, and it also counts the reads your requests make of the chain. - Answers the API already holds are free. - A large answer, such as `/v1/validators`, counts as more than one read. - An IPv6 /64 is one caller. - Cache what you can, and do not poll faster than the chain moves: a block comes about once a minute. - **503** means one of three things, and it always comes with `Retry-After`: - the chain behind the API could not be reached at that moment; - the API is already asking it for as much as it allows itself; - a route that needs the chain index has none. It never comes with a zero standing in for a figure. Retry with backoff. - Index answers (supply, whole history, transfer by id) carry `asOf`: the height the chain index was at. Compare it with `/v1/status` if you need to know they describe the same moment. - **404** means this chain holds no such thing. **400** means a parameter was malformed. Each comes with an `error` sentence. - GET and HEAD only. Everything else is **405**. ### 1.8 From a browser Every answer carries `access-control-allow-origin: *`, so a web page on any origin can read the public routes directly. No cookie or credential is used or honoured. ### 1.9 Stability `/v1` only grows: new routes, new fields. Ignore fields you do not know. A breaking change would come as `/v2`, served beside `/v1`. `GET /v1/openapi.json` is the machine-readable contract, with its version in `info.version`. --- ## Part 2 — Partner keys ### 2.1 What a key is for A partner key gives your servers a budget of their own. Without one, every caller is metered by the address it calls from, so a platform whose servers share one address, or whose users sit behind it, shares that address's budget. With a key, your requests, and the chain reads they cause, are counted to the key, wherever they come from. What stays shared: the API's total capacity to read the chain. All keys together may use at most half of it; the rest is kept for callers without a key. When the keyed half is busy, a keyed request can get `503` with `Retry-After`, the same as anyone. A key unlocks no route and no data. Every answer is the same public answer an anonymous caller gets. ### 2.2 How to get one Keys are issued to partners the owner approves. There is no sign-up page. Ask the SourceLess team, and say which addresses your servers call from if you want the key limited to them. Keys are for **servers only**. There is no key for a web page: a key in a page is published to everyone who opens it. If a page of yours needs chain data, have it call your own backend, which holds the key and calls this API; or have the page call this API without a key. You receive the key once. Only a digest of it is kept on our side, so it cannot be shown to you again: if you lose it, a new one is issued and the old one revoked. ### 2.3 Sending it Send it in the `Authorization` header, from your server: ```sh curl -s https://api.xplstr.org/v1/status \ -H "Authorization: Bearer $SOURCELESS_API_KEY" ``` ```js const answer = await fetch('https://api.xplstr.org/v1/status', { headers: { authorization: `Bearer ${process.env.SOURCELESS_API_KEY}` }, }); ``` - **Only in that header.** A request with a key in the URL or in an `X-API-Key` header is refused with `401`. A URL is written to logs and histories; if your key has been in one, ask for it to be revoked. - **Never from a browser.** A keyed request that carries an `Origin` header, which every browser sends, is refused. - Keep it where you keep other secrets (an environment variable or a secrets store), not in source control. Keys start with `slk_live_`, so a secret scanner can find one that slipped. ### 2.4 Limits and headers By default a key may make 20 requests a second, in bursts of up to 80, and 200,000 requests a UTC day. Your key may have been issued with other numbers. Every answer to a keyed request says where you stand: - `X-RateLimit-Limit`: requests the key may make today (UTC); - `X-RateLimit-Remaining`: how many are left; - `X-RateLimit-Reset`: seconds until the allowance renews at midnight UTC. Over a limit you get **429**, with `Retry-After` and an `errorCode`: - `rate_limited`: faster than the key's budget. Wait `Retry-After` seconds; - `quota_exceeded`: the day's allowance is used. It renews at midnight UTC. Neither is a ban. The counters are kept in memory by the service, so after a restart of the service a key's count for the day starts again from zero. ### 2.5 When a key is refused **401** with `errorCode: "unauthenticated"` means the key was not accepted. The answer is the same whatever the reason: a mistyped key, a revoked one, a call from an address the key is not allowed, a call from a browser, a key sent outside the `Authorization` header, or a fault on our side. That is deliberate, so that the answer tells someone who guesses keys nothing. Ask the SourceLess team; they can see why. Any request that carries an `Authorization` header is treated as keyed. To read without a key, send no `Authorization` header at all. ### 2.6 If a key leaks Tell the SourceLess team at once. A revoked key is refused within a second. A new key is issued to you the same way as the first. --- *Parts 3 and later (watched addresses and signed notifications, and operations) are added when those layers are built.*