API Reference

The base URL is https://api.inklemarket.com. Every response is wrapped in an envelope, so your payload always lives under data.

Interactive Swagger / OpenAPI

Explore and try every endpoint in the interactive Swagger UI, or feed the machine-readable OpenAPI spec to a client generator:

Generate a client in any language straight from the spec:

bash
npx @openapitools/openapi-generator-cli generate \
  -i https://api.inklemarket.com/v1/docs-json \
  -g typescript-fetch -o ./inkle-client

Response envelope

Success and failure share the same shape:

json
// success
{ "status": "SUCCESS", "data": { "id": "…" } }

// failure
{ "status": "FAIL", "errorCode": "…", "error": "insufficient $USDI balance" }

The error field carries a human-readable message. Match on the HTTP status for programmatic handling (see error codes).

Markets (public read)

GET/v1/usdi/market?status=open&limit=5Public

List markets. Filters: status (open/closed/resolved/void), kind (flash/pvp_lmsr/pvp_direct), page, limit (max 100).

Response

json
{
  "status": "SUCCESS",
  "data": {
    "items": [
      {
        "id": "5605577f-1af3-41ab-904d-ca3ca1c8926c",
        "kind": "pvp_lmsr",
        "question": "Will BTC close above $100k in July?",
        "status": "open",
        "outcomeLabels": ["Yes", "No"],
        "closesAt": "2026-08-01T00:00:00.000Z",
        "totalPool": 259.94,
        "betCount": 8,
        "lmsr": { "prices": [0.62, 0.38], "seed": 50, "alpha": 0.05 }
      }
    ],
    "count": 112,
    "page": 1,
    "limit": 5
  }
}
GET/v1/usdi/market/:idPublic

Full market detail with per-outcome pools and live LMSR state.

Response

json
{
  "status": "SUCCESS",
  "data": {
    "id": "5605577f-…",
    "kind": "pvp_lmsr",
    "question": "Will BTC close above $100k in July?",
    "outcomes": [
      { "index": 0, "label": "Yes", "pool": 130, "impliedProbability": 0.62 },
      { "index": 1, "label": "No",  "pool": 125, "impliedProbability": 0.38 }
    ],
    "lmsr": { "prices": [0.62, 0.38], "qShares": [311.46, 233.79] }
  }
}
GET/v1/usdi/market/:id/lmsr-quote?outcomeIndex=0&collateral=10Public

Preview a trade before placing it. For a sell, pass side=sell&shares= instead of collateral.

Response

json
{
  "status": "SUCCESS",
  "data": {
    "outcomeIndex": 0,
    "collateral": 10,
    "shares": 16.35,
    "avgPrice": 0.6116,
    "priceBefore": 0.60,
    "priceAfter": 0.63
  }
}
GET/v1/usdi/market/:id/price-ticks?limit=200Public

Full-vector price history. Every outcome's price at each tick, oldest first.

Response

json
{
  "status": "SUCCESS",
  "data": {
    "marketId": "5605577f-…",
    "ticks": [
      { "ts": "2026-07-12T05:12:22Z", "prices": [0.53, 0.47], "outcomeIndex": null, "side": null },
      { "ts": "2026-07-12T05:13:02Z", "prices": [0.62, 0.38], "outcomeIndex": 0, "side": "buy", "execPrice": 0.58 }
    ]
  }
}
GET/v1/usdi/market/:id/bets?limit=20Public

Recent public trades with identity-safe user info.

Response

json
{
  "status": "SUCCESS",
  "data": [
    {
      "id": "27385e0a-…",
      "outcomeIndex": 0,
      "side": "buy",
      "stake": 5,
      "shares": 8.3,
      "createdAt": "2026-07-12T05:13:02Z",
      "user": { "displayName": "alice", "avatarUrl": null, "isTwitterVerified": true }
    }
  ]
}

Trading (API key with the trade scope)

POST/v1/usdi/market/pvp-lmsrAPI key · trade

Create an open LS-LMSR pool that anyone can trade. Your seed becomes the pool's initial liquidity.

Request body

json
{
  "question": "Will it rain in Seoul tomorrow?",
  "outcomeLabels": ["Yes", "No"],
  "closesAt": "2026-08-01T00:00:00Z",
  "seed": 50
}

Response

json
{
  "status": "SUCCESS",
  "data": { "id": "4a3af3ec-…", "kind": "pvp_lmsr", "status": "open" }
}
POST/v1/usdi/market/pvp-directAPI key · trade

Create a fixed-odds duel: you take one side, the field takes the other.

Request body

json
{
  "question": "Will Team A win?",
  "outcomeLabels": ["A", "B"],
  "closesAt": "2026-08-01T00:00:00Z",
  "creatorOutcome": 0,
  "creatorStake": 20,
  "creatorOdds": 2.0
}

Response

json
{
  "status": "SUCCESS",
  "data": { "id": "…", "kind": "pvp_direct", "status": "open" }
}
POST/v1/usdi/market/flashAPI key · trade

