API Reference
Orders
Place, list, and cancel orders on supported platforms
All orders endpoints require Authorization: Bearer <key> and a connected platform account. Connect one first via POST /v1/platform-accounts.
Every endpoint below accepts an optional account_id query parameter. Pass it to route through a specific connected account; omit it to use that platform's most recently added account.
Base URL: https://prediction-router-api.kalashshah47.workers.dev
POST /v1/orders
Place an order on a connected platform.
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
platform | string | ✓ | kalshi polymarket |
marketId | string | ✓ | Platform-native market ID |
outcomeId | string | ✓ | Kalshi: yes or no. Polymarket: the outcome's CLOB token ID |
side | string | ✓ | buy or sell |
amount | number | ✓ | Number of shares (Polymarket) or contracts (Kalshi) to buy or sell. Cost ≈ amount × price |
price | number | ✓ | Limit price per share, strictly between 0 and 1, quoted for the chosen outcome. Orders rest good-till-cancelled |
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
account_id | string | Route through a specific connected account. Defaults to the platform's most recent account |
Example
curl -X POST "https://prediction-router-api.kalashshah47.workers.dev/v1/orders?account_id=8f3c1a2b-..." \
-H "Authorization: Bearer pr_..." \
-H "Content-Type: application/json" \
-d '{
"platform": "kalshi",
"marketId": "KXFED-0325",
"outcomeId": "yes",
"side": "buy",
"amount": 25,
"price": 0.28
}'Response 201
{
"order": {
"id": "ord_abc123",
"platform": "kalshi",
"marketId": "KXFED-0325",
"outcomeId": "yes",
"side": "buy",
"amount": 25,
"price": 0.28,
"shares": 0,
"status": "open",
"createdAt": "2026-06-19T10:00:00.000Z",
"filledAt": null
}
}Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_ERROR | Missing or invalid body fields |
| 403 | PLATFORM_NOT_CONNECTED | Platform credential not found |
| 405 | UNSUPPORTED_OPERATION | Platform does not support trading |
GET /v1/orders
List open orders for a connected platform.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
platform | string | ✓ | Platform to query |
account_id | string | Limit to a specific connected account |
Example
curl "https://prediction-router-api.kalashshah47.workers.dev/v1/orders?platform=kalshi" \
-H "Authorization: Bearer pr_..."Response
{
"orders": [
{
"id": "ord_abc123",
"platform": "kalshi",
"marketId": "KXFED-0325",
"outcomeId": "yes",
"side": "buy",
"amount": 25,
"price": 0.28,
"shares": 89.28,
"status": "open",
"createdAt": "2026-06-19T10:00:00.000Z",
"filledAt": null
}
]
}DELETE /v1/orders/:id
Cancel an open order.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
platform | string | ✓ | Platform the order belongs to |
account_id | string | The account the order was placed through |
Example
curl -X DELETE "https://prediction-router-api.kalashshah47.workers.dev/v1/orders/ord_abc123?platform=kalshi" \
-H "Authorization: Bearer pr_..."Response 200
{ "cancelled": true }Errors
| Status | Code | Meaning |
|---|---|---|
| 403 | PLATFORM_NOT_CONNECTED | Platform credential not found |
| 405 | UNSUPPORTED_OPERATION | Platform does not support trading |