Overview
The Rust SDK provides:- structured
LimitlessErrorvariants - HTTP
ApiErrordetails with status, method, URL, and response payload - reusable retry helpers via
with_retryandRetryableClient - optional logging hooks for retry visibility
Error types
All SDK methods return:LimitlessError
Inspecting API errors
Authentication-required errors
The SDK fails early for authenticated methods when no credentials are configured:Raw HTTP responses
Every API-backed service method has a*_with_raw sibling that returns Result<SdkResponse<T>>. Use it when you need the HTTP status, response headers (rate-limit metadata, request IDs, content-type), or the exact response bytes alongside the decoded value. The base method (without the suffix) is unchanged and still returns just the decoded value.
The raw variant still returns the same LimitlessError::Api(ApiError) on any response with status >= 400. It only exposes the raw response on success.
SdkResponse<T>
RawResponse
The
*_with_raw variant is available on every API-backed method (markets, portfolio, orders, AMM, API tokens, delegated orders, partner accounts, and market pages). WebSocket subscriptions are not affected.with_retry
Use with_retry() to wrap any async operation:
429500502503504- connection failures
- timeouts
425 Too Early is not retried by default. If the API body has a trading-mode code, refresh maintenance status and do not retry the same blocked action. Otherwise, treat POST /orders failures as receive-window failures and rebuild a fresh signed order.
RetryableClient
Use RetryableClient when you want a retrying HTTP transport wrapper:
Client from the same HttpClient:
Retry callbacks
Attach a callback to observe retry attempts:Logging
Retry helpers accept an optionalSharedLogger. Use ConsoleLogger during integration work: