Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

Websockets

You receive live index and rate prints on this socket.
wss://api.adjacent.markets/api/v1/stream
Your plan must be pro or premium.
Address an index by index_id or by ticker. The match ignores case. Every record uses the canonical index_id. Address a rate by rate_id.

Connection and auth

Use the same bearer you use on REST. The bearer is an ak_ API key or an app session token.
Send one JSON object in each text frame. A binary frame closes the socket with 1003.
The first server frame is connected.
{ "type": "connected", "protocol": 1, "session": "7f3c0c2e-1b4a-4d2e-9a11-0c6e5b2a9d70", "server_time": "2026-11-11T15:40:00.123456Z", "heartbeat_ms": 15000 }
session is opaque. It changes when the server accepts the socket. protocol is 1. A breaking change uses the path /api/v2/stream.
Send Authorization: Bearer and the token on the handshake. The server checks the token and the plan before the upgrade completes. After a paid handshake you receive connected, then authenticated with no id.
A bad credential is refused. A pro or premium plan connects.
The server checks the plan on every subscribe, and at least once a minute. A plan that lapses to free gets forbidden and close 4004. An organization that disappears gets the same close. Prints stop. If that check cannot read the plan, the socket stays open.
When your plan is no longer Premium, the server drops your set subscriptions. You receive forbidden. Named subscriptions stay. The socket stays open.
You can subscribe to an index or a rate only when your authenticated GET would return it. An id you cannot read is not_found.
These are the error codes: bad_request, unauthorized, forbidden, not_found, not_available, slow_consumer, limit_exceeded, and service_error.
Prints on this socket do not count as REST requests.
CapValue
Connections per API key10
Subscriptions (sid) per connection50
Ids in one subscribe or unsubscribe50
Set subscriptionsPremium only. One set is one sid.
Outbound queue32 messages or 1 MiB, whichever comes first
Frame size1 MiB
Auth deadline10 seconds
Over the connection cap, the new socket returns limit_exceeded and closes with 4029.

Subscribe and unsubscribe

Set op on a command. Data frames use type. Set id on each command so you can match the ack. The server sets one sid for each channel and canonical id. A set on that channel gets one sid.
{"op":"subscribe","id":2,"channel":"index.price","ids":["RED","blue"]}
You receive subscribed, then one snapshot per accepted id. Snapshots arrive in canonical id order.
{ "type": "subscribed", "id": 2, "channel": "index.price", "subscriptions": [ {"sid": 10, "id": "red", "epoch": 1}, {"sid": 11, "id": "blue", "epoch": 1} ] }
An unknown id does not fail the command. That id is listed on not_found. The known ids still subscribe.
{"type":"error","id":2,"code":"not_found","channel":"index.price","ids":["nope"]}
Subscribe adds to the subscriptions you already hold. To refresh one, subscribe to that channel and id again. You keep the same sid and epoch. seq continues.

Premium sets

A Premium plan can subscribe with set instead of a list of ids.
indices is every index your authenticated GET would return. Use it on index.price, index.constituents, index.sleeves, index.implied_sleeves, and index.session.
rates is every rate your authenticated GET would return. Use it on rate.price and rate.sources.
One set is one subscription on that channel. That subscription has one sid, one epoch, and one seq. The 50-id cap does not apply. The 50-sid cap counts the set as one. A subscribe by id is unchanged.
{"op":"subscribe","id":6,"channel":"index.price","set":"indices"}
Do not send ids and set together. An unknown set is bad_request. A set on the wrong channel is bad_request.
Pro receives forbidden. Any other paid plan that is not Premium receives forbidden. The socket stays open.
{ "type": "error", "id": 6, "code": "forbidden", "message": "set subscriptions require a Premium plan", "channel": "index.price", "upgrade_url": "https://adjacent.markets/subscribe" }
upgrade_url is omitted when there is no page where you can buy a plan.
The ack is one subscription. members is the number of current ids.
{ "type": "subscribed", "id": 6, "channel": "index.price", "subscriptions": [ {"sid": 12, "set": "indices", "epoch": 1, "members": 2} ] }
After that ack, you receive one opening snapshot per current member on these channels:
  • index.price
  • index.sleeves
  • index.implied_sleeves
  • index.session
  • rate.price
  • rate.sources
