Regarding the future of VPX — Read our announcement →
vancouverpx
← Back to Markets

API Documentation

One API for markets, your account and trading, for scripts, AI agents and VPX Bots

The VPX API

Read markets, see your account and trade on VPX from your own code. Your scripts, your AI agents and VPX Bots all use these same endpoints. Market data needs no key; your account and trading need an API key.

Quickstart

1. Get a key. Press Create a key on your Developer page, while signed in. Or let your coding agent ask for one: it sends you a link, and you press Approve.

2. Call the API.

# No key needed for market data
curl "https://www.vancouverpx.ca/api/v1/markets?status=OPEN&limit=5"

Or let an agent build it. Paste this into Claude Code, Codex or Cursor, and it gets its key and connects itself:

Prompt
Read https://www.vancouverpx.ca/docs/api/claude.md first: it explains VPX and its API. Then set me up with the VPX API: if VPX_API_KEY isn't in .env, get a key with the key request flow (open the approval page for me and wait for my approval), save it to .env as VPX_API_KEY (make sure .env is gitignored), and show me my balance and open positions.

Build with AI agents has a CLAUDE.md with everything about VPX and this API, and prompts for a data collector, rebuilding your PnL, a market maker and more.

Basics

  • Base URL https://www.vancouverpx.ca/api/v1. JSON in and out. Any website may call it from a browser: CORS is open, and keys go in a header, never a cookie.
  • Keys go in Authorization: Bearer <key>. They start with vpx_live_ and are shown once, when made. Revoke one on your Developer page and it stops working at once.
  • Cents. Prices (1 to 99), cash and volume are integer cents. A YES and a NO share pay 100¢ together, so buying NO at 40¢ is selling YES at 60¢. Each market has one order book, in YES terms.
  • Ids or slugs. Wherever the API takes a market id, the market's slug (the end of its address on the website) works too.
  • Pages. Lists take limit and cursor, and answer nextCursor: pass it back until it is null.
  • Strict. A parameter an endpoint doesn't take is an error that lists the ones it does, never ignored, so a typo can't widen what you read or cancel.
  • Polling. There are no websockets. Keep to a few requests a second, and back off on 429 or 5xx.
  • Retries. Placing an order twice places two orders. If POST /orders times out, look at GET /orders before you send it again.
  • Machine-readable. The OpenAPI 3.1 spec, the whole reference in one markdown file, and an MCP server at https://www.vancouverpx.ca/api/mcp with a tool for each market, account and trading endpoint.

Endpoints

Errors

Every error answers { "error": "<what went wrong>", "code": "<CODE>" }, plus details (which fields, and why) when the request itself was wrong. Branch on code, never on the wording of error.

StatusCodes
400BAD_REQUEST (see details), BAD_PRICE, BAD_CURSOR, INSUFFICIENT_FUNDS, INSUFFICIENT_SHARES, MARKET_CLOSED, POSITION_LIMIT
401UNAUTHORIZED (no key), INVALID_KEY (wrong or revoked)
403FORBIDDEN (e.g. a VPX bot calling a key endpoint)
404NOT_FOUND, MARKET_NOT_FOUND (also a private market you haven't joined), GROUP_NOT_FOUND, ORDER_NOT_FOUND, REQUEST_EXPIRED
405METHOD_NOT_ALLOWED
409ORDER_NOT_OPEN, TOO_MANY_KEYS, REQUEST_ANSWERED
413BODY_TOO_LARGE (over 1 MB)
429RATE_LIMITED: wait, then try again
500INTERNAL: try again after a short backoff
API Overview | VPX Docs