Authorization header. Each example below sets
the header, makes a call and handles a Lumeus error.
Each example reads the key from
LUMEUS_API_KEY (a lum_test_ key for the
Testnet host). Keep keys in an environment variable or secret manager, never in
source.
JavaScript
health.mjs
429 rate_limited RPC rate limit exceeded req_… 2. Branch on error.data; on
429 and 503, wait Retry-After seconds before retrying.
Python
health.py
num_retries=0. The default RequestsClient retries 413, 429,
503 and 504 up to 3 times and sleeps for Retry-After before each retry
(up to 6 hours each). On the daily Testnet cap, Retry-After counts down to
00:00 UTC, so a default client blocks for hours instead of raising. With
num_retries=0, a 429 or 503 raises SorobanRpcErrorResponse at once.
e.data is the Lumeus code (unauthorized, payment_required, rate_limited,
unavailable and the others in RPC errors). The
exception does not carry the HTTP status, Retry-After or request_id; on
rate_limited or unavailable, back off for a few seconds and retry a few
times at most. A rate_limited whose message starts with “daily Testnet
request cap” lasts until 00:00 UTC: stop instead of retrying. Answers that are
not JSON raise BadRequestError or BadResponseError, which carry .status.
Go
Savemain.go below in an empty directory, then:
main.go
-32603 error and keeps
only its text, so a plain http.Client shows just unexpected HTTP status 401 Unauthorized. The lumeus transport above puts the Lumeus code, message,
request_id and Retry-After into that text; search it for the code (for
example rate_limited).
Errors by SDK
Lumeus answers its own errors with HTTP4xx/5xx and a JSON-RPC error body.
What each SDK gives you for the common ones (checked with JS 17.3.0, Python
16.1.1 and Go v0.7.3):
402 payment_required: Mainnet credits are used up on a plan with a hard cap. Do not retry; see billing.429 rate_limited: retry afterRetry-After. When the message is “daily Testnet request cap of 10000 reached; resets at 00:00 UTC”,Retry-Aftercounts down to midnight UTC: stop instead of retrying.503 unavailable: retry afterRetry-After, a few times at most. Forsubmission_outcome_unknownaftersendTransaction, pollgetTransactionfirst; see submit transactions.
Compatibility notes
- Use the Testnet host with a
lum_test_key and the Mainnet host (https://rpc.lumeus.dev) with alum_live_key. A key for the other network gets401with a message naming the right host. - Publishable
lum_pub_keys work only from an allowed browser origin and cannot callsendTransactionorsimulateTransaction. See browser keys. - Lumeus answers its own errors with HTTP
4xx/5xx(public Stellar RPC answers200), so SDKs raise them as transport errors. - RPC keeps up to about 7 days of history. Use the Activity API for full account history and the Assets API for balances.
Next
- Submit transactions: a full Testnet payment in JavaScript and Python.
- Methods: parameters, limits and credits.