How AI is applied across API Evangelist and APIs.io. Read my AI disclosure →
API Evangelist API Evangelist
Discovery
Learnings
Guidance
Toolbox
Alignment
API Evangelist LLC

Pred WebSocket API

PRED uses [Ably](https://ably.com/) for real-time WebSocket data. Use Ably's token auth with `POST /api/v1/auth/ably` as your `authCallback`.## Token authCall `POST /api/v1/auth/ably` to get raw Ably `TokenDetails` JSON:```json{ "token": "ably-token-string", "keyName": "xxxxx.xxxxx", "clientId": "user-uuid", "capability": "{\"private:user:user-uuid\":[\"presence\",\"subscribe\"],\"market:*\":[\"subscribe\"]}", "expires": 1700000000000, "issued": 1699996400000}```**Capabilities granted:**- Channel `private:user:`: `presence`, `subscribe`- Channel `market:*`: `subscribe`## Private user channel: `private:user:{userID}`- **Authenticated**: you can only subscribe to your own `user_id` channel- **Must subscribe with Presence** (see below) — PRED only pushes events to clients that have entered presence on this channel- `user_id` comes from the login response## How to subscribe with presenceFor the private user channel, you must **enter presence** before subscribing; otherwise PRED does not deliver order events. Use Ably's presence API in this order:1. Obtain a token: call `POST /api/v1/auth/ably` with `Authorization: Bearer ` (and optionally `X-Wallet-Address`, `X-Proxy-Address`). Use the returned body as Ably's token (e.g. in `authCallback`).2. Connect to Ably with that token (e.g. `ably.NewRealtime` with `authCallback` that returns the token).3. Resolve the channel name for your user (e.g. `private:user:` from login; the token's capability may also indicate the channel).4. Get the channel: `channel := realtime.Channels.Get(channelName)`.5. **Enter presence** on the channel: call `channel.Presence.Enter(ctx, data)` with a small payload (e.g. `map[string]string{"source": "your-app"}`). This step is required; PRED only sends events to clients that have entered presence.6. Subscribe to messages: call `channel.SubscribeAll(ctx, messageHandler)` (or `channel.Subscribe(ctx, eventName, handler)` for specific events). Handle `order-created`, `order-cancelled`, `order-updated` (and optionally `order-adjusted` if supported).If you subscribe without entering presence first, you will not receive order events on the private user channel.**Events:**### `order-created` — New limit order placed```json{ "order_id": "string", "market_id": "string", "market_name": "string", "parent_market_id": "string", "parent_market_name": "string", "side": "long | short", "price": "string (cents)", "quantity": "string (shares)", "amount": "string (USD)", "remaining_quantity": "string", "reduce_only": false, "market_maker": false, "expiration": 1234567890}```### `order-cancelled` — Order cancelled by user or system```json{ "event_type": "order_cancelled", "order_id": "string", "timestamp": 1234567890}```### `order-updated` — Order matched on-chain (fully or partially filled)```json{ "event_type": "order_matched_on_chain", "order_id": "string", "remaining_quantity": "string", "filled_quantity": "string", "timestamp": 1234567890}```Note: `matched_on_chain` may be `false` before confirmation; treat as a fill and react. Position from API may not reflect the impact yet.The SDK also handles alternate payload shapes: fields like `order_side`, `order_price`, `order_quantity`, or a nested `order` object with `side`, `price`, `quantity`. Additional fields that may appear: `market_id`, `parent_market_id`, `side`, `price`, `quantity`.## Public market channels### `market:orderbook:{marketID}` — Order book snapshotEvent name: `orderbook` (throttled to 100ms)```json{ "market_id": "string", "last_updated_at": "2024-01-01T00:00:00Z", "sequence_number": 123, "last_update_id": 123, "bids": [ { "price": "50", "quantity": "100", "total": "50" } ], "asks": [ { "price": "51", "quantity": "100", "total": "51" } ]}```The SDK also reads `size` as an alias for `quantity`, and `metadata.cross_matching_enabled` (boolean).### `market:ltp:{marketID}` — Last traded priceEvent name: `ltp` (throttled to 100ms)```json{ "price": "string (cents)", "volume": "string", "timestamp": 1234567890}```## Connection details- Use Ably token auth with `authCallback` calling `POST /api/v1/auth/ably`- Reconnect with exponential backoff: 1s min, 30s max- On the private user channel, enter presence before subscribing (see "How to subscribe with presence" above)

Pred WebSocket API is one of 7 APIs that Pred publishes on the APIs.io network, described by a machine-readable OpenAPI specification.

Tagged areas include WebSocket. The published artifact set on APIs.io includes an OpenAPI specification, an API reference, and authentication docs.

This API exposes 1 operation across 1 path, and defines 3 schemas. It is described by OpenAPI 3.2.0, at version 1.0.0.

Requests are made against 2 base URLs: https://testnet.pred.app, https://www.pred.app.

1 operations 1 paths 3 schemas 1 POST

Metadata

The identity and technical contract details declared by the specification.

Specification
OpenAPI 3.2.0
API Version
1.0.0
Base URL
https://www.pred.app
Authentication
HTTP Bearer
Resource Areas
1

Authentication & Security 1

Pred WebSocket API declares 1 security scheme for authenticating requests. It accepts HTTP bearer tokens (JWT) (BearerAuth).

  • BearerAuth — JWT access token from login endpoint

Paths & Operations 1

Across 1 path, the API surfaces 1 operation — 1 POST. Each is listed below with its method, path, parameters, and response codes.

WebSocket 1

PRED uses [Ably](https://ably.com/) for real-time WebSocket data. Use Ably's token auth with POST /api/v1/auth/ably as your authCallback. Token auth Call POST /api/v1/auth/ably to…

POST
/api/v1/auth/ably
Get Ably WebSocket token
getAblyToken 2 params → 200401500

Schemas 3

The contract defines 3 schemas that model the data the API accepts and returns. The most detailed are AblyTokenDetails (6 properties), Error (3 properties), ErrorResponse (3 properties). Each schema is shown below with its type and property counts.

AblyTokenDetails
object
Raw Ably TokenDetails JSON (not wrapped in success/data envelope)
6 properties
ErrorResponse
object
3 properties
Error
object
3 properties

Specification

The full machine-readable OpenAPI contract behind this narrative.

Source

pred-websocket-api-openapi.yml Raw ↑

Other APIs Pred publishes across the network.

Pred Authentication API
Pred Market Discovery API
Pred Orders API
Pred Overview API
Pred Portfolio API
Pred User API
Where this information came from

This is an independent, third-party profile of Pred WebSocket API, published by API Evangelist. We do not operate, host, resell, or support these APIs, and we are not affiliated with or endorsed by the company unless stated above. Everything here is built from publicly available information — the company's own site, developer portal, documentation, public repositories, and the specifications it publishes for public use. Nothing is obtained by breaching a system, defeating an access control, or using credentials.

The Kin Score and Agent Readiness rating are independently calculated assessments of a company's public API artifacts, scored against a published rubric. They are not certifications, endorsements, security assessments, or audits.

Corrections, re-scores, and removal are free — no partnership or purchase required, and you do not need to justify the request. A removed company is recorded as unrated, never scored zero for having asked. Acknowledgement within one business day; removal within two.

info@apievangelist.com · Read the full data-sourcing policy →
On a security or compliance team? Put security in the subject line and you will get a person, not a form — we will tell you exactly which public URLs this profile was built from.