Parlay Integration

Provide Parlay price quotes and confirmation responses through the Market Maker API and Parlay WebSocket.

Provide Parlay price quotes and confirmation responses to ProphetX by authenticating with the Trading API, seeding events and markets, and subscribing to the parlay WebSocket.

Overview

  1. Web and mobile clients send parlay quote requests for a list of unique outcomes to the ProphetX backend.
  2. ProphetX broadcasts those requests to integrated Market Makers through WebSocket, and Market Makers return quote responses through a callback REST API.
  3. When a participant accepts a price, ProphetX sends a private confirmation request to Market Makers that can satisfy the order. Market Makers then send their confirmation response through a callback REST API.
  4. After ProphetX receives the confirmation, ProphetX publishes an order.finalized message on the private channel to confirm execution of the parlay.

API documentation

Parlay API reference

Example Python code: Python Parlay API Integration Guide

Example Golang code: Golang Parlay Integration Guide

Before you start

  1. Follow the first three steps in Trading API Integration to get your Trading API credentials and ingest events and markets. The Parlay API uses the same Trading API credentials.
  2. Review the Python or Golang example implementation before you connect to the parlay WebSocket. Both examples still use the legacy v1 vocabulary and paths (odds, line_id, /parlay/sp/...). This page documents the current v2 contract; read Two contracts, one choice before you copy their payloads.
  3. Send Accept-Encoding: gzip on your REST calls (supported-strike management below, and the Trading API calls that feed your pricing). Responses of 1 KB or more then come back gzip-compressed; most HTTP libraries handle this by default. See Response compression. The parlay WebSocket itself is not compressed.

Core flow

  1. Exchange a session key by using your Access Key and Secret Key.
  2. Optional: Get your current cash balance.
  3. Seed events and markets for the tournaments you want to trade.
  4. Register the strikes you can quote on. See Register supported strikes.

Register supported strikes

ProphetX only sends you RFQs for strikes you've explicitly registered. Register a strike after you've seeded its event and market, and before you expect to receive quote requests for it.

Add supported strikes

POST /supported-strikes
Authorization: Bearer <your-token>
Content-Type: application/json
{
  "supported_strikes": ["strike_1", "strike_2"]
}

supported_strikes is a flat array of strike_id strings — no nested objects or market/event wrapper. Use the same strike_id values you receive elsewhere in the API, such as on estimated_price and price_probability.strikes entries in the callback payloads described below.

Revoke supported strikes

DELETE /supported-strikes
Authorization: Bearer <your-token>
Content-Type: application/json
{
  "supported_strikes": ["strike_1"]
}

List your supported strikes

GET /supported-strikes?limit=100&token=<pagination-token>
{
  "supported_strikes": ["strike_1", "strike_2"],
  "limit": 100,
  "token": "<next-page-token>"
}

token is a pagination cursor returned by a previous call. Omit it on your first request.

Request size limit

Each POST or DELETE call accepts a limited number of supported_strikes entries per request. If you exceed it, the API returns invalid_params with a message naming the limit — batch your calls to stay under it.

Connect to the Parlay WebSocket

See subscribe(self) in the Python example and ListenForMessages() in the Golang example (both still on the legacy v1 contract, see below). The parlay WebSocket exposes seven topics.

Two contracts, one choice

The Parlay API is served in two vocabularies, selected by the path you call:

v2 (this page and the API reference)Legacy v1
REST base path/parlay/sp/v2/.../parlay/sp/...
RFQ broadcast channelprivate-broadcast-service=7-device_type=5private-broadcast-service=4-device_type=5
RFQ eventv2.price.ask.new with quantity, market_strikesprice.ask.new with stake, market_lines
Quote callback fieldsprice, max_risk, estimated_price[].strike_id / .priceodds, max_risk, estimated_price[].line_id / .odds
Confirmation callback fieldsconfirmed_price, confirmed_quantity, price_probability[].strikes[].strike_idconfirmed_odds, confirmed_stake, price_probability[].lines[].line_id

