Skip to main content
The LumenWipe API reads on-chain state and builds every unsigned transaction of a close. Your code verifies, signs, and submits. A private key never reaches the API. The endpoint pages in this section are generated from the API’s OpenAPI document. Prefer a typed client? The @lumenwipe/sdk package wraps these endpoints.

Base URL

Most routes take the network in the path, either mainnet or testnet, for example /v1/testnet/close/plan. Any other value returns 400 invalid_network.

Versioning

Every integrator route lives under /v1, for example /v1/testnet/account/G..., /v1/config/exchange-registry and /v1/integrator/keys. A breaking change to a request or response gets a new prefix (/v2) instead of changing /v1. GET / and the health routes are operational and stay unversioned. The operator-only key administration routes under /admin are not part of the public API and are not versioned. Paths without the prefix, such as /testnet/account/G..., /{network}/mediator/sign, /config/exchange-registry and /integrator/..., are deprecated aliases. They answer exactly as their /v1 path does, with the same authentication and the same rate-limit budget, and add three headers: The deprecated paths are not listed in the endpoint pages. Move to the /v1 path before the sunset date.

Authentication

Send your API key as a bearer token:
GET /, the health routes, and GET /v1/config/exchange-registry need no key. Everything else does.

Get an API key

Create one on the API keys page:
  1. Sign in with a Stellar wallet that can sign a message: Varial (formerly Freighter), xBull or Hana, or WalletConnect with a phone wallet that supports message signing. The wallet signs a one-time SEP-53 message, not a transaction: it moves no funds and costs no fee. Google and GitHub sign-in are offered there too when they are enabled.
  2. Optionally give the key a label and limit it to mainnet or testnet (both are fixed once it is created, and rotating keeps them; a key limited to one network is refused on routes that take no network), then select Create key. The key is shown once, so copy it to your server’s secrets before you dismiss it.
  3. Call the API with it, or follow the Quickstart to a first testnet close.
The sign-in lasts 30 minutes and survives a page reload in the same browser; after that, sign in again. A contract account (an address starting with C, such as a passkey smart wallet) signs in under Sign in with a contract account: the page fetches a one-time authorization for the account, you sign it with what controls the account and paste it back, or a wallet or Google, GitHub or email account that can sign it does so for you. It is not a transaction either. Whatever key it signs in with, the key it owns works for any account you analyze or close.
Keep the key on your server. A browser application should call the API through its own backend, as the LumenWipe web app does.

Self-serve keys

You manage your keys by signing in with a Stellar wallet: POST /v1/integrator/auth/challenge returns a message to sign, and POST /v1/integrator/auth/session exchanges the signature for a session token that lasts 30 minutes. Sign in again when it expires. The session token only manages keys; it is not an API key. A contract account (C...) signs in after SEP-45 instead: POST /v1/integrator/auth/contract/{network}/challenge returns authorization entries for web_auth_verify on the web authentication contract, the account’s unsigned and the server’s signed. Sign the account’s entry with the account’s own signer, valid until validUntilLedger at the latest, and send the list to POST /v1/integrator/auth/contract/{network}/session within five minutes. The account’s entry must carry address credentials, sorobanCredentialsAddress or sorobanCredentialsAddressV2; the list holds that entry and the server’s and nothing else. Any other credential kind is refused with 401 invalid_challenge and a message naming the kind: source-account credentials, and the delegated-signers credential (sorobanCredentialsAddressWithDelegates, CAP-71), which lets an account name other addresses that sign for it. An account whose own check needs authorization from other addresses cannot sign in. A refusal of this kind does not use up the challenge: sign the same challenge again as address credentials. The session is issued once per challenge, only when the account’s own authorization check accepts the signature on every RPC provider the API uses. A 503 contract_sign_in_unavailable means the network is not set up for it.
  • A wallet holds at most 5 active keys. Creating a sixth answers 409 key_limit_reached; revoke one first.
  • POST /v1/integrator/keys takes an optional label (1 to 64 characters) and an optional networks list (["testnet"], ["mainnet"] or both). A key without networks works on every network.
  • A key with networks is refused with 403 key_network_not_allowed on any other network, and on any keyed route that takes no network. The request does no work before it is refused. The label and networks cannot be changed later, and rotating a key keeps them.
  • Each key has its own rate-limit budget (see Rate limits).
  • GET /v1/integrator/keys returns each key’s label, networks and lastUsedAt. lastUsedAt is written at most once a minute, so it can trail the key’s real use by about a minute, and stays null until a use has been written.
  • Each listed key also carries usage: its successful requests today and over the last 30 UTC days, today included, and the requests refused with 429 over the same 30 days. A key’s 429 count is written at most once a minute and can trail by that much. The top-level usage is still the wallet’s total across all its keys. Counts survive a restart; usage is null when they cannot be read.

Errors

