Build on TiwiLab.

Everything is one base URL and one bearer token. The SDK is a thin typed wrapper over it — you can use plain fetch if you would rather.

Private beta. Endpoints and response shapes are still moving. We will version them before general availability, and tell you before anything breaks.

Start here

Quickstart

terminal
npm install @tiwi/client @tiwi/swap
app.ts
import { TiwiLab } from "@tiwi/client";

const lab = new TiwiLab({
  apiKey: process.env.TIWILAB_KEY!,   // server-side, or a restricted key in the client
});

const { balances } = await lab.portfolio.get({
  EVM: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
});

console.log(balances.length, "tokens");

The base URL is https://lite.tiwiprotocol.xyz/api. Send your key as Authorization: Bearer tiwi_live_….

Platforms

Web and React Native

One package, both targets. The client makes no assumption about its environment — no Node builtins, no window, no crypto shims — so Metro bundles it without configuration.

native.ts
// React Native: the same package, no polyfills required.
// @tiwi/client is fetch-only - no Node builtins, no window access.
import { TiwiLab } from "@tiwi/client";
Reference

Endpoints

GET/partner/v1/chains0 credits

Every chain we can read, with its canonical id, native currency and explorer.

POST/partner/v1/portfolio10 credits

Every token held by a wallet's addresses, merged across sources and priced.

POST/partner/v1/prices1 credits

USD prices for a list of tokens, keyed by chainId:address, with 24h change where the source reports one.

GET/partner/v1/tokens1 credits

Searchable token list, filterable by chain and category.

GET/partner/v1/token/:chainId/:address1 credits

Metadata for a single token: decimals, symbol, logo, verification status.

POST/partner/v1/quote5 credits

The best route for a swap, same-chain or cross-chain, with alternatives.

GET/partner/v1/usage0 credits

Your own consumption, by endpoint, by hour.

Rate limits

Backoff and headers

Every response carries your current budget. Read these rather than retrying blind — a tight retry loop against a 429 is the fastest way to stay rate limited.

X-RateLimit-LimitYour credits per minute.
X-RateLimit-RemainingCredits left in the current window.
X-RateLimit-ResetUnix seconds when the window resets.
Retry-AfterSeconds to wait. Sent on 429 only.
Errors

One envelope, every time

error.json
{
  "error": {
    "code": "rate_limited",
    "message": "Credit limit exceeded. Retry in 12 seconds.",
    "request_id": "req_a1b2c3d4"
  }
}

Every failure carries a request_id. Send it to us and we can find the exact call in our logs — it is far faster than a description.

Status

Uptime

A public status page ships alongside general availability. During beta, incidents are announced in your dashboard and by email to the address on your account.