Skip to main content
Lumeus RPC speaks standard Stellar JSON-RPC, so the official Stellar SDKs work once they send your key in the 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
Output with a valid key, then with a bad key:
Over the rate limit the same code prints, for example, 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
Output with a valid key, then with a bad key:
Always pass 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

Save main.go below in an empty directory, then:
main.go
Output with a valid key, then with a bad key:
The Go client flattens every transport failure into a -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 HTTP 4xx/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 after Retry-After. When the message is “daily Testnet request cap of 10000 reached; resets at 00:00 UTC”, Retry-After counts down to midnight UTC: stop instead of retrying.
  • 503 unavailable: retry after Retry-After, a few times at most. For submission_outcome_unknown after sendTransaction, poll getTransaction first; see submit transactions.

Compatibility notes

  • Use the Testnet host with a lum_test_ key and the Mainnet host (https://rpc.lumeus.dev) with a lum_live_ key. A key for the other network gets 401 with a message naming the right host.
  • Publishable lum_pub_ keys work only from an allowed browser origin and cannot call sendTransaction or simulateTransaction. See browser keys.
  • Lumeus answers its own errors with HTTP 4xx/5xx (public Stellar RPC answers 200), 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