Settlex Flow - Gateway
The Settlex Gateway is a pay-per-request proxy that lets you call third-party provider APIs using your credits.
Base URL:
settlex-gateway.luganodes.comProtocol: HTTP/REST Authentication: API Key
Prerequisites
Before using the gateway you must have a funded Settlex account. Set up is done through the Settlex API (/api service):
1. Create an account
POST /api/onboarding/signup
User account
2. Log in
POST /api/onboarding/login
JWT token
3. Create a Canton party
POST /api/party/create (Auth: Bearer token)
Ledger identity (partyId)
4. Generate an API key
POST /api/api-key/create
(Auth: Bearer token)
Raw API key (shown once)
5. Fund your party
Transfer Canton Coin to your party via the Canton Network
Spendable balance
Once you have an active API key and a funded balance, you are ready to use the gateway.
Authentication
Every gateway request must include your API key in the x-settlex-api-key header.
x-settlex-api-key: <your_api_key>The gateway verifies it against the database, and resolves your Canton party identity. The key header is stripped before the request is forwarded to the upstream provider — providers never see your Settlex credentials.
Authentication Errors
401
{ "message": "Unauthorized" }
Missing header or unknown API key
403
{ "message": "API Key is no longer active" }
Key has been deactivated
403
{ "message": "User does not have a party" }
User has no Canton party onboarded with us
Making Requests
All requests follow one pattern:
<METHOD>
Any HTTP method (GET, POST, PUT, DELETE, etc.)
<providerKey>
The unique identifier of the registered provider
<upstream_path>
The path the provider expects (forwarded as-is)
The gateway strips /gateway/<providerKey> from the path before forwarding. For example:
is forwarded to the acme-ai provider as:
The request body, query parameters, and most headers are forwarded transparently. The provider's response (status code, headers, body) is returned to you as-is.
Example
Required Headers
Every gateway request must include both of these headers:
x-settlex-api-key
string
Your Settlex API key
Any additional headers your provider expects (e.g. Content-Type) should be included as normal.
Request Lifecycle
Every request passes through four stages before the provider response reaches you:
Error Responses
Provider Errors
If the upstream provider successfully sends a full HTTP response (success or error), they are forwarded to you as-is. If the gateway encounters errors while communicating (internal or transport level error) with the provider for any reason, custom errors are sent by the gateway.
Gateway Errors
All gateway errors return JSON in the format:
400
"Idempotency key is required"
Idempotency
Missing idempotency-key header
400
"Idempotency key must be a string, and not an array"
Idempotency
Header has multiple values
400
"Provider key is required"
Reservation
Invalid URL path
401
"Unauthorized"
Auth
Missing or invalid API key
403
"API Key is no longer active"
Auth
Deactivated API key
403
"User does not have a party"
Auth
No Canton party on account
403
"Party does not have enough balance"
Reservation
Insufficient CC balance
403
"Provider is not active"
Reservation
Provider is disabled or degraded
404
"Provider not found"
Reservation / Proxy
Unknown providerKey
500
"Internal server error"
Any
Unexpected server error
502
"Bad gateway: provider unavailable"
Proxy
Provider connection failed
502
"Bad gateway: upstream aborted response"
Proxy
Provider dropped the connection
502
"Bad gateway: upstream response stream error"
Proxy
Provider response stream broke
On any upstream failure (
4xx,5xx, timeout, connection error), reserved funds are automatically released.
Idempotency
Every request requires an idempotency-key header — a client-generated string that uniquely identifies the request. Idempotency keys are scoped to the combination of:
idempotency key (your value)
provider key (from the URL path)
party ID (from your account)
This means the same idempotency key can be safely reused across different providers.
Duplicate Request Response
If a reservation already exists for the same (idempotencyKey, providerKey, partyId) tuple, the gateway returns:
Reservation Statuses
request_in_flight
Request sent to provider, awaiting response
registered
Provider responded successfully (2xx/3xx)
failed
Provider returned an error or was unreachable; funds released
queued
Processing has begun, awaiting ledger finalization
settled
Transaction completed on ledger
Balance & Billing
Each provider has a fixed cost per request in USD. When you make a request, the gateway:
Converts the USD cost to Canton Coin (CC) using the current exchange rate.
Checks that your available balance minus reserved balance is sufficient.
Atomically reserves the CC amount from your balance.
On success, the reservation stays and the funds are considered spent. On failure, the reserved amount is released back to your available balance.
You can check your current balance at any time via the Settlex API:
balance— total available Canton CoinreservedBalance— amount currently locked for in-flight requestsSpendable =
balance - reservedBalance
Last updated