Skip to main content
github.com/0xinsider/0xinsider-go is the official Go client, generated from the OpenAPI document. Every operation has a typed ...WithResponse method. Source at 0xinsider/0xinsider-go.
Go 1.26.5 or newer, one dependency (github.com/oapi-codegen/runtime). This page is written against v0.3.0, which implements all 67 operations.

Run it without a key

No credential, no account. WithBaseURL("https://0xinsider.com/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. WithBearerToken takes an API key (oxi_sk_live_...) or an OAuth 2.1 access token (oxi_at_...), and the base URL defaults to oxinsider.DefaultServer, https://api.0xinsider.com. The client reads no environment variable on its own, so name it OXINSIDER_API_KEY to match the Python client, the CLI, and the MCP server. A live key needs an account with an active Pro subscription. See Authentication. A client built without WithBearerToken still reads the 6 public routes.

Deadlines

A client from oxinsider.New bounds every ordinary request: DefaultRequestTimeout (30 seconds) end to end, DefaultDownloadTimeout (5 minutes) for the export download, over a transport that also bounds the dial, the TLS handshake, and the wait for response headers. A call you gave no deadline is still bounded.
A deadline the client applied comes back as *oxinsider.RequestTimeoutError, which carries Deadline, Method, and URL, unwraps to context.DeadlineExceeded, and reports Timeout() bool. You can tell it from a deadline of your own. A context deadline you pass always wins, so keep passing one for the call that deserves a tighter bound than 30 seconds. WithRequestTimeout(0) removes the total bound and leaves the connection-level ones in place. GET /api/v1/stream is excluded, and is bounded by OpenStream’s start and idle timeouts instead: a healthy stream that has nothing to say is never cut after 30 seconds, while one that stops producing frames still fails in finite time.
v0.2.0 and earlier added no timeout of their own, and net/http has none by default: a call with context.Background() against a stalled connection waited forever. Upgrading to v0.3.0 is how you get the bound.

Reading a response

JSON200, JSON201, and the other status fields hold the decoded body for that status and are nil for any other. Body keeps the raw bytes and StatusCode() the status, so a branch on JSON200 == nil is how you notice an error.
Optional fields are pointers, because the API omits a field it has no value for. A nil Grade means the wallet has no grade, not an F. Never dereference without the check.

Credential safety

Which document a release implements

Compare OpenAPISHA256 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.
  • Read a key from the environment. You pass it to WithBearerToken.
  • Retry a failed request. A 429 or a 503 comes straight back to you.
  • Round anything. Money and price fields keep the API’s precision.
  • Treat a nil pointer as 0. Missing means the provider did not report that value.

Go next

Start without a key

Everything that works without a key.

Quickstart

The same 5 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.