Every error uses the same envelope, whichever endpoint produced it:
Branch on code. The message is written for people and may be reworded, and details appears only when there is more to say. Responses never include stack traces or raw SDK errors. Each endpoint page lists the codes that endpoint can return. Every error response in the OpenAPI document references the ErrorResponseDto schema, with error.code narrowed to the closed set that response can carry. The error reference groups every code by the part of a close it belongs to and says whether to retry and what to show the user. The full registry:

Request ids

Every response, success or error, carries an X-Request-Id header. An error body repeats it as error.requestId. The API generates the id for each request and ignores any value a caller sends. Quote it when you report a problem, so it can be matched to the log line for that request. What the logs hold is described in Logging and privacy.

Rate limits

Requests are limited per API key, and per client IP when a request carries no key. One budget covers every endpoint. The default is 120 requests per 60 seconds. A key issued through the self-serve flow can carry its own limit and window, which replaces the default for that key only. Rate limiting applies before authentication and before the request body is read, so requests without a valid key, unknown routes and malformed bodies count against the budget too. The service index, the health checks and the documentation pages are not limited. Every limited response carries the state of the budget: Exceeding the limit returns 429 rate_limited. The legacy X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers carry the same values and are deprecated. They are not removed before 2027-06-01 (see Compatibility and deprecation), so read the RateLimit-* names. A single runClose over a multi-round account shares this budget with any polling you do, so size your concurrency from RateLimit-Remaining rather than guessing.

Retrying each endpoint

A 504 from submit means the outcome is unknown, not that the transaction failed. Compute the hash from the envelope you signed, then call GET /v1/{network}/transactions/{hash}. Honor Retry-After wherever it is sent. POST submit for an envelope that already confirmed answers 200 with the same hash and ledger, however many times it is sent. The check is by hash through RPC, so it holds for as long as the RPC provider retains the transaction.

Following a close

Use polling. GET /v1/{network}/close/status?source= reads live state and keeps nothing between calls, so it needs no session. It answers one of four phases. remaining does not cover claimable balances or DeFi positions, which the ledger does not count on the account. A full plan covers those. closed is informational: it does not say which transaction merged the account, so confirm a close by the hash of the merge you signed, never by this phase. Each call costs one request against your key’s rate limit, and upstream one RPC read, plus one Horizon read when the account is absent. Poll an account no more often than every 15 seconds: a ledger closes about every 5 seconds, and nothing changes faster than your own transactions. At the default 120 requests per minute that follows about 30 accounts at once, with the rest of the budget spent by RateLimit-Remaining on the close itself. There are no webhooks. Delivering one needs subscriptions, delivery state and signing secrets kept per close, and the API keeps nothing per close. See the design note.

The XLM a close delivered

Once the transactions of a close are confirmed, GET /v1/{network}/close/delivered?destination=G...&hashes=<hash>,<hash> reports the XLM each one delivered to the destination. Pass 1 to 20 distinct hashes, comma-separated. Ask only after transactions/{hash} reports confirmed. The amount is read from the ledger’s own result for each transaction: RPC first, then Horizon when RPC no longer holds it. It is never estimated from the plan. Only two things count:
  • the balance a successful merge into the destination carried, as the merge’s result reports it;
  • for a close routed through the relay account, the successful native payment to the destination from the account a merge earlier in the same transaction went into, at most once per merge and never more than that merge carried.
XLM that reached the destination by any other operation, such as a path payment or a payment without that merge, is not counted, and neither is any asset other than XLM. Each hash gets an entry, in the order asked. An entry that cannot be read as delivered is unavailable with a reason and no amount: totalStroops is present only when every entry is delivered, so a missing amount never reads as zero. A fee-bump answers for its outer or its inner hash. A provider that answers with a different transaction, or one from another network, is a 503, never an amount. One call is one request against your key’s rate limit, however many hashes it carries, and costs up to two upstream reads per hash.

The close loop

A close is a sequence of calls. The API keeps no state between them, so a close can resume after an interruption.
  1. POST /v1/{network}/close/plan returns the full plan and any decisions you must answer.
  2. POST /v1/{network}/close/transactions returns the next unsigned transactions. Verify and sign them.
  3. POST /v1/{network}/submit submits the signed transaction. If the outcome is unknown, resolve it with GET /v1/{network}/transactions/{hash}.
  4. Repeat from step 2 while the response says another call is required.
Each entry of the plan’s decisionPoints carries a subject whose shape depends on its type. For an asset_disposition on a convertible classic asset, subject.quote is the swap quote, in stroops of XLM, priced at the balance the step will move: The quote is display data. To hold the conversion to a figure the user saw, send it as the convert answer’s params.minAmountOut; close/transactions refuses a route that no longer clears it with quote_drifted. quote is absent when no route exists, and for a balance a position’s exit has yet to pay in. For exchange destinations, POST /v1/{network}/mediator/sign co-signs the mediator’s forward payment. To plan several accounts at once, use POST /v1/{network}/close/batch-plan. See how a close works for the flow from a user’s side.