REST API
Overview
Base URLs, credentials, request and response formats, units, pagination and limits that apply to every REST API endpoint.
The REST API serves market data, your account and positions, and the orders you place and remove. Every endpoint in this section follows the rules on this page.
Base URLs
| Network | Base URL | API key |
|---|---|---|
| BNB Mainnet | https://api.predict.fun | Required |
| BNB Testnet | https://api-testnet.predict.fun | Not needed |
Every path starts with /v1, for example https://api.predict.fun/v1/markets.
Credentials
| Header | Value | Needed for |
|---|---|---|
x-api-key | Your API key from the developer console | Every mainnet request |
Authorization | Bearer <jwt> | Requests that act for a wallet, such as creating, reading and removing its orders |
Each endpoint's page lists the credentials it needs under Authorization. Log in shows how to get a JWT for a wallet. For a Predict account, see Authentication.
On testnet, leave x-api-key out. Testnet doesn't need a key, but it rejects an invalid one.
Requests
Send request bodies as JSON, with Content-Type: application/json. Query and path parameters are listed on each endpoint's page.
Amounts and prices in orders are integer strings in wei, where 10^18 is 1 USDT or 1 share. For example, a price of 0.40 is "400000000000000000". A decimal string such as "0.4" is rejected.
Responses
A successful response has success: true. Most endpoints put their result in data:
{
"success": true,
"data": { "message": "Please sign this message to log in. …" }
}A list adds a cursor for the next page (see Pagination). A few endpoints, such as Remove orders, return their fields next to success instead of in data. Each endpoint's page shows its response.
An error has success: false, the HTTP status in code, and a stable code in error to match on:
{
"success": false,
"code": 401,
"error": "unauthorized",
"message": "invalid signature",
"timestamp": "2026-11-04T20:37:19.030930831Z"
}Errors lists every code with its fix.
Units and timestamps
- Share amounts in responses, such as a position's
amountor an order'samountFilled, are wei strings, like the amounts you send. - Order book prices and sizes are plain numbers, such as
[0.62, 1500]: a price between 0 and 1 and a number of shares. See Prices and order book. - Fee rates such as
feeRateBpsare in basis points, where 100 is 1%. - Times in fields named
…At, such ascreatedAt, are date-time strings. Fields named…TimestampMsare milliseconds since the Unix epoch.
Pagination
List endpoints return one page at a time:
- Set the page size with
first. The table below gives each endpoint's default and maximum. - Read
cursorfrom the response. - Send it back as
afterto get the next page.
When there are no more pages, cursor is null.
| Endpoints | Default first | Maximum first |
|---|---|---|
GET /v1/categories, GET /v1/markets, GET /v1/positions, GET /v1/positions/{address}, GET /v1/series/{slug}/rounds | 20 | 100 |
GET /v1/orders, GET /v1/orders/matches, GET /v1/account/activity, GET /v1/account/{address}/activity, GET /v1/maker-rebates, GET /v1/referral-fees | 50 | 150 |
A first outside that range isn't rejected. A larger value is read as the maximum, and a value below 1 is read as 1.
Limits
Each API key has a request budget per minute. A key can also have a per-second cap on order placement and removal. Responses carry RateLimit-* headers with your remaining budget, except when the API key is rejected. A request over the limit gets a 429. See Rate limits.
Try it in the browser
Every endpoint's page has a Try in Playground button that sends the request from your browser. It uses mainnet unless you pick the testnet server. Enter your API key, and a JWT for wallet endpoints, in its Authorization fields.
The OpenAPI document behind these pages is at /openapi/rest.json. You can use it to generate a client.
How-tos
Log in
Get a JWT for a wallet, and send it with the wallet's requests.
Send an order
Send a signed order, and read its status.
Remove orders
List a wallet's open orders, and remove them from the book.
For the SDK side of trading, such as order options, approvals and positions, see the Trading guides.