Prediction Router
API Reference

Platform Accounts

Connect, list, update, and remove platform credentials

A platform account is a stored credential for a single prediction-market platform. You can connect more than one account per platform (e.g. two Kalshi keys) and each gets its own id. Pass that id as account_id on orders and account requests to route through a specific account — see Orders and Account.

All endpoints require Authorization: Bearer <key>.

Base URL: https://prediction-router-api.kalashshah47.workers.dev


Credential formats

The credential field is a single string. Its contents depend on the platform:

Platformcredential value
kalshi<keyId>:<base64(PEM)> — your API Key ID, a colon, then the base64-encoded RSA private-key PEM block
polymarketThe JSON credential returned by POST /v1/platform-accounts/polymarket/derive-api-key for your Deposit Wallet

GET /v1/platform-accounts

List your connected accounts. Never returns the credential itself.

Query parameters

ParameterTypeRequiredDescription
platformstringFilter to a single platform

Example

curl "https://prediction-router-api.kalashshah47.workers.dev/v1/platform-accounts" \
  -H "Authorization: Bearer pr_..."

Response

{
  "accounts": [
    {
      "id": "8f3c1a2b-...",
      "platform": "kalshi",
      "label": "Main account",
      "credentialType": "user_provided",
      "createdAt": "2026-06-19T10:00:00.000Z"
    }
  ]
}

POST /v1/platform-accounts

Connect a new account. Returns the new account id — store it to use as account_id later.

Body parameters

ParameterTypeRequiredDescription
platformstring✓kalshi polymarket
labelstring✓A name to identify this account (1–60 chars)
credentialstring✓The platform credential — see Credential formats

Example

curl -X POST "https://prediction-router-api.kalashshah47.workers.dev/v1/platform-accounts" \
  -H "Authorization: Bearer pr_..." \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "kalshi",
    "label": "Main account",
    "credential": "your-key-id:base64-encoded-pem"
  }'

Response 201

{
  "account": {
    "id": "8f3c1a2b-...",
    "platform": "kalshi",
    "label": "Main account"
  }
}

Errors

StatusCodeMeaning
400VALIDATION_ERRORMissing/invalid platform, label, or credential

PATCH /v1/platform-accounts/:id

Update an account's label, its credential, or both. Provide at least one field.

Body parameters

ParameterTypeRequiredDescription
labelstringNew label (1–60 chars)
credentialstringNew credential — see Credential formats

Example

curl -X PATCH "https://prediction-router-api.kalashshah47.workers.dev/v1/platform-accounts/8f3c1a2b-..." \
  -H "Authorization: Bearer pr_..." \
  -H "Content-Type: application/json" \
  -d '{ "label": "Trading bot" }'

Response 200

{ "ok": true }

Errors

StatusCodeMeaning
400VALIDATION_ERRORNo fields provided, or values out of range
404NOT_FOUNDNo account with that id for your user

DELETE /v1/platform-accounts/:id

Remove a connected account.

Example

curl -X DELETE "https://prediction-router-api.kalashshah47.workers.dev/v1/platform-accounts/8f3c1a2b-..." \
  -H "Authorization: Bearer pr_..."

Response 200

{ "ok": true }