Snapshots arrive in canonical id order. They share the set sid. On the first subscribe, seq starts at 1 and increases by 1 for each snapshot. If a snapshot cannot be built, that member arrives as service_error.
A Premium index.constituents set does not send opening snapshots. Read each basket with GET /api/v1/indices/{id}/constituents. An update still arrives when a member basket changes.
A subscribe by id still sends a snapshot.
That snapshot replaces the member it names. Other members on the sid stay. Later prints for a current member are update frames on the same sid. A new id you can read arrives on its next print. An id that leaves your visible set stops. You receive no removal frame.
Subscribe to the same set again to keep the sid and the epoch. seq continues. Channels other than index.constituents send a fresh snapshot of the current members.
Drop ids with unsubscribe.
{"op":"unsubscribe","id":3,"channel":"index.price","ids":["red"]}
Omit ids to drop every named id on that channel. That command also drops the set when you hold one. The ack is unsubscribed. It includes set when a set was removed.
{"op":"unsubscribe","id":7,"channel":"index.price","set":"indices"}
The ack echoes set.
subscriptions returns every subscription on the connection. A named row has id. A set row has set and no id.
{"op":"subscriptions","id":4}
snapshot sends the latest print for one sid. A named sid returns one snapshot. A set sid returns one snapshot per current member. Membership does not change.
{"op":"snapshot","id":5,"sid":10}
index.mark, index.methodology, index.nav, and index.funding return not_available. Nothing opens. A set on one of those channels does the same. * is not a set.

Envelope

Every data frame has this shape.
{ "type": "index.price", "kind": "snapshot", "sid": 10, "epoch": 1, "seq": 1, "as_of": "2026-11-11T15:40:00.123456Z", "data": {} }
kind is snapshot or update. as_of is the print time. For a price or rate frame, data.timestamp or data.updated_at matches as_of.
Heartbeats, acks, and errors do not carry seq.
Timestamps are UTC RFC 3339.

Channels

ChannelWhat you receiveWhen an update arrives
index.priceThe published level, latest_priceA committed print for that index
index.constituentsThe full as-used basketThe as-used cycle changes
index.sleevessleeves from the index detailThose sleeve rows change
index.implied_sleevesimplied_sleeves from the index detailThose sleeve rows change
index.sessionHalt fields from the index detailOn subscribe, and when halt state changes
rate.pricelatest_price and spread on a 0 to 100 scaleA committed rate print
rate.sourcessources from the rate detailThat print's source set changes
An empty array is a real payload. A UPFI index on index.sleeves or index.implied_sleeves returns an empty array.

index.price

A price frame uses the fields in the example below. Official daily value is not on this socket. Read the Indices page for what those fields mean.
A skipped compute tick sends nothing on this channel. The missing print is a gap in timestamp. seq does not advance.
{ "type": "index.price", "kind": "update", "sid": 10, "epoch": 1, "seq": 42, "as_of": "2026-11-11T15:40:00.123456Z", "data": { "index_id": "red", "ticker": "RED", "methodology": "upfi", "quote_convention": "percent", "timestamp": "2026-11-11T15:40:00.123456Z", "price": 104.2, "price_raw": 104.05, "source": "live", "halted": false, "previous_close_1d": 103.7, "price_change_1d": 0.5 } }

index.constituents

Snapshot data contains index_id, computed_at, and constituents. Each constituent uses the REST fields kind, market_id, ticker, display_ticker, platform, weight, excluded, exclude_reason, price, and name. Volume and open interest are included when REST would send them. kind is market or index. A child index price is that child's published level.
The frame is the full basket. If the basket cannot fit in 1 MiB, the snapshot is service_error. Read the REST list. The socket does not page.
Included names sum to 1 when a price exists. Excluded names stay at weight 0 with excluded true and exclude_reason set. A name that has never been priced stays at 0 and omits excluded.
An update replaces constituents in full. kind is snapshot when membership changes. kind is update when only weights or prices change. Both lists are complete. Replace your local list.
A Premium set on this channel does not send an opening snapshot. Read the basket from REST. Updates still arrive when a member basket changes.

