{
  "openapi": "3.0.1",
  "info": {
    "title": "SX Bet API",
    "version": "1.0.0",
    "description": "REST API for the SX Bet decentralized sports betting exchange. Retrieve sports data, markets, and orderbook information. Post, cancel, and fill orders with signed payloads.\n\nBase URLs:\n- **Mainnet**: `https://api.sx.bet`\n- **Testnet**: `https://api.toronto.sx.bet`"
  },
  "servers": [
    {
      "url": "https://api.sx.bet",
      "description": "Mainnet (SX Network, chainId 4162)"
    },
    {
      "url": "https://api.toronto.sx.bet",
      "description": "Testnet (Toronto, chainId 79479957)"
    }
  ],
  "tags": [
    {
      "name": "Connection",
      "description": "Server metadata and heartbeat management"
    },
    {
      "name": "Sports Data",
      "description": "Sports, leagues, teams, fixtures, and live scores"
    },
    {
      "name": "Markets",
      "description": "Active, specific, and popular betting markets"
    },
    {
      "name": "Trades",
      "description": "Matched trades and portfolio history"
    },
    {
      "name": "Orders",
      "description": "Orderbook queries, posting, cancelling, and filling orders"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "API key for authenticated endpoints. See [API Key](/api-reference/api-key) for how to obtain one."
      }
    },
    "schemas": {
      "Sport": {
        "type": "object",
        "properties": {
          "sportId": {
            "type": "integer",
            "description": "Unique identifier for the sport",
            "example": 1
          },
          "label": {
            "type": "string",
            "description": "Human-readable sport name",
            "example": "Soccer"
          }
        }
      },
      "League": {
        "type": "object",
        "properties": {
          "leagueId": {
            "type": "integer",
            "description": "The ID for this league",
            "example": 1
          },
          "label": {
            "type": "string",
            "description": "The name of this league",
            "example": "English Premier League"
          },
          "sportId": {
            "type": "integer",
            "description": "The ID of the sport this league corresponds to",
            "example": 1
          },
          "active": {
            "type": "boolean",
            "description": "Whether or not the league is active on SX.bet currently",
            "example": true
          }
        }
      },
      "Team": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number",
            "description": "The ID for this team",
            "example": 725
          },
          "name": {
            "type": "string",
            "description": "The name of this team",
            "example": "Juventus"
          },
          "sport": {
            "type": "object",
            "description": "The sport this team belongs to",
            "properties": {
              "sportId": {
                "type": "integer",
                "description": "Unique identifier for the sport",
                "example": 1
              },
              "label": {
                "type": "string",
                "description": "Human-readable sport name",
                "example": "Basketball"
              },
              "active": {
                "type": "boolean",
                "description": "Whether this sport is currently active on SX.bet",
                "example": true
              }
            }
          }
        }
      },
      "Fixture": {
        "type": "object",
        "properties": {
          "participantOneName": {
            "type": "string",
            "description": "The first participant in the fixture. Present if it's a two-participant event."
          },
          "participantTwoName": {
            "type": "string",
            "description": "The second participant in the fixture. Present if it's a two-participant event."
          },
          "participants": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "All the participants in the fixture. Present if it's an n-participant event."
          },
          "startDate": {
            "type": "string",
            "description": "The start date of the event in UTC time"
          },
          "status": {
            "type": "number",
            "description": "The status of the fixture. See the [status table](/api-reference/get-fixture-status) for more details."
          },
          "leagueId": {
            "type": "number",
            "description": "The ID of the league this fixture belongs to"
          },
          "leagueLabel": {
            "type": "string",
            "description": "The name of the league this fixture belongs to"
          },
          "sportId": {
            "type": "number",
            "description": "The ID of the sport this fixture belongs to"
          },
          "eventId": {
            "type": "string",
            "description": "The ID of this fixture"
          }
        }
      },
      "LiveScore": {
        "type": "object",
        "properties": {
          "currentPeriod": {
            "type": "string",
            "description": "The current period label"
          },
          "extra": {
            "type": "string",
            "description": "Extra data for this match"
          },
          "leagueId": {
            "type": "integer",
            "description": "The league ID for this match"
          },
          "periodTime": {
            "type": "string",
            "description": "The time in the period. If it's `\"-1\"`, it is not available or the game is finished"
          },
          "periods": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "description": "The current period name"
                },
                "isFinished": {
                  "type": "boolean",
                  "description": "`true` if the period is over"
                },
                "teamOneScore": {
                  "type": "string",
                  "description": "The score of team one in this period"
                },
                "teamTwoScore": {
                  "type": "string",
                  "description": "The score of team two in this period"
                }
              }
            },
            "description": "All of the periods in the match"
          },
          "sportId": {
            "type": "integer",
            "description": "The ID of the sport for this match"
          },
          "teamOneScore": {
            "type": "integer",
            "description": "The current score for team one"
          },
          "teamTwoScore": {
            "type": "integer",
            "description": "The current score for team two"
          },
          "sportXeventId": {
            "type": "string",
            "description": "The event ID for this match"
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 timestamp of when this record was created"
          },
          "updatedAt": {
            "type": "string",
            "description": "ISO 8601 timestamp of when this record was last updated"
          }
        }
      },
      "Market": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "description": "`ACTIVE` or `INACTIVE`"
          },
          "marketHash": {
            "type": "string",
            "description": "The unique identifier for the market"
          },
          "outcomeOneName": {
            "type": "string",
            "description": "Outcome one for this market"
          },
          "outcomeTwoName": {
            "type": "string",
            "description": "Outcome two for this market"
          },
          "outcomeVoidName": {
            "type": "string",
            "description": "Outcome void for this market"
          },
          "teamOneName": {
            "type": "string",
            "description": "The name of the first team/player participating"
          },
          "teamTwoName": {
            "type": "string",
            "description": "The name of the second team/player participating"
          },
          "type": {
            "type": "integer",
            "description": "The type of the market"
          },
          "gameTime": {
            "type": "number",
            "description": "The UNIX timestamp of the game"
          },
          "line": {
            "type": "number",
            "nullable": true,
            "description": "The line of the market. Only applicable to markets with a line"
          },
          "sportXeventId": {
            "type": "string",
            "description": "The unique event ID for this market"
          },
          "liveEnabled": {
            "type": "boolean",
            "description": "Whether or not this match is available for live betting"
          },
          "sportLabel": {
            "type": "string",
            "description": "The name of the sport for this market"
          },
          "sportId": {
            "type": "number",
            "description": "The ID of the sport for this market"
          },
          "leagueId": {
            "type": "number",
            "description": "The league ID for this market"
          },
          "leagueLabel": {
            "type": "string",
            "description": "The name of the league for this market"
          },
          "mainLine": {
            "type": "boolean",
            "description": "If this market is currently the main line or not. If the market is not a market with multiple lines, this field will not be present"
          },
          "isQuarterLineMarket": {
            "type": "boolean",
            "description": "`true` if this market is a quarter-line market (Asian handicap or totals in .25 increments). See the [quarter lines changelog entry](/changelog#quarter-lines-gradual-rollout) for details."
          },
          "group1": {
            "type": "string",
            "description": "Indicator to the client of how to display this market"
          },
          "chainVersion": {
            "type": "string",
            "description": "The chain version this market is deployed on",
            "example": "SXR"
          },
          "participantOneId": {
            "type": "integer",
            "description": "The team ID of participant one"
          },
          "participantTwoId": {
            "type": "integer",
            "description": "The team ID of participant two"
          },
          "__type": {
            "type": "string",
            "description": "The type of this object",
            "example": "Market"
          },
          "legs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Market"
            },
            "description": "If this is a Parlay Market, this field will contain an array of the underlying Legs as a Market object"
          },
          "group2": {
            "type": "string",
            "description": "Secondary display grouping indicator for the market"
          },
          "teamOneMeta": {
            "type": "object",
            "description": "Extra metadata for team one"
          },
          "teamTwoMeta": {
            "type": "object",
            "description": "Extra metadata for team two"
          },
          "marketMeta": {
            "type": "object",
            "description": "Extra metadata for the market overall"
          },
          "reportedDate": {
            "type": "number",
            "description": "UNIX timestamp of when the market was reported/settled"
          },
          "outcome": {
            "type": "integer",
            "description": "The outcome of the market once settled"
          },
          "teamOneScore": {
            "type": "number",
            "description": "Final score for team one"
          },
          "teamTwoScore": {
            "type": "number",
            "description": "Final score for team two"
          }
        }
      },
      "PopularMarket": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "description": "`ACTIVE` or `INACTIVE`"
          },
          "marketHash": {
            "type": "string",
            "description": "The unique identifier for the market"
          },
          "outcomeOneName": {
            "type": "string",
            "description": "Outcome one for this market"
          },
          "outcomeTwoName": {
            "type": "string",
            "description": "Outcome two for this market"
          },
          "outcomeVoidName": {
            "type": "string",
            "description": "Outcome void for this market"
          },
          "teamOneName": {
            "type": "string",
            "description": "The name of the first team/player participating"
          },
          "teamTwoName": {
            "type": "string",
            "description": "The name of the second team/player participating"
          },
          "type": {
            "type": "integer",
            "description": "The type of the market"
          },
          "gameTime": {
            "type": "number",
            "description": "The UNIX timestamp of the game"
          },
          "line": {
            "type": "number",
            "nullable": true,
            "description": "The line of the market. Only applicable to markets with a line"
          },
          "sportXeventId": {
            "type": "string",
            "description": "The unique event ID for this market"
          },
          "liveEnabled": {
            "type": "boolean",
            "description": "Whether or not this match is available for live betting"
          },
          "sportLabel": {
            "type": "string",
            "description": "The name of the sport for this market"
          },
          "sportId": {
            "type": "number",
            "description": "The ID of the sport for this market"
          },
          "leagueId": {
            "type": "number",
            "description": "The league ID for this market"
          },
          "leagueLabel": {
            "type": "string",
            "description": "The name of the league for this market"
          },
          "mainLine": {
            "type": "boolean",
            "description": "If this market is currently the main line or not. Only present on markets with multiple lines"
          },
          "group1": {
            "type": "string",
            "description": "Indicator to the client of how to display this market"
          },
          "chainVersion": {
            "type": "string",
            "description": "The chain version this market is deployed on",
            "example": "SXR"
          }
        }
      },
      "Order": {
        "type": "object",
        "properties": {
          "marketHash": {
            "type": "string",
            "description": "The market corresponding to this order"
          },
          "fillAmount": {
            "type": "string",
            "description": "How much this order has been filled in Ethereum units up to a max of `totalBetSize`. See the token section of how to convert this into nominal amounts"
          },
          "pendingFillAmount": {
            "type": "string",
            "description": "The pending fill amount of this order in Ethereum units. See the token section for how to convert this into nominal amounts."
          },
          "orderHash": {
            "type": "string",
            "description": "A unique identifier for this order"
          },
          "maker": {
            "type": "string",
            "description": "The market maker for this order"
          },
          "totalBetSize": {
            "type": "string",
            "description": "The total size of this order in Ethereum units. See the the token section section for how to convert this into nominal amounts."
          },
          "percentageOdds": {
            "type": "string",
            "description": "The odds that the `maker` receives in the sx.bet protocol format. To convert to an implied odds divide by 10^20. To convert to the odds that the taker would receive if this order would be filled in implied format, use the formula `takerOdds=1-percentageOdds/10^20`. See the unit conversion section for more details."
          },
          "baseToken": {
            "type": "string",
            "description": "The base token this order is denominated in"
          },
          "executor": {
            "type": "string",
            "description": "The address permitted to execute on this order. This is set to the sx.bet exchange"
          },
          "salt": {
            "type": "string",
            "description": "A random number to differentiate identical orders"
          },
          "isMakerBettingOutcomeOne": {
            "type": "boolean",
            "description": "`true` if the maker is betting outcome one (and hence taker is betting outcome two if filled)"
          },
          "signature": {
            "type": "string",
            "description": "Signature of the maker on this order"
          },
          "expiry": {
            "type": "number",
            "description": "Deprecated: the time in unix seconds after which this order is no longer valid. After deprecation, this field is always 2209006800 (2040)"
          },
          "apiExpiry": {
            "type": "number",
            "description": "The time in unix seconds after which this order is no longer valid."
          },
          "sportXeventId": {
            "type": "string",
            "description": "The event related to this order"
          },
          "orderStatus": {
            "type": "string",
            "description": "The current status of the order. Possible values: `ACTIVE`, `INACTIVE`"
          }
        }
      },
      "Trade": {
        "type": "object",
        "properties": {
          "baseToken": {
            "type": "string",
            "description": "The token in which this trade was placed"
          },
          "bettor": {
            "type": "string",
            "description": "The address of the bettor who placed the trade"
          },
          "stake": {
            "type": "string",
            "description": "Exact token amount that was staked for the bet. To convert into a readable token amount, see the token conversion section"
          },
          "normalizedStake": {
            "type": "number",
            "description": "The `stake` value in the correct decimal format for the `baseToken`"
          },
          "odds": {
            "type": "string",
            "description": "Implied odds that the bettor received for this bet. Divide by 10^20 to get the odds in decimal format."
          },
          "orderHash": {
            "type": "string",
            "description": "The unique identifier of the order that was filled for this trade"
          },
          "marketHash": {
            "type": "string",
            "description": "The unique identifier of the market for which this trade was placed"
          },
          "maker": {
            "type": "boolean",
            "description": "`true` if the bettor is market maker in this trade"
          },
          "bettingOutcomeOne": {
            "type": "boolean",
            "description": "`true` if the bettor is betting outcome one in the market"
          },
          "settled": {
            "type": "boolean",
            "description": "`true` if this bet is settled (this refers to if the bet was won lost or voided, not if the trade succeeded or not)"
          },
          "betTimeValue": {
            "type": "number",
            "description": "The stake value in a human-readable decimal format"
          },
          "settleValue": {
            "type": "number",
            "description": "The settled payout value. `0` when unsettled."
          },
          "fillHash": {
            "type": "string",
            "description": "The unique identifier for this trade"
          },
          "tradeStatus": {
            "type": "string",
            "description": "`SUCCESS` or `FAILED` depending on if this trade succeeded or not"
          },
          "valid": {
            "type": "boolean",
            "description": "`true` if the trade counts toward competitions or tournaments"
          },
          "betType": {
            "type": "integer",
            "description": "The type of bet. `0` for straight bets."
          },
          "affiliate": {
            "type": "string",
            "description": "The affiliate address associated with this trade"
          },
          "providerEventId": {
            "type": "string",
            "description": "The provider's event ID for this trade"
          },
          "settleDate": {
            "type": "string",
            "description": "ISO formatted date string of when the trade was settled. Only present on settled trades."
          },
          "outcome": {
            "type": "number",
            "description": "`0`, `1`, or `2` depending on the final outcome of the market. Only present on settled trades."
          },
          "contractsVersion": {
            "type": "string",
            "description": "The version of the smart contracts used for this trade"
          },
          "settleTxHash": {
            "type": "string",
            "description": "The transaction hash of the settlement. Only present on settled trades."
          },
          "fillOrderHash": {
            "type": "string",
            "description": "The hash of the fill order transaction"
          },
          "fillOrderHashAttempts": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "All transaction hash attempts for filling this order"
          },
          "lastMineAttemptTime": {
            "type": "string",
            "description": "ISO formatted date string of the last time the transaction was attempted to be mined"
          },
          "beneficiaryType": {
            "type": "integer",
            "description": "The type of beneficiary for this trade"
          },
          "targetNonce": {
            "type": "integer",
            "description": "The nonce targeted for the fill transaction"
          },
          "createdAt": {
            "type": "string",
            "description": "ISO formatted date string of when this trade record was created"
          },
          "updatedAt": {
            "type": "string",
            "description": "ISO formatted date string of when this trade record was last updated"
          },
          "chainVersion": {
            "type": "string",
            "description": "`SXN` or `SXR`. See migration docs."
          },
          "sportXeventId": {
            "type": "string",
            "description": "The event related to this trade"
          },
          "netReturn": {
            "type": "string",
            "description": "The net return amount in the `baseToken` value"
          },
          "settleNetReturnValue": {
            "type": "number",
            "description": "The net return amount in USD (at the time of settlement). Only present on settled trades."
          },
          "marketHasRefunds": {
            "type": "boolean",
            "description": "`true` if capital-efficient refunds exist for this trade's market group; if `true`, query [Get portfolio refunds](/api-reference/get-trades-refunds) for details"
          },
          "betTime": {
            "type": "number",
            "description": "The time when the trade was placed. Returned as a UNIX timestamp (number) on `/trades`, or as an ISO date string on `/trades/orders`."
          },
          "isQuarterLineLeg": {
            "type": "boolean",
            "description": "Always present. `true` when this trade's `marketHash` is one of the two legs of a quarter-line market; `false` otherwise."
          },
          "quarterLineParentMarketHash": {
            "type": "string",
            "description": "Only present when `isQuarterLineLeg` is `true`. Holds the parent quarter-line market hash — i.e. the market the user originally placed on — which is different from the trade's own `marketHash`."
          }
        }
      },
      "Refund": {
        "type": "object",
        "properties": {
          "marketHash": {
            "type": "string",
            "description": "Market hash for this refund aggregation"
          },
          "baseToken": {
            "type": "string",
            "description": "Base token of the refunds"
          },
          "totalRefundedBetTimeValue": {
            "type": "number",
            "description": "Sum of refund amounts for this market at bet-time value"
          },
          "events": {
            "type": "array",
            "description": "Individual refund events that make up the aggregation",
            "items": {
              "type": "object",
              "properties": {
                "marketHash": {
                  "type": "string",
                  "description": "Market hash"
                },
                "baseToken": {
                  "type": "string",
                  "description": "Token address"
                },
                "bettor": {
                  "type": "string",
                  "description": "Bettor address"
                },
                "maker": {
                  "type": "boolean",
                  "description": "`true` if bettor was maker for this refund"
                },
                "fillOrderHash": {
                  "type": "string",
                  "description": "Fill hash associated with the refund"
                },
                "amount": {
                  "type": "string",
                  "description": "Refund amount in base token (string-encoded)"
                },
                "createdAt": {
                  "type": "string",
                  "description": "ISO date string of event creation"
                }
              }
            }
          }
        }
      },
      "ConsolidatedTrade": {
        "type": "object",
        "properties": {
          "baseToken": {
            "type": "string",
            "description": "The token in which this trade was placed"
          },
          "tradeStatus": {
            "type": "string",
            "description": "`SUCCESS` or `FAILED` depending on if this trade succeeded or not"
          },
          "bettor": {
            "type": "string",
            "description": "The address of the bettor who placed the trade"
          },
          "totalStake": {
            "type": "string",
            "description": "Total nominal stake of the trade"
          },
          "totalBetTimeValue": {
            "type": "string",
            "description": "Total stake value in a human-readable decimal format"
          },
          "weightedAverageOdds": {
            "type": "string",
            "description": "Weighted average odds (based on stake) of the trade if the trade filled multiple orders. Divide by 10^20 to get the odds in decimal format."
          },
          "netReturn": {
            "type": "string",
            "description": "The net return amount in the `baseToken` value"
          },
          "netReturnBetTimeValue": {
            "type": "number",
            "description": "The net return value in a human-readable decimal format"
          },
          "marketHash": {
            "type": "string",
            "description": "The unique identifier of the market for which this trade was placed"
          },
          "maker": {
            "type": "boolean",
            "description": "`true` if the bettor is market maker in this trade"
          },
          "settled": {
            "type": "boolean",
            "description": "`true` if this bet is settled (this refers to if the bet was won lost or voided, not if the trade succeeded or not)"
          },
          "fillHash": {
            "type": "string",
            "description": "The unique identifier for this trade"
          },
          "gameLabel": {
            "type": "string",
            "description": "A general label for the market"
          },
          "bettingOutcome": {
            "type": "number",
            "description": "`1` if the bettor is betting outcome one, `2` otherwise"
          },
          "sportXeventId": {
            "type": "string",
            "description": "The unique fixture ID for this trade"
          },
          "gameTime": {
            "type": "string",
            "description": "ISO formatted date string of when the game is supposed to occur"
          },
          "leagueLabel": {
            "type": "string",
            "description": "The name of this league"
          },
          "sportId": {
            "type": "integer",
            "description": "The sport ID for this trade"
          },
          "bettingOutcomeLabel": {
            "type": "string",
            "description": "Which team/side the bettor bet"
          },
          "betTime": {
            "type": "number",
            "description": "The time in UNIX seconds when the trade was placed"
          },
          "fillOrderHash": {
            "type": "string",
            "description": "The hash of the fill order transaction"
          },
          "totalReturn": {
            "type": "string",
            "description": "Total return amount in the `baseToken` value"
          },
          "crosschainNetReturn": {
            "type": "string",
            "description": "Net return from cross-chain activity"
          },
          "chainVersion": {
            "type": "string",
            "description": "`SXN` or `SXR`. See migration docs."
          },
          "marketHasRefunds": {
            "type": "boolean",
            "description": "`true` if capital efficient refunds exist for this market group; if `true`, query [Get portfolio refunds](/api-reference/get-trades-refunds) for details"
          },
          "marketType": {
            "type": "integer",
            "description": "The market type for this trade"
          },
          "outcome": {
            "type": "number",
            "description": "`0`, `1`, or `2` depending on the final outcome of the market. Only present on settled trades."
          },
          "settleNetReturnValue": {
            "type": "number",
            "description": "The net return value in human-readable decimal format at settlement time"
          },
          "isQuarterLineParent": {
            "type": "boolean",
            "description": "`true` on the synthetic parent consolidated trade for a quarter-line bet. The parent aggregates `totalStake`, `totalReturn`, and `netReturn` across both legs — use this entry (not the legs) for user-facing P&L and volume."
          },
          "isQuarterLineLeg": {
            "type": "boolean",
            "description": "`true` on each of the two leg consolidated trades that make up a quarter-line bet. The matching parent is identified by `quarterLineFillHash`."
          }
        }
      },
      "SignedNewOrder": {
        "type": "object",
        "required": [
          "marketHash",
          "maker",
          "baseToken",
          "totalBetSize",
          "percentageOdds",
          "expiry",
          "apiExpiry",
          "executor",
          "salt",
          "isMakerBettingOutcomeOne",
          "signature"
        ],
        "properties": {
          "marketHash": {
            "type": "string",
            "description": "The market you wish to place this order under"
          },
          "maker": {
            "type": "string",
            "description": "The ethereum address offering the bet. The address in the `maker` field must match the account being used to create the signature!"
          },
          "baseToken": {
            "type": "string",
            "description": "The token this order is denominated in. Token addresses vary by network \u2014 see the `addresses` field in GET /metadata or the References page for the correct address."
          },
          "totalBetSize": {
            "type": "string",
            "description": "The total bet size of the order in Ethereum units. Minimum 10 USDC."
          },
          "percentageOdds": {
            "type": "string",
            "description": "The odds the maker will be receiving as this order gets filled. Must be on the odds ladder or will be rejected."
          },
          "expiry": {
            "type": "integer",
            "description": "Deprecated. Time in UNIX seconds after which this order is no longer valid. Must always be 2209006800."
          },
          "apiExpiry": {
            "type": "integer",
            "description": "Time in UNIX seconds after which this order is no longer valid."
          },
          "executor": {
            "type": "string",
            "description": "The sx.bet executor address. See the metadata section for where to get this address"
          },
          "salt": {
            "type": "string",
            "description": "A random 32 byte string to differentiate between orders with otherwise identical parameters"
          },
          "isMakerBettingOutcomeOne": {
            "type": "boolean",
            "description": "`true` if the maker is betting outcome one (and hence taker is betting outcome two if filled)"
          },
          "signature": {
            "type": "string",
            "description": "The signature of the maker on this order payload"
          }
        }
      },
      "Metadata": {
        "type": "object",
        "properties": {
          "executorAddress": {
            "type": "string",
            "description": "The executor address for the sx.bet exchange. Use this address for setting the `executor` when posting new orders as a market maker."
          },
          "oracleFees": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "A mapping from token address to an object of fee tiers (0\u20133) to fee amounts. Tiers 0 and 1 are 0; tiers 2 and 3 indicate the fees paid on profit. To convert to a readable number, divide by 10^20"
          },
          "sportXAffiliate": {
            "type": "object",
            "properties": {
              "address": {
                "type": "string"
              },
              "amount": {
                "type": "string"
              }
            },
            "description": "The default sx.bet affiliate. Currently set to 0 and unused"
          },
          "makerOrderMinimums": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "A mapping from token address to a real token amount indicating the minimum maker order size. To convert into a readable amount, see [the token conversion section](/api-reference/unit-conversion)"
          },
          "takerMinimums": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "A mapping from token address to a real token amount indicating the minimum taker order size. To convert into a readable amount, see [the token conversion section](/api-reference/unit-conversion)"
          },
          "addresses": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "A mapping from network id -> canonical token name -> token address of assets supported by the exchange"
          },
          "domainVersion": {
            "type": "string",
            "description": "The domain version used in order signing"
          },
          "EIP712FillHasher": {
            "type": "string",
            "description": "The contract address to use as `verifyingContract` in the EIP712 domain when signing fill orders."
          },
          "TokenTransferProxy": {
            "type": "string",
            "description": "Contract address to approve when enabling betting."
          },
          "bridgeFee": {
            "type": "number",
            "description": "Bridge fee amount"
          },
          "oddsLadderStepSize": {
            "type": "integer",
            "description": "Odds ladder step size. See [the post a new order section](/api-reference/post-new-order)"
          },
          "depositBridgeFee": {
            "type": "number",
            "description": "Default deposit bridge fee"
          },
          "withdrawalBridgeFee": {
            "type": "number",
            "description": "Default withdrawal bridge fee"
          },
          "depositBridgeFeeEthereum": {
            "type": "number",
            "description": "Bridge fee for Ethereum deposits"
          },
          "minimumDepositAmountEthereum": {
            "type": "number",
            "description": "Minimum deposit amount from Ethereum"
          },
          "depositBridgeFeeArbitrum": {
            "type": "number",
            "description": "Bridge fee for Arbitrum deposits"
          },
          "minimumDepositAmountArbitrum": {
            "type": "number",
            "description": "Minimum deposit amount from Arbitrum"
          },
          "withdrawBridgeFeeArbitrum": {
            "type": "number",
            "description": "Bridge fee for Arbitrum withdrawals"
          },
          "popularSports": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Ordered list of popular sport IDs"
          },
          "leagueOrderingBySport": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "description": "A mapping from sport ID to an ordered list of preferred league IDs"
          },
          "cashoutFee": {
            "type": "string",
            "description": "Fee applied on cashout"
          },
          "crosschainFees": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            },
            "description": "Cross-chain fee rates by chain ID"
          },
          "chainVersion": {
            "type": "string",
            "description": "The current chain version (e.g. `SXR`)"
          }
        }
      }
    }
  },
  "paths": {
    "/metadata": {
      "get": {
        "operationId": "getMetadata",
        "tags": [
          "Connection"
        ],
        "summary": "Get metadata",
        "description": "This endpoint retrieves metadata on the exchange itself and useful parameters to interact with the exchange.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Metadata"
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "executorAddress": "0x52adf738AAD93c31f798a30b2C74D658e1E9a562",
                    "oracleFees": {
                      "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B": {
                        "0": "0",
                        "1": "0",
                        "2": "5000000000000000000",
                        "3": "5000000000000000000"
                      },
                      "0x3E96B0a25d51e3Cc89C557f152797c33B839968f": {
                        "0": "0",
                        "1": "0",
                        "2": "5000000000000000000",
                        "3": "5000000000000000000"
                      }
                    },
                    "sportXAffiliate": {
                      "address": "0x0000000000000000000000000000000000000000",
                      "amount": "0"
                    },
                    "makerOrderMinimums": {
                      "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B": "10000000",
                      "0x3E96B0a25d51e3Cc89C557f152797c33B839968f": "30000000000000000000"
                    },
                    "takerMinimums": {
                      "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B": "1000000",
                      "0x3E96B0a25d51e3Cc89C557f152797c33B839968f": "30000000000000000000"
                    },
                    "addresses": {
                      "4162": {
                        "USDC": "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B",
                        "WSX": "0x3E96B0a25d51e3Cc89C557f152797c33B839968f"
                      }
                    },
                    "EIP712FillHasher": "0x845a2Da2D70fEDe8474b1C8518200798c60aC364",
                    "TokenTransferProxy": "0x38aef22152BC8965bf0af7Cf53586e4b0C4E9936",
                    "oddsLadderStepSize": 125,
                    "bridgeFee": 1,
                    "depositBridgeFee": 0,
                    "withdrawalBridgeFee": 0,
                    "depositBridgeFeeEthereum": 1,
                    "minimumDepositAmountEthereum": 10,
                    "depositBridgeFeeArbitrum": 0.1,
                    "minimumDepositAmountArbitrum": 5,
                    "withdrawBridgeFeeArbitrum": 0,
                    "popularSports": [
                      6,
                      1,
                      5
                    ],
                    "leagueOrderingBySport": {
                      "1": [
                        1,
                        2
                      ],
                      "8": [
                        243,
                        246
                      ]
                    },
                    "cashoutFee": "0",
                    "crosschainFees": {
                      "137": 0.03,
                      "42161": 0.03,
                      "80094": 0.03
                    },
                    "chainVersion": "SXR",
                    "domainVersion": "6.0"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/heartbeat": {
      "post": {
        "operationId": "registerHeartbeat",
        "tags": [
          "Heartbeat"
        ],
        "summary": "Register heartbeat",
        "description": "To register and refresh your heartbeat with 0 > `timeoutSeconds` <= 3600. Ping this endpoint to maintain your heartbeat after initial registration.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "requestor",
                  "timeoutSeconds"
                ],
                "properties": {
                  "requestor": {
                    "type": "string",
                    "description": "The ethereum address associated with your account"
                  },
                  "timeoutSeconds": {
                    "type": "integer",
                    "description": "The number of seconds before heartbeat service times out and cancels your open orders",
                    "minimum": 0,
                    "maximum": 3600
                  }
                }
              },
              "example": {
                "requestor": "<YOUR-ACCOUNT-ADDRESS>",
                "timeoutSeconds": 10
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Bad request \u2014 missing or invalid `requestor` or `timeoutSeconds`"
          },
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "requestor": {
                          "type": "string",
                          "description": "The ethereum address associated with your account"
                        },
                        "timeoutSeconds": {
                          "type": "integer",
                          "description": "The number of seconds before heartbeat service times out and cancels your open orders"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "A JS Date object describing when the heartbeat will timeout/expire (UTC)"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "requestor": "<YOUR-ACCOUNT-ADDRESS>",
                    "timeoutSeconds": 10,
                    "expiresAt": "2024-11-12T14:35:06.614Z"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sports": {
      "get": {
        "operationId": "getSports",
        "tags": [
          "Sports Data"
        ],
        "summary": "Get sports",
        "description": "This endpoint retrieves all sports available on the exchange",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Sport"
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "sportId": 1,
                      "label": "Soccer"
                    },
                    {
                      "sportId": 2,
                      "label": "Basketball"
                    },
                    {
                      "sportId": 3,
                      "label": "American Football"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/leagues": {
      "get": {
        "operationId": "getLeagues",
        "tags": [
          "Sports Data"
        ],
        "summary": "Get leagues",
        "description": "This endpoint returns all the leagues supported by SX.bet",
        "parameters": [
          {
            "name": "sportId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Only return leagues for this particular sport ID."
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/League"
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "leagueId": 1,
                      "label": "NBA",
                      "sportId": 1,
                      "active": true
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/teams": {
      "get": {
        "operationId": "getTeams",
        "tags": [
          "Sports Data"
        ],
        "summary": "Get teams",
        "description": "Returns all teams supported by SX.bet. Results are paginated starting at page 0 with a maximum of 500 records per page.",
        "parameters": [
          {
            "name": "sportId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Filter teams by sport ID."
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0
            },
            "description": "Page number for pagination, starting at 0."
          },
          {
            "name": "perPage",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500
            },
            "description": "Number of results per page. Default is 20. Maximum is 500."
          },
          {
            "name": "id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Filter by a specific team ID."
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Team"
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "id": 275,
                      "name": "Boston Celtics",
                      "sport": {
                        "sportId": 1,
                        "label": "Basketball",
                        "active": true
                      }
                    },
                    {
                      "id": 276,
                      "name": "Miami Heat",
                      "sport": {
                        "sportId": 1,
                        "label": "Basketball",
                        "active": true
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 no teams found matching the given parameters"
          }
        }
      }
    },
    "/leagues/active": {
      "get": {
        "operationId": "getActiveLeagues",
        "tags": [
          "Sports Data"
        ],
        "summary": "Get active leagues",
        "description": "This endpoint returns all the currently active leagues with markets in them. Note that this endpoint is only updated every 10m. The response format is the same as the get leagues endpoint, with an additional field `eventsByType` which maps the number of unique events within a particular bet group (for example, `game-lines` or `outright-winner`).",
        "parameters": [
          {
            "name": "sportId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Only return active leagues under this sport"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "leagueId": {
                            "type": "integer",
                            "description": "The ID for this league",
                            "example": 1236
                          },
                          "label": {
                            "type": "string",
                            "description": "The name of this league",
                            "example": "Portugal Primeira Liga"
                          },
                          "sportId": {
                            "type": "integer",
                            "description": "The ID of the sport this league corresponds to",
                            "example": 5
                          },
                          "eventsByType": {
                            "type": "object",
                            "description": "Maps bet group types to the number of unique events within that type",
                            "additionalProperties": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "leagueId": 1236,
                      "label": "Portugal Primeira Liga",
                      "sportId": 5,
                      "eventsByType": {
                        "game-lines": 6,
                        "1X2": 5
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/leagues/teams/{id}": {
      "get": {
        "operationId": "getLeagueTeams",
        "tags": [
          "Sports Data"
        ],
        "summary": "League teams",
        "description": "This endpoint returns all the teams under a particular league",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            },
            "description": "Return the teams for this league ID"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "teams": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Team"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "teams": [
                      {
                        "id": 725,
                        "name": "Juventus"
                      },
                      {
                        "id": 724,
                        "name": "Inter"
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 invalid league ID"
          }
        }
      }
    },
    "/fixture/active": {
      "get": {
        "operationId": "getActiveFixtures",
        "tags": [
          "Sports Data"
        ],
        "summary": "Get active fixtures",
        "description": "This endpoint returns current active fixtures for a particular league. A fixture can also be thought of as an event and multiple markets are under a particular event.",
        "parameters": [
          {
            "name": "leagueId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the league"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Fixture"
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "participantOneName": "Nevada Wolf Pack",
                      "participantTwoName": "North Dakota State",
                      "startDate": "2020-11-25T20:00:00.000Z",
                      "status": 1,
                      "leagueId": 2,
                      "leagueLabel": "NCAA",
                      "sportId": 1,
                      "eventId": "L6206070"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/fixture/status": {
      "get": {
        "operationId": "getFixtureStatus",
        "tags": [
          "Sports Data"
        ],
        "summary": "Get fixture status",
        "description": "This endpoint returns the status of the passed event IDs.",
        "parameters": [
          {
            "name": "sportXEventIds",
            "in": "query",
            "required": true,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "An array of event IDs (comma separated)"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "description": "Mapping from event ID to an object containing the fixture status code.",
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "status": {
                            "type": "integer",
                            "description": "The status code for this fixture. See the [status table](/api-reference/fixture-statuses) for more details."
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "L18016511": {
                      "status": 1
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request \u2014 `sportXEventIds` is empty or contains more than 30 event IDs"
          }
        }
      }
    },
    "/search": {
      "get": {
        "operationId": "searchEvents",
        "tags": [
          "Sports Data"
        ],
        "summary": "Search fixtures by team name",
        "description": "Returns up to 8 active fixtures where either `teamOneName` or `teamTwoName` contains the search query. Search is case-insensitive, supports partial matches, and results are ordered by `gameTime`.",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 3,
              "maxLength": 100
            },
            "description": "A team name or partial team name. Must be between 3 and 100 characters."
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "gameTime",
                          "teamOneName",
                          "teamTwoName",
                          "providerEventId",
                          "type",
                          "eventId",
                          "chainVersion",
                          "league"
                        ],
                        "properties": {
                          "gameTime": {
                            "type": "string",
                            "description": "Scheduled event time"
                          },
                          "teamOneName": {
                            "type": "string",
                            "description": "Name of the first team"
                          },
                          "teamTwoName": {
                            "type": "string",
                            "description": "Name of the second team"
                          },
                          "providerEventId": {
                            "type": "string",
                            "description": "Event ID from the data provider"
                          },
                          "provider": {
                            "type": "string",
                            "description": "Name of the data provider for this event"
                          },
                          "type": {
                            "type": "array",
                            "items": {
                              "type": "integer"
                            },
                            "description": "List of available market type IDs for the event"
                          },
                          "eventId": {
                            "type": "string",
                            "description": "Event identifier"
                          },
                          "chainVersion": {
                            "type": "string",
                            "description": "Chain version associated with the event"
                          },
                          "league": {
                            "type": "object",
                            "description": "League information object",
                            "required": ["leagueId", "sportId", "label"],
                            "properties": {
                              "leagueId": {
                                "type": "integer"
                              },
                              "sportId": {
                                "type": "integer"
                              },
                              "label": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "gameTime": "2026-04-28T02:10:00.000Z",
                      "teamOneName": "Los Angeles Dodgers",
                      "teamTwoName": "Miami Marlins",
                      "providerEventId": "17495682",
                      "provider": "LSPORT",
                      "type": [28, 226, 236, 342, 1618],
                      "eventId": "L17495682",
                      "chainVersion": "SXR",
                      "league": {
                        "leagueId": 171,
                        "sportId": 3,
                        "label": "MLB"
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request — `query` is missing or its length is outside the 3–100 character range"
          }
        }
      }
    },
    "/live-scores": {
      "get": {
        "operationId": "getLiveScores",
        "tags": [
          "Sports Data"
        ],
        "summary": "Get live scores",
        "description": "This endpoint retrieves live scores for a particular event ID.",
        "parameters": [
          {
            "name": "sportXEventIds",
            "in": "query",
            "required": true,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "An array of event IDs"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LiveScore"
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "sportId": 3,
                      "leagueId": 171,
                      "sportXeventId": "L17406328",
                      "currentPeriod": "5th Inning",
                      "periodTime": "-1",
                      "teamOneScore": 4,
                      "teamTwoScore": 1,
                      "periods": [
                        {
                          "label": "1st Inning",
                          "isFinished": true,
                          "teamOneScore": "4",
                          "teamTwoScore": "0"
                        },
                        {
                          "label": "4th Inning",
                          "isFinished": true,
                          "teamOneScore": "0",
                          "teamTwoScore": "1"
                        },
                        {
                          "label": "3rd Inning",
                          "isFinished": true,
                          "teamOneScore": "0",
                          "teamTwoScore": "0"
                        },
                        {
                          "label": "2nd Inning",
                          "isFinished": true,
                          "teamOneScore": "0",
                          "teamTwoScore": "0"
                        },
                        {
                          "label": "5th Inning",
                          "isFinished": false,
                          "teamOneScore": "0",
                          "teamTwoScore": "0"
                        }
                      ],
                      "extra": "[{\"Name\":\"Strikes\",\"Value\":\"0\"},{\"Name\":\"Balls\",\"Value\":\"0\"},{\"Name\":\"Outs\",\"Value\":\"0\"},{\"Name\":\"Turn\",\"Value\":\"2\"},{\"Name\":\"Bases\",\"Value\":\"0/0/0\"}]",
                      "createdAt": "2026-03-13T17:05:53.092Z",
                      "updatedAt": "2026-03-13T18:21:26.741Z"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/markets/active": {
      "get": {
        "operationId": "getActiveMarkets",
        "tags": [
          "Markets"
        ],
        "summary": "Get active markets",
        "description": "This endpoint retrieves active markets on the exchange. It does not return markets that have been settled or reported.",
        "parameters": [
          {
            "name": "onlyMainLine",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "If set to true, the result will only include main lines on spread and over under markets"
          },
          {
            "name": "eventId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "If set, it will only include markets for a particular sportXeventId"
          },
          {
            "name": "leagueId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "If set, it will only include markets for a particular league ID"
          },
          {
            "name": "sportIds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "description": "If set, it will only include markets for particular sport IDs (comma separated)"
          },
          {
            "name": "liveOnly",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "If set, it will only include markets that are currently available for in-play betting"
          },
          {
            "name": "betGroup",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "If set, it will only include markets for a particular bet group"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "description": "If set, it will only include markets for those particular market types. See below for the options"
          },
          {
            "name": "paginationKey",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Used for pagination. Pass the `nextKey` returned from the previous request to retrieve the next set of records."
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Used for pagination. Requested page size. Each call will only return up to this amount of records. Maximum of 100"
          },
          {
            "name": "gameTime",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "If set, only return markets for games starting at or after this UNIX timestamp"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "markets": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Market"
                          }
                        },
                        "nextKey": {
                          "type": "string",
                          "description": "Use this key as the `paginationKey` to retrieve the next set of records, if any"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "markets": [
                      {
                        "status": "ACTIVE",
                        "marketHash": "0x8120ae9408cd7556246473be7ceada8cba47d42418cce31ffad0b67b196e3218",
                        "outcomeOneName": "Golden State Warriors",
                        "outcomeTwoName": "Minnesota Timberwolves",
                        "outcomeVoidName": "NO_CONTEST",
                        "teamOneName": "Golden State Warriors",
                        "teamTwoName": "Minnesota Timberwolves",
                        "type": 226,
                        "gameTime": 1773453600,
                        "sportXeventId": "L18272456",
                        "liveEnabled": true,
                        "sportLabel": "Basketball",
                        "sportId": 1,
                        "leagueId": 1,
                        "leagueLabel": "NBA",
                        "group1": "NBA",
                        "chainVersion": "SXR",
                        "participantOneId": 15002,
                        "participantTwoId": 14999,
                        "__type": "Market"
                      },
                      {
                        "status": "ACTIVE",
                        "marketHash": "0x531e9e6d6469f6323d464340e91840b3666e4e43cf04b8c2a52c2ac0d67839fb",
                        "outcomeOneName": "Golden State Warriors +6.5",
                        "outcomeTwoName": "Minnesota Timberwolves -6.5",
                        "outcomeVoidName": "NO_GAME_OR_EVEN",
                        "teamOneName": "Golden State Warriors",
                        "teamTwoName": "Minnesota Timberwolves",
                        "type": 342,
                        "gameTime": 1773453600,
                        "line": 6.5,
                        "sportXeventId": "L18272456",
                        "liveEnabled": true,
                        "sportLabel": "Basketball",
                        "sportId": 1,
                        "leagueId": 1,
                        "leagueLabel": "NBA",
                        "group1": "NBA",
                        "chainVersion": "SXR",
                        "participantOneId": 15002,
                        "participantTwoId": 14999,
                        "mainLine": true,
                        "__type": "Market"
                      }
                    ],
                    "nextKey": "60c7b8f54da0ad001aa3261c"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/markets/find": {
      "get": {
        "operationId": "findMarkets",
        "tags": [
          "Markets"
        ],
        "summary": "Find markets by hash",
        "description": "This endpoint retrieves specific markets",
        "parameters": [
          {
            "name": "marketHashes",
            "in": "query",
            "required": true,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "The market hashes of the markets to retrieve. Comma separated. **Maximum 30.**"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Market"
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "status": "ACTIVE",
                      "marketHash": "0x531e9e6d6469f6323d464340e91840b3666e4e43cf04b8c2a52c2ac0d67839fb",
                      "outcomeOneName": "Golden State Warriors +6.5",
                      "outcomeTwoName": "Minnesota Timberwolves -6.5",
                      "outcomeVoidName": "NO_GAME_OR_EVEN",
                      "teamOneName": "Golden State Warriors",
                      "teamTwoName": "Minnesota Timberwolves",
                      "type": 342,
                      "gameTime": 1773453600,
                      "line": 6.5,
                      "sportXeventId": "L18272456",
                      "liveEnabled": true,
                      "sportLabel": "Basketball",
                      "sportId": 1,
                      "leagueId": 1,
                      "leagueLabel": "NBA",
                      "group1": "NBA",
                      "chainVersion": "SXR",
                      "participantOneId": 15002,
                      "participantTwoId": 14999,
                      "mainLine": true
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Error Codes:\n\n`BAD_MARKET_HASHES` \u2014 Invalid `marketHashes` or more than 30 `marketHashes` queried",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "errorCode": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/markets/popular": {
      "get": {
        "operationId": "getPopularMarkets",
        "tags": [
          "Markets"
        ],
        "summary": "Get popular markets",
        "description": "This endpoint retrieves the top 10 popular markets by volume.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Market"
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "status": "ACTIVE",
                      "marketHash": "0x9e86f7a99672288968cb94c69106cee559da7fb7495a857efce363424716eb0b",
                      "outcomeOneName": "Wrexham",
                      "outcomeTwoName": "Not Wrexham",
                      "outcomeVoidName": "NO_CONTEST",
                      "teamOneName": "Wrexham",
                      "teamTwoName": "Swansea City",
                      "type": 1,
                      "gameTime": 1773432000,
                      "sportXeventId": "L18188034",
                      "liveEnabled": true,
                      "sportLabel": "Soccer",
                      "sportId": 5,
                      "leagueId": 1313,
                      "leagueLabel": "The Championship",
                      "group1": "The Championship",
                      "chainVersion": "SXR"
                    },
                    {
                      "status": "ACTIVE",
                      "marketHash": "0x3719cd6ada1e6010dba90db84e576184226fb47818dd893cd31bc25e4ed68cbb",
                      "outcomeOneName": "Over 2.5",
                      "outcomeTwoName": "Under 2.5",
                      "outcomeVoidName": "NO_GAME_OR_EVEN",
                      "teamOneName": "Wrexham",
                      "teamTwoName": "Swansea City",
                      "type": 2,
                      "gameTime": 1773432000,
                      "line": 2.5,
                      "sportXeventId": "L18188034",
                      "liveEnabled": true,
                      "sportLabel": "Soccer",
                      "sportId": 5,
                      "leagueId": 1313,
                      "leagueLabel": "The Championship",
                      "group1": "The Championship",
                      "chainVersion": "SXR",
                      "mainLine": true
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/trades": {
      "get": {
        "operationId": "getTrades",
        "tags": [
          "Trades"
        ],
        "summary": "Get trades",
        "description": "This endpoint retrieves past trades on the exchange split up by order. This is a paginated endpoint. For example, if a trade fills more than one order at once, it will show up as two entries for the bettor. If `bettor` is not provided, results are limited to trades placed within the last 12 months.",
        "parameters": [
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Only get trades placed after this time in UNIX seconds"
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Only get trades placed before this time in UNIX seconds"
          },
          {
            "name": "bettor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only get trades placed by this bettor (regardless if maker or taker)"
          },
          {
            "name": "settled",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "If `true`, only get settled trades"
          },
          {
            "name": "marketHashes",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Only get trades for particular markets. Comma separated. Maximum 100 market hashes per request; requests exceeding this are rejected with a `400` error"
          },
          {
            "name": "baseToken",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only get trades placed for a particular token"
          },
          {
            "name": "maker",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "If `true`, only get trades where the bettor is the maker"
          },
          {
            "name": "affiliate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only get trades under this affiliate"
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Requested page size. Each call will only return up to this amount of records. Default is 100."
          },
          {
            "name": "paginationKey",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Used for pagination. Pass the `nextKey` returned from the previous request to retrieve the next set of records."
          },
          {
            "name": "tradeStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter trades to see only those with `SUCCESS` or `FAILED` status"
          },
          {
            "name": "sportXeventId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only get trades for this event ID"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "trades": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Trade"
                          }
                        },
                        "nextKey": {
                          "type": "string",
                          "description": "Pagination key to pass as `paginationKey` to retrieve the next page of results. Absent if no more results."
                        },
                        "pageSize": {
                          "type": "number",
                          "description": "Maximum amount of records on this page. Will be equal to the `pageSize` passed in."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "trades": [
                      {
                        "baseToken": "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B",
                        "bettor": "0x713117eCdEfB29B919544C7502162423220fE78b",
                        "stake": "5471240",
                        "normalizedStake": "5",
                        "odds": "65000000000000000000",
                        "orderHash": "0xa39a03729714170256eb0ea3c3c14b2985f7320d6fa75663edbca8c6d6e4dc83",
                        "marketHash": "0x80f558d8535e4f1343e3dc0303ab6d32432c732607fc460fe910ef95845ba40d",
                        "maker": false,
                        "bettingOutcomeOne": false,
                        "settled": true,
                        "betTimeValue": 5.47124,
                        "settleValue": 1,
                        "fillHash": "0x8e55b9a69f8b2ff4b9816f59c772da765227df104833daad946cfe36d2873938",
                        "tradeStatus": "SUCCESS",
                        "valid": true,
                        "betType": 1,
                        "settleDate": "2026-03-13T00:25:57.472Z",
                        "outcome": 1,
                        "contractsVersion": "6.0",
                        "settleTxHash": "0x612d33b89f6f84dfb1dfd034168e0b4620a999e8b3eb404e37206387c408a2f1",
                        "fillOrderHash": "0x48ecd08c526796f1d56249d33dbac46aaf9e8e8b45e023e8e291c9f4ad21d6ee",
                        "fillOrderHashAttempts": [
                          "0x48ecd08c526796f1d56249d33dbac46aaf9e8e8b45e023e8e291c9f4ad21d6ee"
                        ],
                        "lastMineAttemptTime": "2026-03-12T23:18:50.703Z",
                        "beneficiaryType": 0,
                        "targetNonce": 25152,
                        "createdAt": "2026-03-12T23:18:47.931Z",
                        "updatedAt": "2026-03-13T00:25:57.472Z",
                        "chainVersion": "SXR",
                        "sportXeventId": "L18268159",
                        "netReturn": "8.417292",
                        "settleNetReturnValue": "0",
                        "marketHasRefunds": false,
                        "_id": "69b349d7437e6866874f937d",
                        "betTime": 1773357527,
                        "isQuarterLineLeg": false
                      }
                    ],
                    "nextKey": "69b349d7437e6866874f937d",
                    "pageSize": 100
                  }
                }
              }
            }
          }
        }
      }
    },
    "/trades/orders": {
      "get": {
        "operationId": "getTradeOrders",
        "tags": [
          "Trades"
        ],
        "summary": "Get active trade orders",
        "description": "This endpoint retrieves trades on the exchange for the given orderHashes.",
        "parameters": [
          {
            "name": "orderHashes",
            "in": "query",
            "required": true,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "The unique identifiers of the orders being searched"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "trades": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Trade"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "trades": [
                      {
                        "baseToken": "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B",
                        "bettor": "0x713117eCdEfB29B919544C7502162423220fE78b",
                        "stake": "5471240",
                        "normalizedStake": "5",
                        "odds": "65000000000000000000",
                        "orderHash": "0xa39a03729714170256eb0ea3c3c14b2985f7320d6fa75663edbca8c6d6e4dc83",
                        "marketHash": "0x80f558d8535e4f1343e3dc0303ab6d32432c732607fc460fe910ef95845ba40d",
                        "maker": false,
                        "bettingOutcomeOne": false,
                        "settled": true,
                        "betTimeValue": 5.47124,
                        "settleValue": 1,
                        "fillHash": "0x8e55b9a69f8b2ff4b9816f59c772da765227df104833daad946cfe36d2873938",
                        "tradeStatus": "SUCCESS",
                        "affiliate": "0x0000000000000000000000000000000000000000",
                        "valid": true,
                        "betType": 1,
                        "providerEventId": "18268159",
                        "settleDate": "2026-03-13T00:25:57.472Z",
                        "outcome": 1,
                        "contractsVersion": "6.0",
                        "settleTxHash": "0x612d33b89f6f84dfb1dfd034168e0b4620a999e8b3eb404e37206387c408a2f1",
                        "fillOrderHash": "0x48ecd08c526796f1d56249d33dbac46aaf9e8e8b45e023e8e291c9f4ad21d6ee",
                        "fillOrderHashAttempts": [
                          "0x48ecd08c526796f1d56249d33dbac46aaf9e8e8b45e023e8e291c9f4ad21d6ee"
                        ],
                        "lastMineAttemptTime": "2026-03-12T23:18:50.703Z",
                        "beneficiaryType": 0,
                        "targetNonce": 25152,
                        "chainVersion": "SXR",
                        "sportXeventId": "L18268159",
                        "netReturn": "8.417292",
                        "settleNetReturnValue": "0",
                        "marketHasRefunds": false,
                        "id": "69b349d7437e6866874f937d",
                        "betTime": "2026-03-12T23:18:47.511Z"
                      },
                      {
                        "baseToken": "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B",
                        "bettor": "0xC5f7aB49Db8B7e5ce6F82cD684124E925ae8B3B7",
                        "stake": "2946050",
                        "normalizedStake": "2",
                        "odds": "35000000000000000000",
                        "orderHash": "0xa39a03729714170256eb0ea3c3c14b2985f7320d6fa75663edbca8c6d6e4dc83",
                        "marketHash": "0x80f558d8535e4f1343e3dc0303ab6d32432c732607fc460fe910ef95845ba40d",
                        "maker": true,
                        "bettingOutcomeOne": true,
                        "settled": true,
                        "betTimeValue": 2.94605,
                        "settleValue": 1,
                        "fillHash": "0x8e55b9a69f8b2ff4b9816f59c772da765227df104833daad946cfe36d2873938",
                        "tradeStatus": "SUCCESS",
                        "affiliate": "0x0000000000000000000000000000000000000000",
                        "valid": true,
                        "betType": 0,
                        "providerEventId": "18268159",
                        "settleDate": "2026-03-13T00:25:57.472Z",
                        "outcome": 1,
                        "contractsVersion": "6.0",
                        "settleTxHash": "0x612d33b89f6f84dfb1dfd034168e0b4620a999e8b3eb404e37206387c408a2f1",
                        "fillOrderHash": "0x48ecd08c526796f1d56249d33dbac46aaf9e8e8b45e023e8e291c9f4ad21d6ee",
                        "fillOrderHashAttempts": [
                          "0x48ecd08c526796f1d56249d33dbac46aaf9e8e8b45e023e8e291c9f4ad21d6ee"
                        ],
                        "lastMineAttemptTime": "2026-03-12T23:18:50.703Z",
                        "targetNonce": 25152,
                        "chainVersion": "SXR",
                        "sportXeventId": "L18268159",
                        "netReturn": "8.417286",
                        "settleNetReturnValue": "8.417286",
                        "marketHasRefunds": true,
                        "id": "69b349d7437e6866874f937c",
                        "betTime": "2026-03-12T23:18:47.511Z"
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/trades/consolidated": {
      "get": {
        "operationId": "getConsolidatedTrades",
        "tags": [
          "Trades"
        ],
        "summary": "Get consolidated trades",
        "description": "This endpoint retrieves past consolidated trades on the exchange via pagination. If a trade fills multiple orders, it will show up as one entry here per bettor. Requests must include at least one of `bettor` or `marketHash`; requests with neither are rejected with a `400` error.",
        "parameters": [
          {
            "name": "bettor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only get trades placed by this bettor. Requests must include at least one of `bettor` or `marketHash`."
          },
          {
            "name": "settled",
            "in": "query",
            "required": true,
            "schema": {
              "type": "boolean"
            },
            "description": "If `true` only get settled trades"
          },
          {
            "name": "page",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Page number for pagination"
          },
          {
            "name": "perPage",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Amount of records to fetch per page"
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "totalStake",
                "totalBetTimeValue",
                "weightedAverageOdds",
                "netReturn",
                "netReturnBetTimeValue",
                "settleNetReturnValue",
                "outcome",
                "gameLabel",
                "bettingOutcome",
                "gameTime",
                "leagueLabel",
                "bettingOutcomeLabel",
                "betTime",
                "settleDate",
                "totalReturn"
              ]
            },
            "description": "Which field to sort by"
          },
          {
            "name": "sortAsc",
            "in": "query",
            "required": true,
            "schema": {
              "type": "boolean"
            },
            "description": "If `true`, sorts in ascending order"
          },
          {
            "name": "maker",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "If `true`, only gets trades where the bettor was a market maker"
          },
          {
            "name": "sportXeventId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only gets trades for this event ID"
          },
          {
            "name": "tradeStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter trades to see only those with `SUCCESS` or `FAILED` status"
          },
          {
            "name": "marketHash",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only get trades for this market hash. Requests must include at least one of `bettor` or `marketHash`."
          },
          {
            "name": "hideQuarterLineParents",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "If `true`, omits the synthetic parent consolidated trades of quarter-line bets, leaving only the underlying leg entries."
          },
          {
            "name": "hideQuarterLineLegs",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "If `true`, omits the leg consolidated trades of quarter-line bets, leaving only the parent entries. Recommended for user-facing P&L views."
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "trades": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ConsolidatedTrade"
                          },
                          "description": "The consolidated trades for this request"
                        },
                        "count": {
                          "type": "number",
                          "description": "Total count of trades for this query"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "trades": [
                      {
                        "baseToken": "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B",
                        "tradeStatus": "SUCCESS",
                        "bettor": "0x97EC1C9682F70091efB04e97b0B34698cF815EE1",
                        "totalStake": "34.32",
                        "totalBetTimeValue": "34.32",
                        "weightedAverageOdds": "56125000449719554886",
                        "netReturn": "61.14922",
                        "netReturnBetTimeValue": 61.14922,
                        "marketHash": "0xd9f2178b498227143d86b7d62cf82a7b8c56c5df3586d279949a3ea5e3eb1f6b",
                        "maker": false,
                        "settled": false,
                        "fillHash": "0x108723368a33e52789dc96f21f4542fb29e72903b6d130d78e5ff041c770d296",
                        "gameLabel": "Liverpool vs Galatasaray SK",
                        "bettingOutcome": 2,
                        "sportXeventId": "L18240954",
                        "gameTime": "2026-03-18T20:00:00.000Z",
                        "leagueLabel": "Champions League_UEFA",
                        "sportId": 5,
                        "bettingOutcomeLabel": "Galatasaray SK +2",
                        "betTime": 1773240290,
                        "fillOrderHash": "0xc45631446e945a59b7282ca13b4604933692796ac254c3045985cfb425f70e86",
                        "totalReturn": "61.14922",
                        "crosschainNetReturn": "0",
                        "chainVersion": "SXR",
                        "marketHasRefunds": false,
                        "marketType": 3
                      }
                    ],
                    "count": 4161
                  }
                }
              }
            }
          }
        }
      }
    },
    "/trades/portfolio/refunds": {
      "get": {
        "operationId": "getPortfolioRefunds",
        "tags": [
          "Trades"
        ],
        "summary": "Get portfolio refunds",
        "description": "This endpoint retrieves capital-efficient refund events for a bettor, aggregated by market.",
        "parameters": [
          {
            "name": "bettor",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Bettor address (checksummed)."
          },
          {
            "name": "marketHash",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by market hash."
          },
          {
            "name": "baseToken",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by base token."
          },
          {
            "name": "fillOrderHash",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by the associated trade fill hash."
          },
          {
            "name": "maker",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "If `true`, only refunds where bettor was a maker; otherwise taker refunds."
          },
          {
            "name": "sortAsc",
            "in": "query",
            "required": true,
            "schema": {
              "type": "boolean"
            },
            "description": "Sort ascending when `true`, descending when `false`."
          },
          {
            "name": "page",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Page number for pagination (min 0)."
          },
          {
            "name": "perPage",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Page size (max 500)."
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "results": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Refund"
                          }
                        },
                        "count": {
                          "type": "number",
                          "description": "Total count of aggregated market results"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "results": [
                      {
                        "marketHash": "0x7d9e27978f12b65e36990df94dbfa85c9f63dacaab24225e38e2f04d1ec66e8e",
                        "baseToken": "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B",
                        "totalRefundedBetTimeValue": 65.54772,
                        "events": [
                          {
                            "marketHash": "0x7d9e27978f12b65e36990df94dbfa85c9f63dacaab24225e38e2f04d1ec66e8e",
                            "baseToken": "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B",
                            "bettor": "0x8268feC8dCb0D284343054BDf2b649286c9aA0a1",
                            "maker": true,
                            "fillOrderHash": "0x40b8c59cce8323952da3fb42b4e22a097a4922ae402bc46f958c441fd0f0902a",
                            "amount": "61.960285",
                            "amountBetTimeValue": "61.960285",
                            "createdAt": "2026-01-05T18:20:24.920Z"
                          },
                          {
                            "marketHash": "0x7d9e27978f12b65e36990df94dbfa85c9f63dacaab24225e38e2f04d1ec66e8e",
                            "baseToken": "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B",
                            "bettor": "0x8268feC8dCb0D284343054BDf2b649286c9aA0a1",
                            "maker": true,
                            "fillOrderHash": "0xa56e17872d28b3021dc050006fcf10b469291e11472ff468196732169bc8371e",
                            "amount": "3.587435",
                            "amountBetTimeValue": "3.587435",
                            "createdAt": "2026-01-05T18:29:08.486Z"
                          }
                        ]
                      }
                    ],
                    "count": 7324
                  }
                }
              }
            }
          }
        }
      }
    },
    "/orders": {
      "get": {
        "operationId": "getOrders",
        "tags": [
          "Orders"
        ],
        "summary": "Get orders",
        "description": "This endpoint returns active orders on the exchange based on a few parameters",
        "parameters": [
          {
            "name": "marketHashes",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Only get orders for these market hashes. Comma separated."
          },
          {
            "name": "baseToken",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only get orders denominated in this base token"
          },
          {
            "name": "maker",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only get orders for this market maker"
          },
          {
            "name": "sportXeventId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only get orders for this event ID"
          },
          {
            "name": "orderHashes",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Only get orders for these order hashes. Comma separated."
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Which page to query for paginated queries, min 0"
          },
          {
            "name": "perPage",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "How many per page for paginated queries, max 1000"
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "fill_amount",
                "total_bet_size",
                "percentage_odds",
                "api_expiry",
                "created_at",
                "updated_at"
              ],
              "default": "created_at"
            },
            "description": "Which field to sort by"
          },
          {
            "name": "sortAsc",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Sort direction, default: true"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Order"
                      }
                    },
                    "page": {
                      "type": "integer",
                      "description": "The current page number"
                    },
                    "perPage": {
                      "type": "integer",
                      "description": "The number of records per page"
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": [
                    {
                      "marketHash": "0x09a68f49e98028f58b3620e8e57f203c0f314278f8e1fa3935d7e139cfbaef7a",
                      "fillAmount": "0",
                      "pendingFillAmount": "0",
                      "orderHash": "0x55eb16b32b5999e7bb67f995d5168b2569bbf6eeb7049a28687b41ea900d6529",
                      "maker": "0x740d5718a79A8559fEeE8B00922F8Cd773A81D84",
                      "totalBetSize": "542187500",
                      "percentageOdds": "86750000000000000000",
                      "baseToken": "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B",
                      "executor": "0x52adf738AAD93c31f798a30b2C74D658e1E9a562",
                      "salt": "0x5762782b288e9be9899c7664e9695247d180828783c8254bb53f56cb765eb2b3",
                      "isMakerBettingOutcomeOne": false,
                      "signature": "0xd0de402bddd95bb2dba21ef721143461dab5fa26461aa3cf6d31335cd7848af153c2fa604bfeab796e4859f4678919d2c76c53eed49bfbc5c337fd6982aaa78c1b",
                      "expiry": 2209006800,
                      "apiExpiry": 1773511660,
                      "sportXeventId": "L18272453",
                      "orderStatus": "ACTIVE"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Error Codes:\n\n`RATE_LIMIT_ORDER_REQUEST_MARKET_COUNT` \u2014 More than 1000 `marketHashes` queried\n\n`BOTH_SPORTXEVENTID_MARKETHASHES_PRESENT` \u2014 Can only send one of `marketHashes` or `sportXeventId`\n\n`BASE_TOKEN_MISMATCH` \u2014 The provided `baseToken` does not match the orders\n\n`RATE_LIMIT_ORDER_REQUEST_ORDER_COUNT` \u2014 Too many `orderHashes` queried",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "errorCode": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/orders/odds/best": {
      "get": {
        "operationId": "getBestOdds",
        "tags": [
          "Orders"
        ],
        "summary": "Get best odds",
        "description": "This endpoint returns the best available odds for the specified baseToken and marketHashes or leagueIds.",
        "parameters": [
          {
            "name": "marketHashes",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Only get best odds for these market hashes. Comma separated. Exactly one of `marketHashes` or `leagueIds` must be provided, but not both."
          },
          {
            "name": "leagueIds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "description": "Only get best odds for these league IDs. Comma separated. Exactly one of `marketHashes` or `leagueIds` must be provided, but not both."
          },
          {
            "name": "baseToken",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Only get best odds denominated in this base token."
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "bestOdds": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "marketHash": {
                                "type": "string",
                                "description": "The resulting market for the given best odds query"
                              },
                              "baseToken": {
                                "type": "string",
                                "description": "The baseToken for the given best odds query"
                              },
                              "outcomeOne": {
                                "type": "object",
                                "description": "An object representing outcome one, including the best available percentage odds as `percentageOdds` (string) and the last update time as `updatedAt` (numerical timestamp in milliseconds)",
                                "properties": {
                                  "percentageOdds": {
                                    "type": "string"
                                  },
                                  "updatedAt": {
                                    "type": "number"
                                  }
                                }
                              },
                              "outcomeTwo": {
                                "type": "object",
                                "description": "An object representing outcome two, including the best available percentage odds as `percentageOdds` (string) and the last update time as `updatedAt` (numerical timestamp in milliseconds)",
                                "properties": {
                                  "percentageOdds": {
                                    "type": "string"
                                  },
                                  "updatedAt": {
                                    "type": "number"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "bestOdds": [
                      {
                        "marketHash": "0xbe621aead370a0c8c48fcfcff6fa60c49126683f4ba30945fbb94fcf8fb3fe9e",
                        "baseToken": "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B",
                        "outcomeOne": {
                          "percentageOdds": "65750000000000000000",
                          "updatedAt": 1773008449368
                        },
                        "outcomeTwo": {
                          "percentageOdds": "33000000000000000000",
                          "updatedAt": 1773007355305
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/orders/new": {
      "post": {
        "operationId": "postNewOrder",
        "tags": [
          "Orders"
        ],
        "summary": "Post a new order",
        "description": "This endpoint offers new orders on the exchange (market making). Offering orders does not cost any fee.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "orders"
                ],
                "properties": {
                  "orders": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/SignedNewOrder"
                    },
                    "description": "Array of signed orders to post"
                  }
                }
              },
              "example": {
                "orders": [
                  {
                    "marketHash": "0x...",
                    "maker": "0xYourWalletAddress",
                    "baseToken": "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B",
                    "totalBetSize": "10000000",
                    "percentageOdds": "52500000000000000000",
                    "expiry": 2209006800,
                    "apiExpiry": 1735689600,
                    "executor": "0x52adf738AAD93c31f798a30b2C74D658e1E9a562",
                    "salt": "0x...",
                    "isMakerBettingOutcomeOne": true,
                    "signature": "0x..."
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Error Codes:\n\n`TOO_MANY_DIFFERENT_MARKETS` \u2014 More than 3 different markets queried\n\n`ORDERS_MUST_HAVE_IDENTICAL_MARKET` \u2014 All orders must be for the same network, either `SXN` or `SXR`\n\n`BAD_BASE_TOKEN` \u2014 All orders must be for the same base token, either `USDC` or `WSX`\n\n`ACCOUNT_SUSPENDED` \u2014 Your account has been suspended\n\n`INSUFFICIENT_KYC` \u2014 user has not registered on sx.bet",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "errorCode": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "orders": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "The order hashes corresponding to the new orders"
                        },
                        "statuses": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          },
                          "description": "Map of order hash to status string for each submitted order"
                        },
                        "inserted": {
                          "type": "number",
                          "description": "The number of new orders successfully inserted"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "orders": [
                      "0x7a9d420551c4a635849013dd908f7894766e97aee25fe656d0c5ac857e166fac"
                    ],
                    "statuses": {
                      "0x7a9d420551c4a635849013dd908f7894766e97aee25fe656d0c5ac857e166fac": "OK"
                    },
                    "inserted": 1
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "javascript",
            "label": "Sign & Post Order",
            "source": "import { Wallet, solidityPackedKeccak256, getBytes, randomBytes, hexlify } from \"ethers\";\n\nconst order = {\n  marketHash:\n    \"0x0eeace4a9bbf6235bc59695258a419ed3a05a2c8e3b6a58fb71a0d9e6b031c2b\",\n  maker: \"0x6F75bA6c90E3da79b7ACAfc0fb9cf3968aa4ee39\",\n  totalBetSize: \"10000000\",\n  percentageOdds: \"52500000000000000000\",\n  baseToken: \"0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B\", // Mainnet \u2014 see References for testnet address\n  apiExpiry: 1631233201,\n  expiry: 2209006800,\n  executor: \"0x52adf738AAD93c31f798a30b2C74D658e1E9a562\", // Mainnet \u2014 use GET /metadata \u2192 executorAddress for testnet\n  isMakerBettingOutcomeOne: true,\n  salt: BigInt(hexlify(randomBytes(32))).toString(),\n};\n\nconst orderHash = getBytes(\n  solidityPackedKeccak256(\n    [\n      \"bytes32\",\n      \"address\",\n      \"uint256\",\n      \"uint256\",\n      \"uint256\",\n      \"uint256\",\n      \"address\",\n      \"address\",\n      \"bool\",\n    ],\n    [\n      order.marketHash,\n      order.baseToken,\n      order.totalBetSize,\n      order.percentageOdds,\n      order.expiry,\n      order.salt,\n      order.maker,\n      order.executor,\n      order.isMakerBettingOutcomeOne,\n    ]\n  )\n);\n\n// Example with an ethers.js wallet using a private key\nconst wallet = new Wallet(process.env.SX_PRIVATE_KEY);\nconst signature = await wallet.signMessage(orderHash);\n\n// Example with an injected web3 provider such as MetaMask\n// const provider = new BrowserProvider(window.ethereum);\n// const signer = await provider.getSigner();\n// const signature = await signer.signMessage(orderHash);\n\nconst signedOrder = { ...order, signature };\n\nconst result = await fetch(\"https://api.sx.bet/orders/new\", { // Mainnet \u2014 use https://api.toronto.sx.bet for testnet\n  method: \"POST\",\n  body: JSON.stringify({ orders: [signedOrder] }),\n  headers: { \"Content-Type\": \"application/json\" },\n});"
          }
        ]
      }
    },
    "/orders/cancel/v2": {
      "post": {
        "operationId": "cancelOrders",
        "tags": [
          "Orders"
        ],
        "summary": "Cancel orders",
        "description": "This endpoint cancels existing orders on the exchange that you placed as a market maker. Order hashes from the request that were not cancelled are returned in `data.notCancelled` with a `reason`; the remaining orders are cancelled normally.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "orderHashes",
                  "signature",
                  "salt",
                  "maker",
                  "timestamp"
                ],
                "properties": {
                  "orderHashes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "The order hashes to cancel"
                  },
                  "signature": {
                    "type": "string",
                    "description": "Your wallet signature over the cancel payload. See the Order Signing reference for details on how to compute this."
                  },
                  "salt": {
                    "type": "string",
                    "description": "A random 32 bytes hex string to protect against replay"
                  },
                  "maker": {
                    "type": "string",
                    "description": "The account from which you are cancelling orders"
                  },
                  "timestamp": {
                    "type": "integer",
                    "description": "The current timestamp in UNIX seconds to protect against replay"
                  }
                }
              },
              "example": {
                "orderHashes": [
                  "0x550128e997978495eeae503c13e2e30243d747e969c65e1a0b565c609e097506"
                ],
                "signature": "0x...",
                "salt": "0x...",
                "maker": "0xYourWalletAddress",
                "timestamp": 1704067200
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Error Codes:\n\n`CANCEL_REQUEST_ALREADY_PROCESSED` \u2014 This cancellation is already processed\n\n`SIGNATURE_MISMATCH` \u2014 The provided signature does not match the cancel payload",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "errorCode": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "cancelledCount": {
                          "type": "number",
                          "description": "How many orders were cancelled, of the orders passed"
                        },
                        "orders": {
                          "type": "array",
                          "description": "An array of Cancelled Order objects. Omitted if cancel count is 0.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "orderHash": {
                                "type": "string",
                                "description": "Cancelled order hash"
                              },
                              "pendingFills": {
                                "type": "array",
                                "description": "The pending fills awaiting confirmation on chain. Expected to succeed and fill order.",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "fillHash": {
                                      "type": "string",
                                      "description": "The fill hash which is pending"
                                    },
                                    "pendingFillAmount": {
                                      "type": "string",
                                      "description": "The amount of the order that this fill is attempting to fill"
                                    }
                                  }
                                }
                              }
                            }
                          }
                        },
                        "notCancelled": {
                          "type": "array",
                          "description": "Orders from the request that were not cancelled.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "orderHash": {
                                "type": "string",
                                "description": "Order hash that was not cancelled."
                              },
                              "reason": {
                                "type": "string",
                                "description": "Why the order was not cancelled.\n\n`not_found_or_inactive` — order was not found or is no longer active.\n\n`already_pending_cancel` — order already has a pending cancellation.\n\n`order_locked` — order is temporarily locked, likely because another fill/cancel flow is processing it.\n\n`update_failed` — order could not be cancelled due to an internal processing issue.",
                                "enum": [
                                  "not_found_or_inactive",
                                  "already_pending_cancel",
                                  "order_locked",
                                  "update_failed"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "cancelledCount": 1,
                    "orders": [
                      {
                        "orderHash": "0xc4fad4181eac3d72a7d4166df05534edd5479ec7053076244986ec68336ef45",
                        "pendingFills": [
                          {
                            "fillHash": "0xf691c9dfb100d12550c3cb4dad944f15d711eaf22108c6dacc5077a274b3582l",
                            "pendingFillAmount": "1806995918"
                          }
                        ]
                      }
                    ],
                    "notCancelled": [
                      {
                        "orderHash": "0x9b1a4f5e7c0d3b2a6e8f1c4d5e7a9b0c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a",
                        "reason": "not_found_or_inactive"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "javascript",
            "label": "Sign & Cancel Orders",
            "source": "import { Wallet, hexlify, randomBytes } from \"ethers\";\n\nconst wallet = new Wallet(process.env.SX_PRIVATE_KEY);\n\nconst orderHashes = [\n  \"0x550128e997978495eeae503c13e2e30243d747e969c65e1a0b565c609e097506\",\n];\nconst salt = hexlify(randomBytes(32));\nconst timestamp = Math.floor(Date.now() / 1000);\nconst chainId = 4162; // Mainnet \u2014 use 79479957 for testnet\n\nconst domain = {\n  name: \"CancelOrderV2SportX\",\n  version: \"1.0\",\n  chainId,\n  salt,\n};\n\nconst types = {\n  Details: [\n    { name: \"orderHashes\", type: \"string[]\" },\n    { name: \"timestamp\", type: \"uint256\" },\n  ],\n};\n\nconst signature = await wallet.signTypedData(domain, types, { orderHashes, timestamp });\n\nconst result = await fetch(\"https://api.sx.bet/orders/cancel/v2\", { // Mainnet \u2014 use https://api.toronto.sx.bet for testnet\n  method: \"POST\",\n  headers: { \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    orderHashes,\n    signature,\n    salt,\n    maker: wallet.address,\n    timestamp,\n  }),\n});\nconsole.log(await result.json());"
          },
          {
            "lang": "python",
            "label": "Sign & Cancel Orders",
            "source": "import os, secrets, requests\nfrom eth_account import Account\n\naccount = Account.from_key(os.environ[\"SX_PRIVATE_KEY\"])\n\norder_hashes = [\"0x550128e997978495eeae503c13e2e30243d747e969c65e1a0b565c609e097506\"]\nsalt = \"0x\" + secrets.token_bytes(32).hex()\ntimestamp = int(__import__(\"time\").time())\nchain_id = 4162  # Mainnet \u2014 use 79479957 for testnet\n\nsigned = Account.sign_typed_data(\n    account.key,\n    domain_data={\n        \"name\": \"CancelOrderV2SportX\",\n        \"version\": \"1.0\",\n        \"chainId\": chain_id,\n        \"salt\": salt,\n    },\n    message_types={\n        \"Details\": [\n            {\"name\": \"orderHashes\", \"type\": \"string[]\"},\n            {\"name\": \"timestamp\", \"type\": \"uint256\"},\n        ]\n    },\n    message_data={\"orderHashes\": order_hashes, \"timestamp\": timestamp},\n)\n\nresult = requests.post(\n    \"https://api.sx.bet/orders/cancel/v2\",  # Mainnet \u2014 use https://api.toronto.sx.bet for testnet\n    json={\n        \"orderHashes\": order_hashes,\n        \"signature\": \"0x\" + signed.signature.hex(),\n        \"salt\": salt,\n        \"maker\": account.address,\n        \"timestamp\": timestamp,\n    },\n)\nprint(result.json())"
          }
        ]
      }
    },
    "/orders/cancel/event": {
      "post": {
        "operationId": "cancelOrdersByEvent",
        "tags": [
          "Orders"
        ],
        "summary": "Cancel orders by event",
        "description": "This endpoint cancels existing orders on the exchange for a particular event that you placed as a market maker.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "sportXeventId",
                  "signature",
                  "salt",
                  "maker",
                  "timestamp"
                ],
                "properties": {
                  "sportXeventId": {
                    "type": "string",
                    "description": "The event for which orders should be cancelled"
                  },
                  "signature": {
                    "type": "string",
                    "description": "Your wallet signature over the cancel payload. See the Order Signing reference for details on how to compute this."
                  },
                  "salt": {
                    "type": "string",
                    "description": "A random 32 bytes hex string to protect against replay"
                  },
                  "maker": {
                    "type": "string",
                    "description": "The account from which you are cancelling orders"
                  },
                  "timestamp": {
                    "type": "integer",
                    "description": "The current timestamp in UNIX seconds to protect against replay"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Error Codes:\n\n`CANCEL_REQUEST_ALREADY_PROCESSED` \u2014 This cancellation is already processed\n\n`SIGNATURE_MISMATCH` \u2014 The provided signature does not match the cancel payload",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "errorCode": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "cancelledCount": {
                          "type": "number",
                          "description": "How many orders were cancelled"
                        },
                        "orders": {
                          "type": "array",
                          "description": "An array of Cancelled Order objects. Omitted if cancel count is 0.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "orderHash": {
                                "type": "string",
                                "description": "Cancelled order hash"
                              },
                              "pendingFills": {
                                "type": "array",
                                "description": "The pending fills awaiting confirmation on chain. Expected to succeed and fill order.",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "fillHash": {
                                      "type": "string",
                                      "description": "The fill hash which is pending"
                                    },
                                    "pendingFillAmount": {
                                      "type": "string",
                                      "description": "The amount of the order that this fill is attempting to fill"
                                    }
                                  }
                                }
                              }
                            }
                          }
                        },
                        "notCancelled": {
                          "type": "array",
                          "description": "Orders from the request that were not cancelled.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "orderHash": {
                                "type": "string",
                                "description": "Order hash that was not cancelled."
                              },
                              "reason": {
                                "type": "string",
                                "description": "Why the order was not cancelled.\n\n`not_found_or_inactive` — order was not found or is no longer active.\n\n`already_pending_cancel` — order already has a pending cancellation.\n\n`order_locked` — order is temporarily locked, likely because another fill/cancel flow is processing it.\n\n`update_failed` — order could not be cancelled due to an internal processing issue.",
                                "enum": [
                                  "not_found_or_inactive",
                                  "already_pending_cancel",
                                  "order_locked",
                                  "update_failed"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "cancelledCount": 1,
                    "orders": [
                      {
                        "orderHash": "0xc4fad4181eac3d72a7d4166df05534edd5479ec7053076244986ec68336ef45",
                        "pendingFills": [
                          {
                            "fillHash": "0xf691c9dfb100d12550c3cb4dad944f15d711eaf22108c6dacc5077a274b3582l",
                            "pendingFillAmount": "1806995918"
                          }
                        ]
                      }
                    ],
                    "notCancelled": [
                      {
                        "orderHash": "0x9b1a4f5e7c0d3b2a6e8f1c4d5e7a9b0c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a",
                        "reason": "already_pending_cancel"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "javascript",
            "label": "Sign & Cancel Event Orders",
            "source": "import { Wallet, hexlify, randomBytes } from \"ethers\";\n\nconst wallet = new Wallet(process.env.SX_PRIVATE_KEY);\n\nconst sportXeventId = \"L1233231\";\nconst salt = hexlify(randomBytes(32));\nconst timestamp = Math.floor(Date.now() / 1000);\nconst chainId = 4162; // Mainnet \u2014 use 79479957 for testnet\n\nconst domain = {\n  name: \"CancelOrderEventsSportX\",\n  version: \"1.0\",\n  chainId,\n  salt,\n};\n\nconst types = {\n  Details: [\n    { name: \"sportXeventId\", type: \"string\" },\n    { name: \"timestamp\", type: \"uint256\" },\n  ],\n};\n\nconst signature = await wallet.signTypedData(domain, types, { sportXeventId, timestamp });\n\nconst apiPayload = {\n  signature,\n  sportXeventId,\n  salt,\n  maker: wallet.address,\n  timestamp,\n};\n\nconst result = await fetch(\"https://api.sx.bet/orders/cancel/event\", { // Mainnet \u2014 use https://api.toronto.sx.bet for testnet\n  method: \"POST\",\n  body: JSON.stringify(apiPayload),\n  headers: { \"Content-Type\": \"application/json\" },\n});"
          },
          {
            "lang": "python",
            "label": "Sign & Cancel Event Orders",
            "source": "import os, secrets, requests\nfrom eth_account import Account\n\naccount = Account.from_key(os.environ[\"SX_PRIVATE_KEY\"])\n\nsports_x_event_id = \"L1233231\"\nsalt = \"0x\" + secrets.token_bytes(32).hex()\ntimestamp = int(__import__(\"time\").time())\nchain_id = 4162  # Mainnet \u2014 use 79479957 for testnet\n\nsigned = Account.sign_typed_data(\n    account.key,\n    domain_data={\n        \"name\": \"CancelOrderEventsSportX\",\n        \"version\": \"1.0\",\n        \"chainId\": chain_id,\n        \"salt\": salt,\n    },\n    message_types={\n        \"Details\": [\n            {\"name\": \"sportXeventId\", \"type\": \"string\"},\n            {\"name\": \"timestamp\", \"type\": \"uint256\"},\n        ]\n    },\n    message_data={\"sportXeventId\": sports_x_event_id, \"timestamp\": timestamp},\n)\n\nresult = requests.post(\n    \"https://api.sx.bet/orders/cancel/event\",  # Mainnet \u2014 use https://api.toronto.sx.bet for testnet\n    json={\n        \"signature\": \"0x\" + signed.signature.hex(),\n        \"sportXeventId\": sports_x_event_id,\n        \"salt\": salt,\n        \"maker\": account.address,\n        \"timestamp\": timestamp,\n    },\n)\nprint(result.json())"
          }
        ]
      }
    },
    "/orders/cancel/all": {
      "post": {
        "operationId": "cancelAllOrders",
        "tags": [
          "Orders"
        ],
        "summary": "Cancel all orders",
        "description": "This endpoint cancels ALL existing orders on the exchange that you placed as a market maker.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "signature",
                  "salt",
                  "maker",
                  "timestamp"
                ],
                "properties": {
                  "signature": {
                    "type": "string",
                    "description": "Your wallet signature over the cancel payload. See the Order Signing reference for details on how to compute this."
                  },
                  "salt": {
                    "type": "string",
                    "description": "A random 32 bytes hex string to protect against replay"
                  },
                  "maker": {
                    "type": "string",
                    "description": "The account from which you are cancelling orders"
                  },
                  "timestamp": {
                    "type": "integer",
                    "description": "The current timestamp in UNIX seconds to protect against replay."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Error Codes:\n\n`CANCEL_REQUEST_ALREADY_PROCESSED` \u2014 This cancellation is already processed\n\n`SIGNATURE_MISMATCH` \u2014 The provided signature does not match the cancel payload",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "errorCode": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "cancelledCount": {
                          "type": "number",
                          "description": "How many orders were cancelled"
                        },
                        "orders": {
                          "type": "array",
                          "description": "An array of Cancelled Order objects. Omitted if cancel count is 0.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "orderHash": {
                                "type": "string",
                                "description": "Cancelled order hash"
                              },
                              "pendingFills": {
                                "type": "array",
                                "description": "The pending fills awaiting confirmation on chain. Expected to succeed and fill order.",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "fillHash": {
                                      "type": "string",
                                      "description": "The fill hash which is pending"
                                    },
                                    "pendingFillAmount": {
                                      "type": "string",
                                      "description": "The amount of the order that this fill is attempting to fill"
                                    }
                                  }
                                }
                              }
                            }
                          }
                        },
                        "notCancelled": {
                          "type": "array",
                          "description": "Orders from the request that were not cancelled.",
                          "items": {
                            "type": "object",
                            "properties": {
                              "orderHash": {
                                "type": "string",
                                "description": "Order hash that was not cancelled."
                              },
                              "reason": {
                                "type": "string",
                                "description": "Why the order was not cancelled.\n\n`not_found_or_inactive` — order was not found or is no longer active.\n\n`already_pending_cancel` — order already has a pending cancellation.\n\n`order_locked` — order is temporarily locked, likely because another fill/cancel flow is processing it.\n\n`update_failed` — order could not be cancelled due to an internal processing issue.",
                                "enum": [
                                  "not_found_or_inactive",
                                  "already_pending_cancel",
                                  "order_locked",
                                  "update_failed"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "cancelledCount": 1,
                    "orders": [
                      {
                        "orderHash": "0xc4fad4181eac3d72a7d4166df05534edd5479ec7053076244986ec68336ef45",
                        "pendingFills": [
                          {
                            "fillHash": "0xf691c9dfb100d12550c3cb4dad944f15d711eaf22108c6dacc5077a274b3582l",
                            "pendingFillAmount": "1806995918"
                          }
                        ]
                      }
                    ],
                    "notCancelled": [
                      {
                        "orderHash": "0x9b1a4f5e7c0d3b2a6e8f1c4d5e7a9b0c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a",
                        "reason": "order_locked"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "javascript",
            "label": "Sign & Cancel All Orders",
            "source": "import { Wallet, hexlify, randomBytes } from \"ethers\";\n\nconst wallet = new Wallet(process.env.SX_PRIVATE_KEY);\n\nconst salt = hexlify(randomBytes(32));\nconst timestamp = Math.floor(Date.now() / 1000);\nconst chainId = 4162; // Mainnet \u2014 use 79479957 for testnet\n\nconst domain = {\n  name: \"CancelAllOrdersSportX\",\n  version: \"1.0\",\n  chainId,\n  salt,\n};\n\nconst types = {\n  Details: [{ name: \"timestamp\", type: \"uint256\" }],\n};\n\nconst signature = await wallet.signTypedData(domain, types, { timestamp });\n\nconst apiPayload = {\n  signature,\n  salt,\n  maker: wallet.address,\n  timestamp,\n};\n\nconst result = await fetch(\"https://api.sx.bet/orders/cancel/all\", { // Mainnet \u2014 use https://api.toronto.sx.bet for testnet\n  method: \"POST\",\n  body: JSON.stringify(apiPayload),\n  headers: { \"Content-Type\": \"application/json\" },\n});"
          },
          {
            "lang": "python",
            "label": "Sign & Cancel All Orders",
            "source": "import os, secrets, requests\nfrom eth_account import Account\n\naccount = Account.from_key(os.environ[\"SX_PRIVATE_KEY\"])\n\nsalt = \"0x\" + secrets.token_bytes(32).hex()\ntimestamp = int(__import__(\"time\").time())\nchain_id = 4162  # Mainnet \u2014 use 79479957 for testnet\n\nsigned = Account.sign_typed_data(\n    account.key,\n    domain_data={\n        \"name\": \"CancelAllOrdersSportX\",\n        \"version\": \"1.0\",\n        \"chainId\": chain_id,\n        \"salt\": salt,\n    },\n    message_types={\n        \"Details\": [{\"name\": \"timestamp\", \"type\": \"uint256\"}]\n    },\n    message_data={\"timestamp\": timestamp},\n)\n\nresult = requests.post(\n    \"https://api.sx.bet/orders/cancel/all\",  # Mainnet \u2014 use https://api.toronto.sx.bet for testnet\n    json={\n        \"signature\": \"0x\" + signed.signature.hex(),\n        \"salt\": salt,\n        \"maker\": account.address,\n        \"timestamp\": timestamp,\n    },\n)\nprint(result.json())"
          }
        ]
      }
    },
    "/orders/approve": {
      "post": {
        "operationId": "approveBetting",
        "tags": [
          "Orders"
        ],
        "summary": "Approve betting (EIP-2612 Permit)",
        "description": "",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "owner",
                  "spender",
                  "tokenAddress",
                  "value",
                  "deadline",
                  "signature"
                ],
                "properties": {
                  "owner": {
                    "type": "string",
                    "description": "Address of the taker granting approval to TokenTransferProxy for filling orders on their behalf"
                  },
                  "spender": {
                    "type": "string",
                    "description": "The address of the account which will be able to spend token amounts on behalf of the owner. In this case, the spender should be TokenTransferProxy address"
                  },
                  "tokenAddress": {
                    "type": "string",
                    "description": "The token address to grant approval for"
                  },
                  "value": {
                    "type": "string",
                    "description": "The token amount to grant approval for, in Ethereum units"
                  },
                  "deadline": {
                    "type": "integer",
                    "description": "The deadline as a UNIX timestamp format used in signature verification"
                  },
                  "signature": {
                    "type": "string",
                    "description": "Your wallet signature over the payload. See the example of how to compute this."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "hash": {
                          "type": "string",
                          "nullable": true,
                          "description": "The transaction hash of the approval, or `null` if the allowance was already set"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "hash": "0x840763ae29b7a6adfa0e315afa47be30cdebd5b793d179dc07dc8fc4f0034965"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "javascript",
            "label": "EIP-2612 Permit",
            "source": "import { Contract, JsonRpcProvider, MaxUint256, Wallet } from \"ethers\";\n\nasync function approveOrderFill() {\n  const privateKey = process.env.SX_PRIVATE_KEY;\n  const tokenAddress = process.env.TOKEN_ADDRESS;\n\n  // get the following from https://api.sx.bet/metadata\n  const tokenTransferProxyAddress = process.env.TOKEN_TRANSFER_PROXY_ADDRESS;\n  const chainId = Number(process.env.CHAIN_ID); // Mainnet \u2014 use 79479957 for testnet\n\n  const wallet = new Wallet(\n    privateKey,\n    new JsonRpcProvider(process.env.RPC_URL) // find this under the 'references' section\n  );\n\n  const tokenContract = new Contract(\n    tokenAddress,\n    [\n      {\n        inputs: [\n          { internalType: \"address\", name: \"usr\", type: \"address\" },\n          { internalType: \"uint256\", name: \"wad\", type: \"uint256\" },\n        ],\n        name: \"approve\",\n        outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n        stateMutability: \"nonpayable\",\n        type: \"function\",\n      },\n      {\n        inputs: [{ internalType: \"address\", name: \"owner\", type: \"address\" }],\n        name: \"nonces\",\n        outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n        stateMutability: \"view\",\n        type: \"function\",\n      },\n      {\n        inputs: [],\n        name: \"name\",\n        outputs: [{ internalType: \"string\", name: \"\", type: \"string\" }],\n        stateMutability: \"view\",\n        type: \"function\",\n      },\n    ],\n    wallet\n  );\n\n  const nonce = await tokenContract.nonces(wallet.address);\n  const tokenName = await tokenContract.name();\n\n  const domain = {\n    name: tokenName,\n    version: \"1\",\n    chainId,\n    verifyingContract: tokenAddress,\n  };\n\n  const types = {\n    Permit: [\n      { name: \"owner\", type: \"address\" },\n      { name: \"spender\", type: \"address\" },\n      { name: \"value\", type: \"uint256\" },\n      { name: \"nonce\", type: \"uint256\" },\n      { name: \"deadline\", type: \"uint256\" },\n    ],\n  };\n\n  const deadline = Math.floor(Date.now() / 1000) + 7200; // 2 hours\n\n  const value = {\n    owner: wallet.address,\n    spender: tokenTransferProxyAddress,\n    value: MaxUint256,\n    nonce,\n    deadline,\n  };\n\n  const approveProxySignature = await wallet.signTypedData(domain, types, value);\n\n  const apiPayload = {\n    owner: wallet.address,\n    spender: tokenTransferProxyAddress,\n    tokenAddress,\n    value: MaxUint256.toString(),\n    deadline,\n    signature: approveProxySignature,\n  };\n\n  const response = await fetch(\"https://api.sx.bet/orders/approve\", { // Mainnet \u2014 use https://api.toronto.sx.bet for testnet\n    method: \"POST\",\n    body: JSON.stringify(apiPayload),\n    headers: { \"Content-Type\": \"application/json\" },\n  });\n}"
          }
        ]
      }
    },
    "/orders/fill/v2": {
      "post": {
        "operationId": "fillOrder",
        "tags": [
          "Orders"
        ],
        "summary": "Fill an order",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "market",
                  "baseToken",
                  "isTakerBettingOutcomeOne",
                  "stakeWei",
                  "desiredOdds",
                  "oddsSlippage",
                  "fillSalt",
                  "taker",
                  "takerSig"
                ],
                "properties": {
                  "market": {
                    "type": "string",
                    "description": "The market hash of the market you are filling an order on"
                  },
                  "baseToken": {
                    "type": "string",
                    "description": "The address of the ERC-20 token representing the currency of the fill. Token addresses vary by network \u2014 see the `addresses` field in GET /metadata or the References page for the correct address."
                  },
                  "isTakerBettingOutcomeOne": {
                    "type": "boolean",
                    "description": "Whether or not taker is betting outcome 1 (team 1 wins), if false then taker is betting outcome 2 (team 2 wins)"
                  },
                  "stakeWei": {
                    "type": "string",
                    "description": "The stake amount for this bet in wei units - see Unit Conversion. Minimum 1 USDC."
                  },
                  "desiredOdds": {
                    "type": "string",
                    "description": "The worst taker odds acceptable for filling, used as an anchor when applying oddsSlippage - note that any order found with taker odds better than the desiredOdds can still fill if found at the time of order matching"
                  },
                  "oddsSlippage": {
                    "type": "integer",
                    "description": "An integer between 0-100 representing the percentage of tolerance that is acceptable based on desiredOdds"
                  },
                  "fillSalt": {
                    "type": "string",
                    "description": "Random 32 byte string to identify this fill. Must match the fillSalt used when computing the signing payload"
                  },
                  "taker": {
                    "type": "string",
                    "description": "Address of the taker taking the bet"
                  },
                  "takerSig": {
                    "type": "string",
                    "description": "Your wallet signature over the fill payload."
                  }
                }
              },
              "example": {
                "market": "N/A",
                "baseToken": "0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B",
                "isTakerBettingOutcomeOne": true,
                "stakeWei": "50000000",
                "desiredOdds": "83000000000000000000",
                "oddsSlippage": 5,
                "fillSalt": "0x...",
                "taker": "0xYourWalletAddress",
                "takerSig": "0x..."
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Error Codes:\n\n`INSUFFICIENT_KYC` \u2014 user has not registered on sx.bet\n\n`AFTER_ORDER_EXPIRY` \u2014 One of the orders have expired\n\n`BASE_TOKENS_NOT_SAME` \u2014 All orders must be for the same `baseToken`\n\n`MARKETS_NOT_SAME` \u2014 All orders must be for the same market\n\n`DIRECTIONS_NOT_SAME` \u2014 All orders must be betting on the same side `isMakerBettingOutcomeOne`\n\n`INVALID_ORDERS` \u2014 Order is now inactive\n\n`INVALID_ODDS` \u2014 Invalid desiredOdds, must be less than 10^20\n\n`INVALID_ODDS_SLIPPAGE` \u2014 Invalid oddsSlippage, must be an integer between 0-100\n\n`MATCH_STATE_INVALID` \u2014 The fixture for the order is in an invalid state and is not bettable anymore\n\n`TAKER_SIGNATURE_MISMATCH` \u2014 The taker signature generated for the request is invalid\n\n`PROXY_ACCOUNT_INVALID` \u2014 The proxy account is invalid (only applicable if proxyTaker was specified in request)\n\n`TAKER_AMOUNT_TOO_LOW` \u2014 The stakeWei specified is too low for the current token\n\n`META_TX_RATE_LIMIT_REACHED` \u2014 Cannot have more than 10 meta transactions at once\n\n`INSUFFICIENT_SPACE` \u2014 There is not enough space to fill the matched orders due to other pending fills\n\n`FILL_ALREADY_SUBMITTED` \u2014 The fill has already been submitted\n\n`ODDS_STALE` \u2014 No orders could be found for the desiredOdds and oddsSlippage, try again with greater oddsSlippage\n\n`FILL_TIMED_OUT` \u2014 The fill request timed out before completing\n\n`MARKET_DOESNT_EXIST` \u2014 The specified market does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "errorCode": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`success` or `failure` if the request succeeded or not"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "fillHash": {
                          "type": "string",
                          "description": "Hash of the submitted fill"
                        },
                        "isPartialFill": {
                          "type": "boolean",
                          "description": "Whether the fill was only partially filled"
                        },
                        "totalFilled": {
                          "type": "string",
                          "description": "Total amount filled in wei units"
                        },
                        "averageOdds": {
                          "type": "string",
                          "description": "Average odds of the fill in SX protocol format (implied * 10^20)"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "status": "success",
                  "data": {
                    "fillHash": "0x840763ae29b7a6adfa0e315afa47be30cdebd5b793d179dc07dc8fc4f0034965",
                    "isPartialFill": false,
                    "totalFilled": "50000000",
                    "averageOdds": "73000000000000000000"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "javascript",
            "label": "Sign & Fill Order",
            "source": "import { Wallet, ZeroAddress, ZeroHash, randomBytes, hexlify } from \"ethers\";\n\nasync function fillOrder() {\n  // get the following from https://api.sx.bet/metadata\n  const EIP712FillHasherAddress = process.env.EIP712_FILL_HASHER_ADDRESS;\n  const chainId = Number(process.env.CHAIN_ID); // Mainnet \u2014 use 79479957 for testnet\n  const domainVersion = process.env.DOMAIN_VERSION;\n\n  const wallet = new Wallet(process.env.SX_PRIVATE_KEY);\n  const takerAddress = wallet.address;\n  const stakeWei = \"50000000\"; // 50 USDC\n  const marketHash = \"0x0246b760b06009ece42d08e706563de1967e7f1b4799d0f559244e3f80bbc496\"; // Liverpool vs Arsenal\n  const baseToken = \"0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B\"; // Mainnet \u2014 see References for testnet address\n  const desiredOdds = \"83000000000000000000\"; // ~1.20 decimal odds\n  const oddsSlippage = 5; // 5% slippage, so worst decimal odds ~1.14\n  const isTakerBettingOutcomeOne = true; // taker is betting that team 1 wins\n  const fillSalt = BigInt(hexlify(randomBytes(32))).toString();\n\n  const domain = {\n    name: \"SX Bet\",\n    version: domainVersion,\n    chainId,\n    verifyingContract: EIP712FillHasherAddress,\n  };\n\n  const types = {\n    Details: [\n      { name: \"action\", type: \"string\" },\n      { name: \"market\", type: \"string\" },\n      { name: \"betting\", type: \"string\" },\n      { name: \"stake\", type: \"string\" },\n      { name: \"worstOdds\", type: \"string\" },\n      { name: \"worstReturning\", type: \"string\" },\n      { name: \"fills\", type: \"FillObject\" },\n    ],\n    FillObject: [\n      { name: \"stakeWei\", type: \"string\" },\n      { name: \"marketHash\", type: \"string\" },\n      { name: \"baseToken\", type: \"string\" },\n      { name: \"desiredOdds\", type: \"string\" },\n      { name: \"oddsSlippage\", type: \"uint256\" },\n      { name: \"isTakerBettingOutcomeOne\", type: \"bool\" },\n      { name: \"fillSalt\", type: \"uint256\" },\n      { name: \"beneficiary\", type: \"address\" },\n      { name: \"beneficiaryType\", type: \"uint8\" },\n      { name: \"cashOutTarget\", type: \"bytes32\" },\n    ],\n  };\n\n  const message = {\n    action: \"N/A\",\n    betting: \"N/A\",\n    stake: \"N/A\",\n    worstOdds: \"N/A\",\n    worstReturning: \"N/A\",\n    market: marketHash,\n    fills: {\n      stakeWei,\n      marketHash,\n      baseToken,\n      desiredOdds,\n      oddsSlippage,\n      isTakerBettingOutcomeOne,\n      fillSalt,\n      beneficiary: ZeroAddress,\n      beneficiaryType: 0,\n      cashOutTarget: ZeroHash,\n    },\n  };\n\n  const signature = await wallet.signTypedData(domain, types, message);\n\n  const apiPayload = {\n    market: marketHash,\n    baseToken,\n    isTakerBettingOutcomeOne,\n    stakeWei,\n    desiredOdds,\n    oddsSlippage,\n    taker: takerAddress,\n    takerSig: signature,\n    fillSalt,\n  };\n\n  const response = await fetch(`https://api.sx.bet/orders/fill/v2`, { // Mainnet \u2014 use https://api.toronto.sx.bet for testnet\n    method: \"POST\",\n    body: JSON.stringify(apiPayload),\n    headers: { \"Content-Type\": \"application/json\" },\n  });\n}"
          }
        ]
      }
    }
  }
}