The two never mix. Registering your socket through the v2 path puts you on the v2 channels, and every callback_url you then receive points at a v2 endpoint that expects v2 field names. Registering through the v1 path does the same for v1. Posting v2 names to a v1 callback_url fails with 400 invalid_params and the message invalid odds, because that endpoint reads odds, finds nothing and treats it as 0. Pick one contract and use it end to end. New integrations should use v2; the example repositories linked above still implement v1. Production and sandbox behave the same way.

RFQ connection flow

The paths below are relative to the v2 base path, https://cash.api.prophetx.co/parlay/sp/v2 in production and https://api.sandbox.prophetx.dev/parlay/sp/v2 in sandbox.

  1. Get your WebSocket connection config:
GET /websocket/connection-config

The response returns the appId, cluster, and key values you need to initialize a Pusher-compatible client.

  1. Connect and register your socket.

Use any Pusher-compatible client to connect with the config from step 1. After the client connects, register the socket with ProphetX to get signed auth tokens for your channels:

POST /websocket/register
Authorization: Bearer <your-token>
Content-Type: application/json
{
  "socket_id": "<socket-id-from-pusher-client>"
}

The response lists every channel you may subscribe to, with its signed auth token and the events to bind on it:

{
  "authorized_channel": [
    {
      "channel_name": "private-broadcast-service=7-device_type=5",
      "auth": "...",
      "binding_events": ["v2.price.ask.new", "v2.order.matched"]
    },
    {
      "channel_name": "private-service=7-device_type=5-user=<your user id without dashes>",
      "auth": "...",
      "binding_events": ["price.confirm.new", "refund.processed", "order.finalized", "order.settled", "health_check", "parlay.settled"]
    }
  ]
}

Subscribe to exactly the channels returned and bind exactly the events listed, rather than hard-coding channel names. Only the two broadcast data events carry the v2. prefix; events on your private channel keep their names and switch to the v2 payload vocabulary.

  1. Subscribe to the RFQ broadcast channel.

Use the auth token from the registration response to subscribe to this channel:

private-broadcast-service=7-device_type=5
  1. Listen for RFQ events.

Bind to the v2.price.ask.new event on the RFQ broadcast channel. Each event payload includes the parlay ID, creator ID, requested quantity, market strikes, tournament IDs, and a unique callback URL:

{
  "parlay_id": "abc-123",
  "creator_id": "user-456",
  "quantity": 100.0,
  "market_strikes": [
    {
      "sport_event_id": 30023691,
      "tournament_id": 42,
      "market_id": 412,
      "outcome_id": 13,
      "strike": 5.5,
      "strike_id": "4507a1464a5b43289a99f45f53f5af65"
    }
  ],
  "created_at": 1718000000,
  "tournament_ids": [42],
  "callback_url": "https://..."
}

quantity is the participant's stake. Zero-valued keys are omitted, so a moneyline entry has no strike. Use payload field names exactly as received.

  1. Submit your quote.

POST your price quote to the callback_url included in each RFQ event. The callback URL is unique per request and has a short TTL, so respond promptly. It points at the v2 offers endpoint, so use the v2 field names documented below.

WebSocket topics and callbacks

  1. v2.price.ask.new (on the RFQ broadcast channel) delivers a Parlay RFQ to Market Makers when ProphetX needs a quote. Send your quote response to the event's callback_url in the following callback payload format:
{
  "parlay_id": "price_quote_request['parlay_id']",
  "offers": [
    {
      "valid_until": 1723564800000000000,
      "price": 1000,
      "max_risk": 200,
      "estimated_price": [
        {
          "strike_id": "strike_1",
          "price": 200
        },
        {
          "strike_id": "strike_2",
          "price": 220
        }
      ]
    }
  ]
}

Quote callback fields

Use these rules when you send the /orders/offers callback:

FieldDescription
max_riskMaximum quantity the Market Maker is willing to let the participant trade at the quoted price. Treat this as a capacity limit, not the Market Maker's fixed profit/loss commitment.
priceParlay price from the Market Maker's perspective. Use American price format. Do not follow normal price ladder, and can be set to any given price.
valid_untilExpiration time for the offer as a Unix timestamp in nanoseconds. Set this value to a time greater than 5 with latency padding after you send the callback. Do not set this value to 5.
estimated_pricePer-strike price breakdown for frontend display. Include strike_id and price. Required for uncorrelated parlays. ProphetX checks that the per-strike prices multiply back to the offer's price with the same rule as price_probability (see Tolerance). A mismatch does not reject the offer: the response is still 200 with success: true, plus a warning such as #0 offer: invalid estimated prices.

A quote callback response has three outcomes: 400 (invalid_params for a bad price, max_risk or valid_until, or for the wrong vocabulary on that path; wallet_insufficient_funds for a balance shortfall), 200 with a warning (offer accepted, but estimated_price did not reconstruct price), or a plain 200.

How max_risk works

When you POST an offer, max_risk is the most you are willing to let the participant trade against you at your quoted price. It is a ceiling on how much action you will take at that price.

For example, if you quote +200 and set max_risk to 100, you are saying: "I will accept up to a $100 order from the participant at +200." If the participant receives a profit, you would owe $200 in profit. If they only trade $50, you would owe $100 in profit.

Do not treat max_risk as the dollar amount you are putting up yourself. It is a capacity limit for the quote.

Balance check on your offer

When your offer callback arrives, ProphetX converts every tier in it to your liability and checks that your cash balance covers the sum across all tiers in that callback. The conversion is:

  • Positive price: max_risk × price / 100
  • Negative price: max_risk × 100 / |price|

If the total exceeds your cash balance, the whole callback is rejected with wallet_insufficient_funds and none of its tiers are considered. For example, a callback carrying +200 with max_risk 100 and +180 with max_risk 500 is checked against 200 + 900 = 1100. If you want tiers evaluated independently, send them in separate callbacks. Credit balances do not count toward this check.

Participant stake vs. your stake

max_risk and the RFQ quantity are expressed as the participant's stake. Every amount you see after the match is expressed as your stake at your price, which is your liability on the trade. The switch happens when ProphetX creates the two sides of the order: the participant's order is their stake at your quoted price, and your order is the mirror price with a stake equal to the participant's net win.

FieldWhose amountPrice it is paired with
max_risk on your offerParticipant's stakeprice you quoted
quantity on price.ask.newParticipant's staken/a
quantity on price.confirm.newYour stakeprice (mirror of your quote)
confirmed_quantity in your callbackYour stakeconfirmed_price
filled_quantity on order.matchedYour stakefill_price
confirmed_quantity on order.finalizedYour stakeconfirmed_price

Worked example: you quote +200 with max_risk 100 and the participant takes the full 100.

  • price.confirm.new arrives with price: -200, quantity: 200.
  • order.matched shows fill_price: -200, filled_quantity: 200.
  • order.finalized shows confirmed_price: -200, confirmed_quantity: 200, or less if you confirmed less.

If you had quoted -150 with max_risk 300, your side would be +150 for 200.

When the platform fee applies to a participant, your stake is computed from the participant's stake net of that fee, so it can come out slightly below max_risk converted at your price.

  1. price.confirm.new is sent to your private channel when the matcher selects your offer. It describes your order: price is the mirror of the price you quoted and quantity is your stake at that price (see Participant stake vs. your stake). Example event:
{
  "parlay_id": "abc-123",
  "creator_id": "user-456",
  "market_strikes": [...],
  "price": -200,
  "quantity": 200.0,
  "valid_until": 1723564800000000000,
  "callback_url": "https://..."
}

POST your confirmation to the event's callback_url. Set action to accept or reject. confirmed_quantity is your stake at confirmed_price, in the same terms as the quantity you received. If confirmed_quantity is null, the quantity does not change. A confirmed_quantity above the requested quantity is capped to it; a lower value is a partial fill and the participant's remainder is refunded.

Provide strike_id and probability for every non-SGP (single-game Parlay) strike. SGPs do not require probabilities, but including them improves the participant experience.

