Logs & Analytics
Opt-in operation logging and history — a Pro plan feature
Operation logging is a Pro feature. When enabled, Prediction Router records a credential-free summary of each trading/account request — what you did and how it turned out — so you can query your history and build analytics. Nothing sensitive is ever stored: logs never contain credentials, only the shape of the request and its outcome.
Logging is opt-in per request and best-effort — a logging failure never affects the underlying operation.
All endpoints require Authorization: Bearer <key>.
Base URL: https://prediction-router-api.kalashshah47.workers.dev
Enabling logging on a request
Add the X-Enable-Log header to any trading or account request to record it:
X-Enable-Log: trueThe response echoes what happened via the X-Log-Status header:
X-Log-Status | Meaning |
|---|---|
recorded | The operation was logged (Pro plan) |
skipped_plan_required | You asked to log but are on the free plan — the request still ran, nothing was logged |
On the free plan the header is simply ignored (aside from the skipped_plan_required signal); upgrade to Pro to record and query history.
Example
curl -X POST "https://prediction-router-api.kalashshah47.workers.dev/v1/orders" \
-H "Authorization: Bearer pr_..." \
-H "X-Platform-Credential: $CRED" \
-H "X-Enable-Log: true" \
-H "Content-Type: application/json" \
-d '{
"platform": "kalshi",
"marketId": "KXFED-0325",
"outcomeId": "yes",
"side": "buy",
"amount": 25,
"price": 0.28
}'GET /v1/plan
Return the caller's current plan. Use it to show the right upgrade state in your client.
Example
curl "https://prediction-router-api.kalashshah47.workers.dev/v1/plan" \
-H "Authorization: Bearer pr_..."Response
{ "plan": "free" }plan is "free" or "pro".
GET /v1/logs
List your recorded operations, newest first. Pro only — returns 402 on the free plan.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
platform | string | Filter to a single platform | |
operation | string | Filter to one operation — e.g. place_order, get_orders, cancel_order, get_balance, get_positions, get_history | |
limit | integer | Max results. Default 50, max 200 | |
offset | integer | Pagination offset. Default 0 |
Example
curl "https://prediction-router-api.kalashshah47.workers.dev/v1/logs?platform=kalshi&operation=place_order&limit=20" \
-H "Authorization: Bearer pr_..."Response
{
"logs": [
{
"id": "log_abc123",
"userId": "a1b2c3...",
"platform": "kalshi",
"operation": "place_order",
"status": "success",
"marketId": "KXFED-0325",
"outcomeId": "yes",
"side": "buy",
"amount": 25,
"price": 0.28,
"orderId": "ord_abc123",
"errorCode": null,
"latencyMs": 412,
"createdAt": "2026-06-19T10:00:00.000Z"
}
]
}Log record fields
| Field | Type | Description |
|---|---|---|
id | string | Log record ID |
userId | string | Your user ID |
platform | string | Platform the operation ran against |
operation | string | place_order, get_orders, cancel_order, get_balance, get_positions, get_history |
status | string | success or error |
marketId | string | null | Market ID, when applicable |
outcomeId | string | null | Outcome ID, when applicable |
side | string | null | buy or sell, when applicable |
amount | number | null | Order amount, when applicable |
price | number | null | Limit price, when applicable |
orderId | string | null | Resulting order ID on a successful order |
errorCode | string | null | Error code when status is error |
latencyMs | number | null | Operation latency in milliseconds |
createdAt | string | ISO 8601 timestamp |
No credential or account-acting data is ever included.
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid query parameters |
| 402 | PLAN_REQUIRED | Logging & analytics is a Pro feature — upgrade to record and query history |