index.sleeves and index.implied_sleeves

data is the REST field plus index_id.
sleeves is populated for team indices. mark_price is a probability from 0 to 1 on that sleeve. It is not the index level.
implied_sleeves level uses the sleeve unit. U-3 and CPI are percentage points. Other implied indices use the unit named by level_interpretation.

index.session

You receive a snapshot on subscribe. Later frames arrive only when the halt state changes.
{ "index_id": "red", "state": "publishing", "halted": false, "source": "live", "updated_at": "2026-11-11T15:40:00.123456Z" }
state is publishing or halted. When halted is true, the frame includes halt_reason, halt_valid_constituents, and halt_min_constituents when the index detail includes them.
A minute with no print leaves this channel unchanged. Read that quiet minute from the price timestamp.

rate.price and rate.sources

price and spread use a 0 to 100 scale. spread is the highest in-print source minus the lowest. A print older than seven days is omitted. The snapshot then omits price and sets stale to true.
{ "rate_id": "adj_redp", "timestamp": "2026-11-11T15:40:00.123456Z", "price": 52.4, "spread": 3.0, "methodology": "volume_weighted_average", "previous_close_1d": 51.5, "price_change_1d": 0.9 }
rate.sources data.sources is the REST sources array. A configured leg that missed the print has weight 0 and no latest_price. Each change replaces the list. Leg latest_price is the price that entered the print.

Snapshot, then updates

Subscribe and op snapshot send kind snapshot. Drop your local copy for that sid and store the snapshot. Apply a later update only when its seq is next.
A price or rate update is the full latest record. Replace that record. Constituents, sleeves, implied sleeves, and rate sources arrive as full lists. Replace your local list.
The snapshot is the current record. After you reconnect, fill missed minutes from GET /api/v1/indices/{id}/prices?interval=1min, or the rate equivalent. Then apply the new snapshot.
A data frame arrives after that print is committed. The value matches the authenticated REST read for that timestamp.

Sequence numbers and gaps

Each sid has its own seq and epoch. seq starts at 1 on the first snapshot. It increases by 1 for each later data frame on that sid. Acks, errors, and heartbeats do not use seq. A skipped minute does not use seq.
Keep the last sid, epoch, and seq.
  • When epoch changes, discard local state. Wait for a snapshot on that sid. Ignore updates until it arrives.
  • When kind is snapshot and seq is your last seq plus 1, replace local state. On a set sid, replace the member named in data.
  • When kind is update and seq is your last seq plus 1, replace local state with that record. On a set sid, that record is the member named in data.
  • Otherwise, do not apply the frame. Send {"op":"snapshot","id":N,"sid":M} or unsubscribe and subscribe again.
A requested snapshot uses the next seq and the same epoch. seq does not reset to 1.
Timestamps show a missing print. seq shows a missing message.
There is no replay and no resume token.

Heartbeats

The server sends a WebSocket ping every 15 seconds. Answer with a pong. The server also sends this text frame.
{"type":"heartbeat","server_time":"2026-11-11T15:40:15.000000Z"}
If the server receives no pong for 30 seconds, it closes with 4000. Your pings are answered. A text frame whose body is PING is bad_request.
No price traffic for a minute is normal. Reconnect when 45 seconds pass with no ping, no heartbeat, and no data frame.

Reconnect

Open a new socket and send the handshake header again. Subscribe again. The new connected.session retires every previous sid. Discard local state and apply the new snapshots.
Start backoff at 1 second. Double it up to 30 seconds, and add jitter. A successful snapshot resets the backoff. The server does not send missed prints. Fill a hole from REST, then follow the socket.
Server shutdown closes with 1001. Reconnect on that code.

Backpressure

Each connection has one outbound queue. A slow client is disconnected. The server does not drop a frame and continue seq. It does not merge two prints into one. When the queue passes 32 messages or 1 MiB, you receive slow_consumer if the frame still fits. The socket then closes with 4003.
{"type":"error","code":"slow_consumer"}