{
  "action": "accept",
  "confirmed_price": "...",
  "confirmed_quantity": 100.0,
  "price_probability": [
    {
      "max_risk": 200.0,
      "strikes": [
        {
          "strike_id": "strike_1",
          "probability": 0.5
        },
        {
          "strike_id": "strike_2",
          "probability": 0.4
        }
      ]
    },
    {
      "max_risk": 3000.0,
      "strikes": [
        {
          "strike_id": "strike_1",
          "probability": 0.4
        },
        {
          "strike_id": "strike_2",
          "probability": 0.5
        }
      ]
    }
  ]
}

Calculating price_probability

price_probability in the price.confirm.new callback must reflect the actual probability of each leg, so ProphetX can validate that your confirmed parlay price is fair and can auto-settle correctly if a leg pushes. Getting this right takes two steps.

1. Convert each leg's odds to an implied probability. For American odds:

  • Positive odds (+150): probability = 100 / (odds + 100)
  • Negative odds (-180): probability = -odds / (-odds + 100)

2. Multiply the legs together. For independent legs, the parlay's overall probability is the product of each leg's individual probability — this is what the product of your submitted strikes[].probability values must reconstruct.

Use the requester's side, not your own confirmed price, when computing that product. This is the part that's easy to get backwards: the probability you submit must correspond to the odds opposite your own confirmed_price/confirmed_odds, not the value itself. A real example that tripped this up: a Market Maker confirmed a 5-leg parlay at +4146 and submitted leg probabilities whose product came out to 0.023553264 — which is the implied probability of +4146 (0.023551578), matching almost exactly. That still came back invalid_probability, because the correct calculation should have used -4146 (the mirror of the confirmed price) as the target, not +4146 itself.

