Skip to main content
oxinsider is the official Rust client, generated from the OpenAPI document. Every operation is a typed async method named after its operationId in snake case, so listLeaderboard is list_leaderboard. Source at 0xinsider/0xinsider-rust.
The first crates.io release is pending, so cargo add oxinsider does not resolve yet. Until it lands, add the crate from GitHub with the command below.
The crate is named oxinsider because a crate name cannot start with a digit. It runs on Tokio, uses rustls by default, and needs Rust 1.87 or later. default-features = false, features = ["native-tls"] switches to the platform’s TLS.

Run it without a key

No credential, no account. Client::sandbox() sends every operation to the sandbox, which answers with its documented example. Start without a key has the rules, including sandbox_status for error branches.

Then live data

That one line is the whole change. The key can be an API key (oxi_sk_live_...) or an OAuth 2.1 access token (oxi_at_...), and the base URL is https://api.0xinsider.com. A live key needs an account with an active Pro subscription. See Authentication. With OXINSIDER_API_KEY unset, the client has no credential and still reads the public routes. Client::new(key) takes the key directly, and Client::builder() sets the base URL, the timeout, and the retry budget.

Calling an operation

Each method returns the typed response for its operation, and every schema in the document is a type in oxinsider::models. GET /api/v1/stream has no generated method, because open_stream reads it. The two Markdown routes return a String, and the export download returns a streaming Download. A field the API did not report is None, never 0. An enum value this release does not know lands in Other(String), and an unknown JSON key is ignored, so an additive API change does not break a response.

Errors

Branch on code and reason, never on message. ApiError::kind() maps the status to BadRequest, Authentication, SubscriptionRequired, PermissionDenied, NotFound, RateLimited, Server, and the rest. See Errors for every code.

Retries

Following cursors

List operations answer { object: "list", data, has_more, next_cursor, meta }. Pager follows next_cursor until has_more is false:
A page that says has_more without a usable next_cursor, or that repeats a cursor already requested, stops the walk with Error::Pagination instead of truncating it or looping. pagination::collect_all gathers every row when the list is short. See Pagination.

The live stream

client.open_stream(&StreamOptions) reads GET /api/v1/stream frame by frame and holds at most 1 MiB for one undelivered frame. Pass the last seq you processed as last_event_id to resume after a disconnect. A resync frame means the resume point is outside the retained window, so refetch current state before you continue. A frame that breaks the stream’s contract ends it with Error::Stream, whose last_seq says where to resume. The stream has no deadline and is never retried for you.

Credential safety

Which document a release implements

Compare OPENAPI_SHA256 with shasum -a 256 of https://0xinsider.com/api/v1/openapi.json to see whether your release is behind the API.

What this client does not do

  • Place an order or hold a Polymarket key. Every operation is a read except your own webhook and export calls.
  • Round anything. Money and price fields are f64, the precision the API sends.
  • Treat a None as 0. Missing means the provider did not report that value.
  • Retry a write that the API does not replay, such as starting an export.

Go next

Start without a key

Everything that works without a key.

Quickstart

The first reads in curl, Python, and Go.

Authentication

Where a key belongs, and OAuth for an app with users.

Errors

Every code a non-2xx body carries.