1. Base URLs and Environments
Ekiden provides separate base URLs for each environment:- Mainnet:
(Coming Soon) - Testnet Beta: https://api.ekiden.fi/api/v1
- Testnet Staging: https://api.staging.ekiden.fi/api/v1
All API calls must use HTTPS.
2. Versioning
We use URI-based versioning:- Format:
/v1/ - Example:
GET /v1/market/instruments
/v2/).
3. RESTful Design
| Method | Description |
|---|---|
GET | Fetch resources (e.g., market data) |
POST | Create resources (e.g., place an order) |
DELETE | Cancel or remove resources |
PATCH | Update partial resources |
- Resources are nouns, pluralized when appropriate
- Example:
/v1/trade/orders,/v1/trade/executions
- Example:
4. WebSocket Protocol
Endpoints:- Mainnet:
(Coming Soon) - Testnet Beta:
- Public data:
wss://api.ekiden.fi/ws/public - Private data:
wss://api.ekiden.fi/ws/private
- Public data:
- Testnet Staging:
- Public data:
wss://api.staging.ekiden.fi/ws/public - Private data:
wss://api.staging.ekiden.fi/ws/private
- Public data:
op field with snake_case values. Optional req_id lets you correlate requests/responses.
Topics
- Public (Market-scoped):
orderbook.<depth>.<symbol>(e.g.,orderbook.1.BTCUSDC)trade.<symbol>ticker.<symbol>kline.<interval>.<symbol>
- Private (User-scoped, only over
/ws/privateafter auth):orderpositionexecutionaccount_balance
Subscribe
Client → ServerUnsubscribe
Event delivery
Authenticate (private WS only)
Send your JWT (see REST auth below) over/ws/private:
Client → Server
5. Authentication (REST)
Private REST and private WebSocket use a short-lived JWT issued by the gateway, or API Key authentication.JWT Authentication
- Request a token via
POST /api/v1/authorizeby signing the message:
- Use the token with Bearer auth for private endpoints:
API Key Authentication
Gateway supports API-key auth via headers:X-API-KEY: Your API public keyX-SIGNATURE: Ed25519 signature overEKIDEN_API|{method}|{uri}|{timestamp_ms}|{nonce}X-TIMESTAMP-MS: Current Unix timestamp in millisecondsX-NONCE: Random unique string
6. Numerical Precision
- All token quantities and prices are strings
- Up to 18 decimal places
- Use big number or decimal libraries — avoid floats
7. Timestamps
We use explicit units depending on the field name and context:timestamp(REST resources like orders, fills, positions): Unix seconds since epoch (int). Example:1718000000.timestamp_ms(REST authorize flow, API Key headers): Unix milliseconds since epoch (int). Example:1718000000000.server_ts_ms(WebSocket event envelope): Unix milliseconds since epoch (int).ts(WebSocket ticker snapshots and ping/pong client_ts/server_ts):- For ticker
ts: Unix milliseconds since epoch (int). Example:1718000000000. - For WS ping/pong
client_ts/server_ts: Unix milliseconds since epoch (int). Example:1718000000000.
- For ticker
"2025-05-10T12:34:56Z".
8. Error Handling
Error response format
Common Error Codes
| Code | Meaning |
|---|---|
BAD_REQUEST | Invalid request parameters |
UNAUTHORIZED | Authentication failed or token expired |
FORBIDDEN | Insufficient permissions (scopes) |
RateLimitExceeded | Too many requests |
NOT_FOUND | Resource not found |
SERVICE_UNAVAILABLE | Backend service down or lagging |
INTERNAL | Unexpected server error |
HTTP status codes (400,401,403,404,429,500,503) are used appropriately.
9. Rate Limits
- Public REST endpoints: 60 requests/minute
- Private REST endpoints: 30 requests/minute per token
Example response on limit exceeded
10. Pagination
Offset-style pagination with page counters:- Query params:
page(default 1),per_page(default 20)
11. Field Naming
- All JSON keys use
snake_case - All numeric values are strings (except timestamps and page counters)
12. WebSocket Heartbeats
Application-level ping/pong
- Client may send:
- Server replies:
WebSocket-level ping/pong (keepalive)
- The server periodically sends WebSocket-level pings and expects pongs.
- If the server does not see a pong within the timeout window (~30s by default), it will close the connection.
ping messages if desired.
For detailed endpoint specifications and integration examples, continue to the API reference.