Open a 10-minute UP/DOWN pool priced against a live Pyth feed.

Request body

json
{ "asset": "BTC" }

Response

json
{
  "status": "SUCCESS",
  "data": { "id": "…", "kind": "flash", "asset": "BTC", "status": "open" }
}
POST/v1/usdi/market/:id/betAPI key · trade

Buy outcome shares with $USDI. Debits your balance.

Request body

json
{ "outcomeIndex": 0, "stake": 5 }

Response

json
{
  "status": "SUCCESS",
  "data": {
    "id": "…", "outcomeIndex": 0, "side": "buy",
    "stake": 5, "shares": 8.3, "costPaid": 5, "status": "active"
  }
}
POST/v1/usdi/market/:id/sellAPI key · trade

Sell LMSR shares back to the pool for a $USDI refund.

Request body

json
{ "outcomeIndex": 0, "shares": 2.5 }

Response

json
{
  "status": "SUCCESS",
  "data": { "id": "…", "side": "sell", "shares": 2.5, "costPaid": -1.4 }
}
GET/v1/usdi/market/:id/my-betsAPI key · read

Your positions on a market.

Response

json
{
  "status": "SUCCESS",
  "data": [
    { "id": "…", "outcomeIndex": 0, "side": "buy", "shares": 8.3, "status": "active" }
  ]
}

Flash pools (on-chain, public read)

GET/v1/flashPublic

List on-chain flash pools.

Response

json
{
  "status": "SUCCESS",
  "data": {
    "items": [
      {
        "id": "e5fa00bd-…",
        "asset": "BTC",
        "status": "open",
        "poolCap": 100,
        "creatorSide": "up",
        "basePrice": 64978.78,
        "bettingEndsAt": "2026-07-12T05:20:00Z",
        "betCount": 3,
        "poolTokenSymbol": "USDC"
      }
    ]
  }
}
GET/v1/flash/:idPublic

Pool detail.

Response

json
{
  "status": "SUCCESS",
  "data": {
    "id": "e5fa00bd-…", "asset": "BTC", "status": "open",
    "basePrice": 64978.78, "settlePrice": null, "poolCap": 100,
    "creatorSide": "up", "betCount": 3, "poolTokenSymbol": "USDC"
  }
}
GET/v1/flash/:id/betsPublic

Recent bets on a flash pool.

Response

json
{
  "status": "SUCCESS",
  "data": [{ "id": "…", "side": "down", "amount": 10, "createdAt": "2026-07-12T05:14:00Z" }]
}
GET/v1/flash/:id/quote?amount=10Public

Estimated payout for a bet of the given size.

Response

json
{
  "status": "SUCCESS",
  "data": { "estPayout": 18.4, "probabilityAfter": 0.54 }
}
GET/v1/flash/price/:assetPublic

Live Pyth price for BTC / ETH / BNB / SOL.

Response

json
{ "status": "SUCCESS", "data": { "asset": "BTC", "price": 98450.12 } }

Account (API key with the read scope)

GET/v1/user/meAPI key · read

Your profile and identity.

Response

json
{
  "status": "SUCCESS",
  "data": { "id": 3, "walletAddress": "0xa77d…", "displayName": "alice" }
}

Discovery (public read)

GET/v1/market/search?q=bitcoinPublic

Full-text search across on-chain markets.

Response

json
{
  "status": "SUCCESS",
  "data": [
    {
      "id": "5605577f-…",
      "topic": "Will BTC close above $100k in July?",
      "category": "crypto",
      "status": "active",
      "outcomeCount": 2,
      "totalPool": "500.00",
      "deadline": "2026-07-19T14:59:00Z"
    }
  ]
}
GET/v1/market/trendingPublic

Markets ranked by recent activity.

Response

json
{
  "status": "SUCCESS",
  "data": [
    {
      "id": "7cc68e4b-…",
      "topic": "Will the US confirm aliens exist before 2027?",
      "category": "politics",
      "status": "active",
      "participantCount": 24,
      "betCount": 61,
      "deadline": "2027-02-26T14:59:00Z"
    }
  ]
}
GET/v1/leaderboard?rail=usdi&limit=50Public

Top users on one asset rail. Query: rail (usdi | onchain, defaults to onchain), sortBy (totalWon | winRate | roi | marketsCreated), limit (max 200). Each rail is its own board because USDC and $USDI are different currencies; amounts are denominated in the rail you asked for.

Response

json
{
  "status": "SUCCESS",
  "data": [
    {
      "rank": 1,
      "id": "3",
      "displayName": "Inkle Traders",
      "walletAddress": "0xa77d…",
      "totalWon": 467.34,
      "winRate": 11.11,
      "betsPlaced": 9,
      "marketsCreated": 9
    }
  ]
}

Portfolio (API key with the read scope)

Portfolio responses span both rails. On-chain markets settle in USDC against a contract; $USDI markets settle on our off-chain ledger. Tell them apart by tokenSymbol, and note that the two are different currencies, so do not add their amounts together.

