Skip to main content
Use the oxinsider crate to call the API from a Tokio application. Each operation is an async method with typed parameters and a typed response. The source repository contains the crate and examples.

Install from GitHub

This command installs the crate from its source repository. You need Rust 1.87 or newer and Tokio. The default TLS implementation is rustls; use default-features = false, features = ["native-tls"] to use the platform’s TLS implementation. The package name is oxinsider, because Rust crate names cannot start with a digit.

Make a request without a key

Use the sandbox to return example data without an account or credential.
Client::sandbox() sends requests to the sandbox origin. See the sandbox page for unsupported operations and the sandbox_status query parameter for error examples.

Switch to live data

Set OXINSIDER_API_KEY in your environment, then create the client with:
The credential can be an API key (oxi_sk_live_...) or an OAuth access token (oxi_at_...). The API origin is https://api.0xinsider.com. Live data requires an active Pro or Max subscription; see Authentication. Without that environment variable, Client::from_env() can still call the public routes. Use Client::new(key) to pass a credential directly, or Client::builder() to set the origin, timeout, and retry budget.

Pass parameters

Method names use the operation’s operationId in snake case: listLeaderboard becomes list_leaderboard. Responses use types in oxinsider::models. An absent field is None. Unknown response enum values become Other(String), and unknown JSON fields are ignored. Use open_stream for the event stream. The Markdown operations return String, and the export download returns a streaming Download.

Handle errors

Branch on code and reason, because message is text for a person. ApiError::kind() groups statuses into values such as Authentication, RateLimited, and Server. See Errors for recovery actions.

Understand automatic retries

Read every page

List responses contain data, has_more, and next_cursor. Pager requests successive pages until has_more is false.
A missing continuation cursor or a repeated cursor returns Error::Pagination. Treat that as a failure to complete the list. pagination::collect_all collects all rows when the result is small enough to keep in memory. Keep filters unchanged while paging. Pagination explains how to handle expired cursors.

Read the live stream

client.open_stream(&StreamOptions) reads Stream one frame at a time. It holds at most 1 MiB for an undelivered frame. Set last_event_id to the last seq you finished processing when reconnecting. A resync frame means that point is outside the retained stream history; refetch current data before continuing. A protocol failure returns Error::Stream with last_seq. The reader does not reconnect automatically and has no total deadline. Close or drop it when your task ends. For a finite task, bound the stream operation and its reads in your application. Inside an async function, with the live client created above:
A timeout drops the stream reader and closes the connection. Save your last completed sequence separately if you need to resume.

Protect the credential

Check the generated API document

Compare OPENAPI_SHA256 with the SHA-256 of the published OpenAPI document. Check the changelog when the documents differ.

Limits

  • The client does not place Polymarket orders or hold a wallet key.
  • Webhook and export operations can change resources on your 0xinsider account.
  • Display numeric fields use f64. Keep their precision until display, and use exact decimal strings when a response provides them.
  • An absent field remains None; do not substitute zero.
  • A write that cannot be safely replayed, such as starting an export, is not retried automatically.