Skip to Content
PredictorSDK

A dead SX Bet identifier no longer reports an upstream outage

Fix

GET /v1/markets/{market_id} and GET /v1/events/{event_id} answered 502 upstream service unavailable for some identifiers that could never exist. The status code is the whole message: 502 tells a client the venue is down and the request is worth retrying, while 404 tells it the identifier is dead and it should stop asking. Reporting the first when the second was true turned a single typo'd or expired identifier into an unbounded retry loop.

SX Bet identifiers were the remaining gap, and both endpoints now validate the shape before calling upstream:

  • /v1/markets — a market_id that is not a 0x-prefixed 64-hex market hash now returns 400 invalid market_id. Previously sxbet:0xdeadbeef and eleven other malformed shapes returned 502.
  • /v1/events — an event_id that is not a fixture id (an uppercase letter followed by digits, e.g. L19825821) now returns 400 invalid event_id. This also closes a worse case: a single-digit event_id such as sxbet:1 made the upstream market filter drop out entirely, so the endpoint returned 200 with about a hundred markets drawn from unrelated fixtures grouped under one title.

Well-formed identifiers are unaffected. An identifier that is shaped correctly but does not exist still returns 404 — including sxbet:0x0000…0000 and sxbet:L99999999 — and a genuine upstream failure still returns 502, so a client can still tell "this is gone" apart from "try again later". Both routes already documented 400 for an invalid identifier, so no API schema or SDK signature changed.

This is the same classification the Hyperliquid and AlphaArcade lookups already used: malformed input is 400, a confirmed miss is 404, and 502 is reserved for the case where we genuinely could not find out.