{"openapi":"3.1.0","info":{"title":"Layer","version":"0","description":"The same prediction market across Kalshi, Polymarket, Polymarket US, Hyperliquid and Novig, and the trade between them after fees. Every endpoint needs a free key from https://uselayer.sh/dashboard, sent as authorization: Bearer lyr_…, except GET /v0/health; the endpoints with x-payment-info can also be called with no key and paid per call over x402 (https://uselayer.sh/docs/pay-per-call). 60 requests a minute per key.","contact":{"name":"Layer","email":"david@uselayer.sh","url":"https://uselayer.sh"}},"servers":[{"url":"https://uselayer.sh"}],"externalDocs":{"description":"API reference","url":"https://uselayer.sh/docs/api"},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"A Layer API key (lyr_…) from https://uselayer.sh/dashboard. x-api-key also works."}}},"paths":{"/v0/match":{"get":{"operationId":"getMatch","summary":"Find a prediction market's twin on another venue","description":"Find the same prediction market on another venue (Kalshi, Polymarket, Polymarket US, Hyperliquid, Novig): its twin, how confident the match is, and both venues' live prices.","tags":["match"],"parameters":[{"name":"venue","in":"query","required":true,"schema":{"type":"string","enum":["kalshi","polymarket","polymarket_us","hyperliquid","novig"]}},{"name":"market_id","in":"query","required":true,"schema":{"type":"string"},"description":"The market's id on that venue (Kalshi ticker, Polymarket conditionId or slug, ...)"},{"name":"with","in":"query","required":false,"schema":{"type":"string"},"description":"For a Kalshi market: which venue to find its twin on"},{"name":"prices","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}}],"security":[{"bearerAuth":[]},{}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"example":{"source_market":{"venue":"polymarket_us","market_id":"aec-nba-lal-bos-2026-11-08"},"matched_market":{"venue":"kalshi","market_id":"KXNBAGAME-26NOV08LALBOS-LAL"},"side":"same","tier":"human_verified","confidence":1,"prices":{"as_of":"2026-11-07T18:00:00Z","kalshi":{"yes":{"bid":{"price":0.41,"size":300},"ask":{"price":0.42,"size":120}}},"polymarket_us":{"yes":{"bid":{"price":0.43,"size":80},"ask":{"price":0.44,"size":200}}}},"checked_at":"2026-11-07T18:00:00Z"}}}},"400":{"description":"The request couldn't be read; detail says why. Not charged."},"401":{"description":"unauthorized: the key is unknown or revoked."},"402":{"description":"Payment required: the x402 PAYMENT-REQUIRED header carries the price."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.02"},"protocols":[{"x402":{}}]}},"post":{"operationId":"postMatch","summary":"Find twins for up to 50 markets","description":"The same cross-venue lookup for up to 50 prediction markets in one call.","tags":["match"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"markets":{"type":"array","maxItems":50,"items":{"type":"object","properties":{"venue":{"type":"string"},"market_id":{"type":"string"},"with":{"type":"string"}},"required":["venue","market_id"]}}},"required":["markets"]},"example":{"markets":[{"venue":"kalshi","market_id":"KXNBAGAME-26NOV08LALBOS-LAL"}]}}}},"security":[{"bearerAuth":[]},{}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"example":{"results":[{"source_market":{"venue":"polymarket_us","market_id":"aec-nba-lal-bos-2026-11-08"},"matched_market":{"venue":"kalshi","market_id":"KXNBAGAME-26NOV08LALBOS-LAL"},"side":"same","tier":"human_verified","confidence":1,"prices":{"as_of":"2026-11-07T18:00:00Z","kalshi":{"yes":{"bid":{"price":0.41,"size":300},"ask":{"price":0.42,"size":120}}},"polymarket_us":{"yes":{"bid":{"price":0.43,"size":80},"ask":{"price":0.44,"size":200}}}},"checked_at":"2026-11-07T18:00:00Z"}]}}}},"400":{"description":"The request couldn't be read; detail says why. Not charged."},"401":{"description":"unauthorized: the key is unknown or revoked."},"402":{"description":"Payment required: the x402 PAYMENT-REQUIRED header carries the price."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.25"},"protocols":[{"x402":{}}]}}},"/v0/matches":{"get":{"operationId":"getMatches","summary":"List every live cross-venue match with prices","description":"Every live prediction-market pair Layer has matched across Kalshi and Polymarket/Polymarket US/Hyperliquid/Novig, soonest event first, with live prices and the best trade between them.","tags":["matches"],"parameters":[{"name":"venue","in":"query","required":false,"schema":{"type":"string","enum":["polymarket_us","polymarket","hyperliquid","novig"]}},{"name":"category","in":"query","required":false,"schema":{"type":"string"}},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Words to search for in the market title"},{"name":"series","in":"query","required":false,"schema":{"type":"string"},"description":"Kalshi series, comma-separated, e.g. KXBTC15M,KXETH15M"},{"name":"from","in":"query","required":false,"schema":{"type":"string"},"description":"First event day, YYYY-MM-DD. Without it, events that ended over 12 hours ago are left out."},{"name":"to","in":"query","required":false,"schema":{"type":"string"},"description":"YYYY-MM-DD"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"1-200"},{"name":"offset","in":"query","required":false,"schema":{"type":"string"},"description":"Send next_offset from the last page"}],"security":[{"bearerAuth":[]},{}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"example":{"count":1,"total":1,"limit":50,"offset":0,"has_more":false,"next_offset":null,"matches":[{"kalshi":{"venue":"kalshi","market_id":"KXNBAGAME-26NOV08LALBOS-LAL"},"polymarket_us":{"venue":"polymarket_us","market_id":"aec-nba-lal-bos-2026-11-08"},"tier":"human_verified","confidence":1}]}}}},"400":{"description":"The request couldn't be read; detail says why. Not charged."},"401":{"description":"unauthorized: the key is unknown or revoked."},"402":{"description":"Payment required: the x402 PAYMENT-REQUIRED header carries the price."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.10"},"protocols":[{"x402":{}}]}}},"/v0/settlements":{"get":{"operationId":"getSettlements","summary":"How matched pairs settled on both venues","description":"Layer's track record: how every matched pair settled on both venues, and whether they agreed.","tags":["settlements"],"parameters":[{"name":"venue","in":"query","required":false,"schema":{"type":"string"}},{"name":"since","in":"query","required":false,"schema":{"type":"string"},"description":"YYYY-MM-DD"},{"name":"outcome","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]},{}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"example":{"settlements":[]}}}},"400":{"description":"The request couldn't be read; detail says why. Not charged."},"401":{"description":"unauthorized: the key is unknown or revoked."},"402":{"description":"Payment required: the x402 PAYMENT-REQUIRED header carries the price."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{}}]}}},"/v0/profit":{"post":{"operationId":"postProfit","summary":"Profit after fees for a Kalshi-vs-Polymarket trade","description":"Is buying YES on Kalshi and NO on Polymarket (or the reverse) profitable after both venues' fees? Send the prices; Layer applies each venue's official fee schedule.","tags":["profit"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contracts":{"type":"integer"},"kalshi":{"type":"object","properties":{"price":{"type":"number"},"market_id":{"type":"string"}},"required":["price"]},"polymarket":{"type":"object","properties":{"price":{"type":"number"},"fee_rate":{"type":"number"},"category":{"type":"string"}}},"polymarket_us":{"type":"object","properties":{"price":{"type":"number"}}}},"required":["contracts","kalshi"]},"example":{"contracts":100,"kalshi":{"price":0.42},"polymarket":{"price":0.55,"fee_rate":0.05}}}}},"security":[{"bearerAuth":[]},{}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"example":{"cost":97,"fees":1.77,"payout":100,"net_profit":1.23,"return_pct":1.25,"profitable":true}}}},"400":{"description":"The request couldn't be read; detail says why. Not charged."},"401":{"description":"unauthorized: the key is unknown or revoked."},"402":{"description":"Payment required: the x402 PAYMENT-REQUIRED header carries the price."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.01"},"protocols":[{"x402":{}}]}}},"/v0/quote":{"get":{"operationId":"getQuote","summary":"How much of a matched market you can trade after fees","description":"Send a Kalshi ticker: Layer reads the live order books on Kalshi and Polymarket US (or polymarket.com) and returns the most contracts that still clear your minimum edge after both venues' fees.","tags":["quote"],"parameters":[{"name":"market_id","in":"query","required":true,"schema":{"type":"string"},"description":"The Kalshi ticker of a live match"},{"name":"venue","in":"query","required":false,"schema":{"type":"string","enum":["polymarket_us","polymarket"]}},{"name":"min_edge","in":"query","required":false,"schema":{"type":"string"},"description":"Smallest profit per contract after fees, in dollars"},{"name":"max_contracts","in":"query","required":false,"schema":{"type":"string"}}],"security":[{"bearerAuth":[]},{}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"example":{"contracts":100,"limited_by":"polymarket_us_book","edge_at_best":0.016,"net_profit":1.6,"profitable":true}}}},"400":{"description":"The request couldn't be read; detail says why. Not charged."},"401":{"description":"unauthorized: the key is unknown or revoked."},"402":{"description":"Payment required: the x402 PAYMENT-REQUIRED header carries the price."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.02"},"protocols":[{"x402":{}}]}}},"/v0/size":{"post":{"operationId":"postSize","summary":"Largest tradeable size that clears your edge after fees","description":"How many contracts of a Kalshi-vs-Polymarket gap you can actually trade: walks both order books you send and returns the largest size that clears your minimum edge after fees.","tags":["size"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"min_edge":{"type":"number"},"kalshi":{"type":"object","properties":{"asks":{"type":"array"}},"required":["asks"]},"polymarket":{"type":"object","properties":{"asks":{"type":"array"}}},"polymarket_us":{"type":"object","properties":{"asks":{"type":"array"}}}},"required":["kalshi"]},"example":{"min_edge":0.01,"kalshi":{"asks":[{"price":0.42,"size":100}]},"polymarket_us":{"asks":[{"price":0.53,"size":150}]}}}}},"security":[{"bearerAuth":[]},{}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"example":{"contracts":100,"limited_by":"kalshi_book","edge_at_best":0.012,"net_profit":1.2,"profitable":true}}}},"400":{"description":"The request couldn't be read; detail says why. Not charged."},"401":{"description":"unauthorized: the key is unknown or revoked."},"402":{"description":"Payment required: the x402 PAYMENT-REQUIRED header carries the price."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.02"},"protocols":[{"x402":{}}]}}},"/v0/health":{"get":{"operationId":"getHealth","summary":"Whether the API is up and can reach its database, with each venue's open markets and last pull. No key needed.","description":"Every field of the answer: https://uselayer.sh/docs/api#get-v0-health","tags":["health"],"security":[],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/api#get-v0-health"}}}},"/v0/markets":{"get":{"operationId":"getMarkets","summary":"Open markets listed on two or more venues, soonest first, each with every venue's listing, live prices and the best trade.","description":"Every field of the answer: https://uselayer.sh/docs/markets#get-v0-markets","tags":["markets"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/markets#get-v0-markets"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"parameters":[{"name":"category","in":"query","required":false,"schema":{"type":"string"},"description":"One category, such as sports, crypto, politics or economics."},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Words that must all appear, such as nfl or bitcoin."},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"The first day (UTC). Without it, only markets that haven't ended."},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"The last day (UTC)."},{"name":"venues","in":"query","required":false,"schema":{"type":"string"},"description":"Only markets listed on all of these, comma-separated: kalshi, polymarket, polymarket_us, novig, hyperliquid."},{"name":"event_id","in":"query","required":false,"schema":{"type":"string"},"description":"Every market of one game or occasion."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"How many to return, 1 to 200."},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0},"description":"How many to skip."},{"name":"prices","in":"query","required":false,"schema":{"type":"boolean","default":true},"description":"false leaves out prices and best trades, for a faster answer."}]}},"/v0/markets/lookup":{"get":{"operationId":"getMarketsLookup","summary":"The Layer market for one venue's market id. market is null, with a reason, when there is none.","description":"Every field of the answer: https://uselayer.sh/docs/markets#get-v0-markets-lookup","tags":["markets"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/markets#get-v0-markets-lookup"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"parameters":[{"name":"venue","in":"query","required":true,"schema":{"type":"string","enum":["kalshi","polymarket","polymarket_us","hyperliquid","novig"]},"description":"The venue the id is from."},{"name":"market_id","in":"query","required":true,"schema":{"type":"string"},"description":"That venue's market id."}]}},"/v0/markets/{id}":{"get":{"operationId":"getMarketsId","summary":"One Layer market, with live prices and best trades.","description":"Every field of the answer: https://uselayer.sh/docs/markets#get-v0-markets-id","tags":["markets"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/markets#get-v0-markets-id"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"404":{"description":"No such market."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"The market's Layer id, such as lyr_60a98333e4c6."}]}},"/v0/sports/spreads":{"get":{"operationId":"getSportsSpreads","summary":"Beta. The spread after fees on every NBA, NFL, NHL and college football game that is live or starts within 24 hours, between Kalshi and Polymarket US.","description":"Every field of the answer: https://uselayer.sh/docs/api#get-v0-sports-spreads","tags":["sports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/api#get-v0-sports-spreads"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."},"503":{"description":"books_unavailable (a venue didn't answer) or venue_unavailable."}},"parameters":[{"name":"league","in":"query","required":false,"schema":{"type":"string","enum":["nba","nfl","nhl","ncaaf"]},"description":"One league. Leave it out for all four."}]}},"/v0/sports/lead":{"get":{"operationId":"getSportsLead","summary":"Beta. Over the last days: which venue moved first on game winners, how often the other followed and how long it took.","description":"Every field of the answer: https://uselayer.sh/docs/sports#get-v0-sports-lead","tags":["sports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/sports#get-v0-sports-lead"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"parameters":[{"name":"league","in":"query","required":false,"schema":{"type":"string","enum":["nba","nfl","nhl","ncaaf"]},"description":"One league. Leave it out for all four."},{"name":"days","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":30,"default":7},"description":"How many days, ending on the last day processed."}]}},"/v0/sports/events":{"get":{"operationId":"getSportsEvents","summary":"Beta. One day's recorded spreads and moves, one by one with their times.","description":"Every field of the answer: https://uselayer.sh/docs/sports#get-v0-sports-events","tags":["sports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/sports#get-v0-sports-events"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"parameters":[{"name":"league","in":"query","required":false,"schema":{"type":"string","enum":["nba","nfl","nhl","ncaaf"]},"description":"One league. Leave it out for all four."},{"name":"date","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Games that started that day, US Eastern."}]}},"/v0/webhooks":{"get":{"operationId":"getWebhooks","summary":"Your webhook endpoints, each with how its deliveries are going.","description":"Every field of the answer: https://uselayer.sh/docs/api#get-v0-webhooks","tags":["webhooks"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/api#get-v0-webhooks"},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}}},"post":{"operationId":"postWebhooks","summary":"Register an https URL that Layer POSTs to when a match goes live, is pulled or settles. Up to 5. The answer's secret is shown only once.","description":"Every field of the answer: https://uselayer.sh/docs/api#post-v0-webhooks","tags":["webhooks"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/api#post-v0-webhooks"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"409":{"description":"too_many_endpoints: you already have 5."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"Where to send events. Must be https and reachable from the internet.","format":"uri"},"events":{"type":"array","items":{"type":"string","enum":["match.live","match.pulled","match.settled"]},"description":"Which events to send. All three when left out."},"venues":{"type":"array","items":{"type":"string","enum":["polymarket","polymarket_us","hyperliquid","novig"]},"description":"Matches with which venues. All when left out."},"description":{"type":"string","description":"A note for yourself.","maxLength":200}},"required":["url"]}}}}}},"/v0/webhooks/{id}":{"get":{"operationId":"getWebhooksId","summary":"One webhook endpoint and its last 20 deliveries, newest first.","description":"Every field of the answer: https://uselayer.sh/docs/api#get-v0-webhooks-id","tags":["webhooks"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/api#get-v0-webhooks-id"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"404":{"description":"not_found: no endpoint with that id on your account."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"The endpoint's id, such as whe_3f2a9c1d0b7e4a65."}]},"delete":{"operationId":"deleteWebhooksId","summary":"Stop sending to a webhook endpoint. Deliveries waiting for a retry are dropped.","description":"Every field of the answer: https://uselayer.sh/docs/api#delete-v0-webhooks-id","tags":["webhooks"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/api#delete-v0-webhooks-id"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"404":{"description":"not_found: no endpoint with that id on your account."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"The endpoint's id."}]}},"/v0/webhooks/{id}/test":{"post":{"operationId":"postWebhooksIdTest","summary":"Send one signed test event to a webhook endpoint now and report how your server replied.","description":"Every field of the answer: https://uselayer.sh/docs/api#post-v0-webhooks-id-test","tags":["webhooks"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/api#post-v0-webhooks-id-test"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"404":{"description":"not_found: no endpoint with that id on your account."},"409":{"description":"no_example: no event of that type to send yet."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"The endpoint's id."}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Send a real recent example of this event. With no body, webhook.test is sent.","enum":["match.live","match.pulled","match.settled"]}},"required":[]}}}}}},"/v0/sandbox":{"get":{"operationId":"getSandbox","summary":"Your sandbox account: simulated cash, each position valued at the best bid now, and profit or loss.","description":"Every field of the answer: https://uselayer.sh/docs/sandbox#get-v0-sandbox","tags":["sandbox"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/sandbox#get-v0-sandbox"},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}}}},"/v0/sandbox/markets":{"get":{"operationId":"getSandboxMarkets","summary":"Open markets to trade in the sandbox, soonest first.","description":"Every field of the answer: https://uselayer.sh/docs/sandbox#get-v0-sandbox-markets","tags":["sandbox"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/sandbox#get-v0-sandbox-markets"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"parameters":[{"name":"venue","in":"query","required":false,"schema":{"type":"string","enum":["polymarket_us","kalshi"],"default":"polymarket_us"},"description":"Polymarket US unless you send kalshi."},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Words that must all appear in the event, question or outcome."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":50,"default":20},"description":"How many to return, 1 to 50."}]}},"/v0/sandbox/orders":{"post":{"operationId":"postSandboxOrders","summary":"Place a simulated order against the venue's real order book, with simulated money. Nothing reaches the venue.","description":"Every field of the answer: https://uselayer.sh/docs/sandbox#post-v0-sandbox-orders","tags":["sandbox"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/sandbox#post-v0-sandbox-orders"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"404":{"description":"market_not_found."},"409":{"description":"client_id_reused: that client_id was used for a different order."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"venue":{"type":"string","description":"The venue to trade on.","enum":["polymarket_us","kalshi"]},"market":{"type":"string","description":"Polymarket US: the slug, or <slug>:long / <slug>:short for a market with two named sides. Kalshi: the ticker."},"side":{"type":"string","description":"Which side to trade.","enum":["yes","no"]},"action":{"type":"string","description":"Buy or sell.","enum":["buy","sell"],"default":"buy"},"price":{"type":"number","description":"Your limit in dollars per contract.","exclusiveMinimum":0,"exclusiveMaximum":1},"size":{"type":"number","description":"Contracts."},"tif":{"type":"string","description":"Fill what you can now, or all of it or nothing.","enum":["ioc","fok"],"default":"ioc"},"client_id":{"type":"string","description":"Your own id for the order. Sending the same order again with it returns the first one instead of filling twice."}},"required":["venue","market","side","price","size"]}}}}},"get":{"operationId":"getSandboxOrders","summary":"Your sandbox orders, newest first.","description":"Every field of the answer: https://uselayer.sh/docs/sandbox#get-v0-sandbox-orders","tags":["sandbox"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/sandbox#get-v0-sandbox-orders"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"How many to return, 1 to 200."}]}},"/v0/sandbox/preview":{"post":{"operationId":"postSandboxPreview","summary":"What an order would fill now, its fees and every check it would fail. Changes nothing.","description":"Every field of the answer: https://uselayer.sh/docs/sandbox#post-v0-sandbox-preview","tags":["sandbox"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/sandbox#post-v0-sandbox-preview"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"404":{"description":"market_not_found."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"venue":{"type":"string","description":"The venue to trade on.","enum":["polymarket_us","kalshi"]},"market":{"type":"string","description":"Polymarket US: the slug, or <slug>:long / <slug>:short for a market with two named sides. Kalshi: the ticker."},"side":{"type":"string","description":"Which side to trade.","enum":["yes","no"]},"action":{"type":"string","description":"Buy or sell.","enum":["buy","sell"],"default":"buy"},"price":{"type":"number","description":"Your limit in dollars per contract.","exclusiveMinimum":0,"exclusiveMaximum":1},"size":{"type":"number","description":"Contracts."},"tif":{"type":"string","description":"Fill what you can now, or all of it or nothing.","enum":["ioc","fok"],"default":"ioc"},"client_id":{"type":"string","description":"Your own id for the order. Sending the same order again with it returns the first one instead of filling twice."}},"required":["venue","market","side","price","size"]}}}}}},"/v0/sandbox/pairs":{"post":{"operationId":"postSandboxPairs","summary":"Buy both sides of a Kalshi and Polymarket US match in the sandbox: YES on one venue and NO on the other. Send size, max_cost_per_leg, or both.","description":"Every field of the answer: https://uselayer.sh/docs/sandbox#post-v0-sandbox-pairs","tags":["sandbox"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/sandbox#post-v0-sandbox-pairs"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"404":{"description":"not_a_match: no live Polymarket US match for that Kalshi ticker."},"409":{"description":"client_id_reused."},"422":{"description":"not_a_match or match_settled."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kalshi":{"type":"string","description":"The Kalshi ticker of a live match: kalshi.market_id in GET /v0/matches?venue=polymarket_us."},"polymarket_us":{"type":"string","description":"The matched Polymarket US market id, checked against Layer's match. Layer uses the match when left out."},"size":{"type":"integer","description":"Contracts wanted."},"max_cost_per_leg":{"type":"number","description":"The most either leg may cost, with fees, in dollars."},"min_edge":{"type":"number","description":"The smallest profit per contract after both fees you'll take, in dollars.","default":0.01},"max_position":{"type":"number","description":"The most contracts you may hold on each leg's market and side after the pair."},"on_miss":{"type":"string","description":"What to do with an unmatched first leg: sell it back, or keep it.","enum":["unwind","hold"],"default":"unwind"},"max_unwind_loss":{"type":"number","description":"How far below its entry price an unmatched leg may be sold back, in dollars per contract.","default":0.05},"first":{"type":"string","description":"The leg to send first. The thinner book by default.","enum":["kalshi","polymarket_us"]},"client_id":{"type":"string","description":"Your own id for the pair. Sending the same pair again with it returns the first one."},"what_if":{"type":"object","description":"Books you build, to see what happens when a side doesn't fill. See the docs."}},"required":["kalshi"]}}}}},"get":{"operationId":"getSandboxPairs","summary":"Your sandbox pairs, newest first.","description":"Every field of the answer: https://uselayer.sh/docs/sandbox#get-v0-sandbox-pairs","tags":["sandbox"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/sandbox#get-v0-sandbox-pairs"},"400":{"description":"bad_request: detail says which field is wrong, hint how to fix it."},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}},"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"How many to return, 1 to 200."}]}},"/v0/sandbox/reset":{"post":{"operationId":"postSandboxReset","summary":"Start the sandbox again: every order, fill, pair and position goes, and cash is back to $10,000.","description":"Every field of the answer: https://uselayer.sh/docs/sandbox#post-v0-sandbox-reset","tags":["sandbox"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The answer, as JSON. Its fields: https://uselayer.sh/docs/sandbox#post-v0-sandbox-reset"},"401":{"description":"unauthorized: no key, or the key is unknown or revoked."},"429":{"description":"rate_limited: over 60 requests a minute. Wait retry-after seconds."}}}}}}