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:
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 withvpx_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
limitandcursor, and answernextCursor: pass it back until it isnull. - 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
429or5xx. - Retries. Placing an order twice places two orders. If
POST /orderstimes out, look atGET /ordersbefore 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/mcpwith a tool for each market, account and trading endpoint.
Endpoints
Markets
/api/v1/marketsMarkets with their prices, newest firstGET/api/v1/markets/{marketId}One market by id or slugGET/api/v1/markets/{marketId}/bookBids and offers, in YES termsGET/api/v1/markets/{marketId}/historyThe market's price chart, oldest firstGET/api/v1/tradesExecutions on VPX, newest firstGET/api/v1/groupsQuestions with several answers, newest firstGET/api/v1/groups/{groupId}One group, with every market in itAccount
/api/v1Every endpoint, and who you are signed in asGET/api/v1/accountWho you are and your cash· keyGET/api/v1/positionsThe shares you hold, with their prices· keyGET/api/v1/ordersYour open orders, or your order history· keyGET/api/v1/orders/{orderId}One of your orders, with its fills· keyGET/api/v1/fillsEvery execution of your orders, newest first· keyGET/api/v1/settlementsWhat resolved markets paid you, newest first· keyGET/api/v1/account/historyYour main wallet's value, day by day· keyTrading
API keys
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.
| Status | Codes |
|---|---|
400 | BAD_REQUEST (see details), BAD_PRICE, BAD_CURSOR, INSUFFICIENT_FUNDS, INSUFFICIENT_SHARES, MARKET_CLOSED, POSITION_LIMIT |
401 | UNAUTHORIZED (no key), INVALID_KEY (wrong or revoked) |
403 | FORBIDDEN (e.g. a VPX bot calling a key endpoint) |
404 | NOT_FOUND, MARKET_NOT_FOUND (also a private market you haven't joined), GROUP_NOT_FOUND, ORDER_NOT_FOUND, REQUEST_EXPIRED |
405 | METHOD_NOT_ALLOWED |
409 | ORDER_NOT_OPEN, TOO_MANY_KEYS, REQUEST_ANSWERED |
413 | BODY_TOO_LARGE (over 1 MB) |
429 | RATE_LIMITED: wait, then try again |
500 | INTERNAL: try again after a short backoff |