Which price is the target: yours or the participant's fee-adjusted price? Either passes. ProphetX checks the product against the participant's side at the price they see (your confirmed price mirrored, with the participant's fee baked in), and if that fails, against the mirror of your confirmed price before the fee. You do not know the participant's fee rate, so compute from your own confirmed_price: take the opposite sign and convert. If you confirm at +450, target -450 and a product of 450 / 550 = 0.8182. If you confirm at -300, target +300 and a product of 100 / 400 = 0.25.

Tolerance. The product is converted to American odds and rounded down, toward negative infinity: -125.2 becomes -126, +158.6 becomes +158. If that rounded value sits on a ProphetX price-ladder rung, the target must equal it exactly; only when it falls between two rungs may the target be either rung. The ladder step grows with the price: 1 point out to ±130, 2 points to ±200, 5 points to ±500, 10 points to ±1,000, 50 to ±2,000, 100 to ±5,000, 250 to ±10,000, 500 to ±25,000 and wider beyond that. Below ±130 every integer is a rung, so there the match is exact. The practical consequence: your product must never be more likely than the target price, and it must stay within one ladder step of it. Leg prices rounded to nearest that multiply to "about" the target fail roughly half the time, because the rounding pushes them one rung the wrong way. Examples, as target and the combined-probability window that passes: -125 needs 0.553572 to 0.555555 (fair is 0.555556); +159 needs 0.384616 to 0.386100; +682 needs 0.126583 to 0.128040. A safe recipe: compute your fair leg probabilities, take their product p and the target's implied probability P; if p > P, scale the legs so the product is P × (1 − 1e-6). Send at least six decimals. ProphetX does not round what you send, and the passing windows get narrow at long prices.

The max_risk values in price_probability must add up to at least the participant's confirmed stake. They are in the participant's stake, like max_risk on your offer. A sum below the confirmed stake is reported as invalid_probability even when the probabilities are right. Each entry is checked on its own, so when you send several entries every entry's product must reconstruct the target.

If your probabilities don't reconstruct the target closely enough, you'll see invalid_probability on the confirmation — but the trade still executes. It isn't a hard rejection. The only consequence is that ProphetX can't auto-settle the order if one of its legs pushes; ProphetX operations settles it manually instead. Still worth getting right, since manual settlement is slower and adds operational risk on both sides.

Single-game parlays. A parlay whose legs are all in one event may be confirmed with no price_probability at all. If you do send one, it is validated like any other, and the product is taken over the strikes you include, so a leg you leave out makes the product too high and the check fails. Send every leg or none.

Timeout and latency expectations

Use these timeout windows when you implement quote and confirmation handling:

ScenarioExpected timing
Maximum time for a Market Maker to submit a quoteProphetX uses a queue system and processes quotes in the order received. If no Market Maker quotes within 10 seconds, the request times out.
Maximum time for a participant to accept a quote10 seconds.
Timeout for the Market Maker to confirm after the participant accepts10 seconds.
Expected latency for execution to appear in the channel after Market Maker confirmationWithin 1 second.

Timeouts are counted the same way as rejects. If a Market Maker accumulates too many timeouts or rejects, ProphetX temporarily suspends that Market Maker for 15 minutes.

Rate limit handling

The Parlay API rate limit defaults to 1 request per second per token. If your integration needs a higher limit, contact your ProphetX integration contact — limits can be raised on request, after review. If a request returns 429, the response does not include a Retry-After header or X-RateLimit-* headers.

Instead, the response body includes the next allowed retry timestamp in the message string:

{
  "error": "rate_limit_reached",
  "message": "rate limit reached, please send only 1 requests/second, next allow 2026-06-18T20:18:37Z"
}

Use one of these retry strategies:

  1. Parse the next allow timestamp from the message string and sleep until that time. This is the most precise option because you retry when the API allows the next request.
  2. Use exponential backoff with jitter if you do not want to parse the message. Start around 1 second, double the wait time after each attempt, cap the wait around 30 seconds, and add a random offset of about ±25%.

Exponential backoff with jitter is less precise, but it helps prevent a thundering herd problem where many clients hit the limit, read the same next allow timestamp, and retry at the same moment.

  1. order.matched (v2.order.matched on the v2 broadcast channel) is sent on the broadcast channel as soon as the matcher selects a Market Maker — at the same time as price.confirm.new, before the Market Maker has confirmed via callback. This is preliminary, not a final match: the order's persisted status at this point is sent_confirmation. For the final, executed state, listen for order.finalized below. Example message:
{
  "payload": {
    "market_strikes": [...],
    "matched_at": 1759216871383341000,
    "fill_price": 188,
    "filled_quantity": 3.49,
    "parlay_id": "28250d66-30a4-406b-b90c-cd65c96d4c72",
    "timestamp": 1759216871383340000
  }
}

fill_price and filled_quantity are your side of the order: the same price and quantity as the price.confirm.new you received, not the participant's stake.

  1. order.finalized is sent after ProphetX receives the confirmation callback. This message confirms that the parlay order has been executed on the ProphetX side. Example payload:
{
  "payload": {
    "confirmed_price": -100000,
    "confirmed_quantity": 1349.049722844427,
    "price": -100000,
    "order_uuid": "01977e64-756b-7a75-b218-f0a0e4032004",
    "parlay_id": "23851166-3e18-4b3c-aea7-16de1b114bb8",
    "status": "finalized",
    "updated_at": 1750172203426483200
  },
  "timestamp": 1750172203428558300
}

confirmed_quantity is your confirmed stake at confirmed_price, your liability on the executed order. price is the price your order was originally created at (the mirror of your quote); confirmed_price differs from it only if you changed the price in your confirmation callback.

  1. order.settled is sent to the Market Maker after one of their orders in the Parlay reaches settlement.
{
  "payload": {
    "order_uuid": "01991588-274d-70be-ac0a-cf876677d57f",
    "parlay_id": "fdd7e3fb-ef50-42eb-9d73-43d3d7f1390f",
    "settlement_status": "profit",
    "settled_at": 1757002869231213000,
    "profit": 150
  },
  "timestamp": 1757002869231213000
}
  1. parlay.settled is sent to the participant after all orders in the Parlay reach settlement.
{
  "payload": {
    "parlay_id": "fdd7e3fb-ef50-42eb-9d73-43d3d7f1390f",
    "settlement_status": "profit",
    "settled_at": 1757002869231213000,
    "profit": 150
  },
  "timestamp": 1757002869231213000
}
  1. health_check works the same way as the Trading API. If your client does not receive this message for more than 30 seconds, reconnect to the WebSocket.

Did this page help you?