$USDI rows carry market.isUsdi: true and a null txHash, and no onChainId at all, since a ledger market has none. Winnings are credited to the ledger balance at settlement and come back with status: "claimed", so there is nothing to claim on-chain and no transaction to send. Filter by status=claimed to list $USDI wins; status=won covers on-chain wins awaiting a claim.

GET/v1/user/me/positionsAPI key · read

Your open positions on both rails, aggregated per outcome with live mark-to-market P&L. Settled $USDI positions are not listed: the ledger pays them out at resolution, so they appear in the bet history instead.

Response

json
{
  "status": "SUCCESS",
  "data": [
    {
      "marketId": "170faa44-…",
      "marketTopic": "Junwoo",
      "marketStatus": "closed",
      "tokenSymbol": "USDC",
      "outcomeIndex": 1,
      "outcomeLabel": "No",
      "totalSharesBought": 4675.89,
      "totalCost": 2500,
      "avgCost": 0.5347,
      "currentPrice": 0.5248,
      "currentValue": 2453.75,
      "unrealizedPnL": -46.25,
      "unrealizedPnLPct": -1.85
    },
    {
      "marketId": "6a129a59-…",
      "marketTopic": "2026 World Cup Final: Spain vs Argentina",
      "marketStatus": "active",
      "tokenSymbol": "USDI",
      "outcomeIndex": 0,
      "outcomeLabel": "Spain",
      "totalSharesBought": 164.24,
      "totalCost": 70,
      "avgCost": 0.4262,
      "currentPrice": 0.3723,
      "currentValue": 61.15,
      "unrealizedPnL": -8.85,
      "unrealizedPnLPct": -12.64
    }
  ]
}
GET/v1/user/me/betsAPI key · read

Your bet history on both rails, newest first.

Response

json
{
  "status": "SUCCESS",
  "data": [
    {
      "id": "9c878f7c-…",
      "marketId": "5605577f-…",
      "outcomeIndex": 0,
      "outcomeLabel": "Yes",
      "amount": "17.55",
      "tokenSymbol": "USDC",
      "sharesBought": "-92.40",
      "status": "confirmed",
      "txHash": "0xc3a5f6…",
      "createdAt": "2026-07-13T10:25:32Z"
    },
    {
      "id": "6b2c1d90-…",
      "marketId": "6a129a59-…",
      "outcomeIndex": 0,
      "outcomeLabel": "Spain",
      "amount": "70.0000",
      "tokenSymbol": "USDI",
      "sharesBought": "164.2421426016",
      "status": "claimed",
      "payout": "164.2421",
      "txHash": null,
      "createdAt": "2026-07-19T21:14:08Z",
      "market": { "isUsdi": true, "kind": "pvp_lmsr", "tokenSymbol": "USDI" }
    }
  ]
}
GET/v1/user/me/marketsAPI key · read

Markets you created on either rail.

Response

json
{
  "status": "SUCCESS",
  "data": [
    {
      "id": "5605577f-…",
      "topic": "clever test",
      "category": "crypto",
      "status": "active",
      "outcomeCount": 2,
      "totalMarketSize": "500.00",
      "deadline": "2026-07-19T14:59:00Z"
    },
    {
      "id": "6a129a59-…",
      "topic": "2026 World Cup Final: Spain vs Argentina",
      "category": "sports",
      "status": "resolved",
      "tokenSymbol": "USDI",
      "outcomeCount": 2,
      "totalMarketSize": "5480.0000",
      "deadline": "2026-07-19T22:00:00Z",
      "isUsdi": true,
      "kind": "pvp_lmsr"
    }
  ]
}

Key management (session only)

These need a signed-in web session, not an API key, so a key can never mint another key. Manage them under Settings > API Keys.

POST/v1/api-keysSession only

Create a key. The raw key is returned exactly once.

Request body

json
{ "name": "trading bot", "scopes": ["read", "trade"] }

Response

json
{
  "status": "SUCCESS",
  "data": {
    "id": "…", "name": "trading bot", "scopes": ["read", "trade"],
    "key": "ik_live_ab12cd34ef56_…"
  }
}
GET/v1/api-keysSession only

List your keys. Hashes never leave the server.

Response

json
{
  "status": "SUCCESS",
  "data": [
    {
      "id": "…", "name": "trading bot", "keyPreview": "ik_live_ab12cd34ef56_…",
      "scopes": ["read", "trade"], "lastUsedAt": "2026-07-13T02:00:00Z",
      "revokedAt": null, "createdAt": "2026-07-13T01:00:00Z"
    }
  ]
}
DELETE/v1/api-keys/:idSession only

Revoke a key. Takes effect immediately.

Response

json
{ "status": "SUCCESS", "data": { "id": "…", "revokedAt": "2026-07-13T02:05:00Z" } }
GET/v1/api-keys/:id/usageSession only

Trading volume attributed to a key (builder program).

Response

json
{
  "status": "SUCCESS",
  "data": { "keyId": "…", "name": "trading bot", "attributedTrades": 42, "attributedVolumeUsdi": 1830.5 }
}