naulix — official Python SDK
pip install naulix
from naulix import NaulixClient
naulix = NaulixClient(api_key="sk_test_...")
voyage = naulix.voyages.create(
origin_port_locode = "IEDUB",
destination_port_locode = "DEHAM",
mmsi = "636019825",
amount_rlusd = 10_000,
seller_xrpl_address = "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe",
buyer_xrpl_address = "rUgw8e2x8wMFeB8N3W2mJj6935wB5wimsm",
)
print(voyage["frid"], voyage["stage_1_create_tx_hash"])
Features
- One client, both environments. The key prefix decides — a
sk_test_…key mints testnet escrows, ask_live_…key mints mainnet. No separate base URL to remember. - Idempotency by default. Every write call gets an
Idempotency-Keyheader so SDK-level retries can't double-charge. Passidempotency_key=explicitly when you want a customer-level identity (e.g. one key per logical business operation, persisted in your DB). - Retry on 5xx and transport errors. Three retries with
exponential backoff (0.5s, 1.5s, 4s). 4xx never retries —
codeon the raisedNaulixErrortells you why, so you can fix the request and re-issue. - Structured errors. Every API failure raises
NaulixErrorwith.code,.type,.message,.status_code,.param,.doc_url,.context. Branch on.code(stable), never on.message(human text, may change). - Webhook signature verifier. Standalone helper — use it in your webhook handler regardless of whether you use the SDK for outbound calls.
Error handling
from naulix import NaulixClient, NaulixError
naulix = NaulixClient(api_key="sk_test_...")
try:
naulix.voyages.create(
origin_port_locode = "XXAAA", # not a real LOCODE
destination_port_locode = "DEHAM",
mmsi = "636019825",
amount_rlusd = 10_000,
seller_xrpl_address = "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe",
buyer_xrpl_address = "rUgw8e2x8wMFeB8N3W2mJj6935wB5wimsm",
)
except NaulixError as e:
if e.code == "voyage_invalid_port_locode":
# Don't retry — fix the LOCODE and try again
print(f"Invalid {e.param}: {e.message}")
print(f"See: {e.doc_url}")
elif e.code == "escrow_kyb_required":
# Send the user to KYB
...
else:
raise
See the error-codes catalogue for every code the API can emit.
Verifying webhooks
from naulix import verify_webhook_signature
@app.post("/webhooks/naulix")
def handle():
raw = request.get_data(as_text=True)
sig = request.headers.get("Naulix-Signature", "")
if not verify_webhook_signature(SECRET, signature_header=sig, body=raw):
abort(401)
event = json.loads(raw)
if seen_recently(event["id"]): # dedupe on your side
return ("", 200)
process(event)
return ("", 200)
The verifier is intentionally a free function — you can use it without
ever constructing a NaulixClient. It uses constant-time compare to
defeat timing attacks and rejects timestamps older than 5 minutes by
default (configurable via tolerance_s=).
Sub-clients
| Sub-client | Operations |
|---|---|
naulix.voyages |
create, list, retrieve(id), events(id) |
naulix.api_keys |
list, create, rotate(id), revoke(id) |
naulix.webhook_endpoints |
create, list, retrieve(id), disable(id), rotate_secret(id), deliveries(id), test(id) |
Testing against a local NAULIX
client = NaulixClient(
api_key="sk_test_local",
base_url="http://localhost:8000",
)
Or pass a httpx.Client (or any duck-typed equivalent) via
http_client= to dispatch through a FastAPI TestClient. The
in-repo SDK tests use this pattern — see
Backend/tests/test_xrpl_python_sdk.py.
Versioning
This SDK targets the NAULIX /v1 API surface. Breaking changes to
the API ship under /v2 and require a new major SDK version. We
never retroactively change the response shape of an endpoint or the
meaning of an error code on a stable surface.
License
Apache-2.0.
Metadata
Release files for naulix 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| naulix-0.1.0.tar.gz | 11.7 kB | Without provenance | Details for naulix-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| naulix-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for naulix-0.1.0-py3-none-any.whl |
Total release size: 23.6 kB
Release files / naulix-0.1.0.tar.gz
| Download URL | naulix-0.1.0.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a68b3ca4f8746b3d419e53d5d5fe75cf8863a93649e2ded57bc1237504b8a2e4
|
|
BLAKE2b-256 checksum How to use checksums |
fb8d25ab157118c54e8667112e91ec494949ed942f884ea8cc31495b77ec7891
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / naulix-0.1.0-py3-none-any.whl
| Download URL | naulix-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90aba24a60ddf03dd2674bc3300068fefcb5534dbe04520e9a4512debf4b69f8
|
|
BLAKE2b-256 checksum How to use checksums |
e6f7ac3976bfc6fa73695620d300846462ad89a371109768df4824b3e58be1d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for naulix 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.