# Table of Contents - [Developer Documentation - Predict API](#developer-documentation-predict-api) - [Developer Documentation - Predict API](#developer-documentation-predict-api) - [Understanding the Orderbook - Predict API (Beta)](#understanding-the-orderbook-predict-api-beta-) - [[TS] How to authenticate your API requests - Predict API (Beta)](#-ts-how-to-authenticate-your-api-requests-predict-api-beta-) - [General Information - Predict API (Beta)](#general-information-predict-api-beta-) - [Request Format - Predict API (Beta)](#request-format-predict-api-beta-) - [ Deployed Contracts - Predict API (Beta)](#-deployed-contracts-predict-api-beta-) - [How to create or cancel orders - Predict API (Beta)](#how-to-create-or-cancel-orders-predict-api-beta-) - [Response Format - Predict API (Beta)](#response-format-predict-api-beta-) - [[PY] How to authenticate your API requests - Predict API (Beta)](#-py-how-to-authenticate-your-api-requests-predict-api-beta-) - [Subscription Topics - Predict API (Beta)](#subscription-topics-predict-api-beta-) - [Get markets - Predict API (Beta)](#get-markets-predict-api-beta-) - [Get all tags - Predict API (Beta)](#get-all-tags-predict-api-beta-) - [Heartbeats - Predict API (Beta)](#heartbeats-predict-api-beta-) - [Get market by ID - Predict API (Beta)](#get-market-by-id-predict-api-beta-) - [Get the orderbook for a market - Predict API (Beta)](#get-the-orderbook-for-a-market-predict-api-beta-) - [Get order by hash - Predict API (Beta)](#get-order-by-hash-predict-api-beta-) - [Get market statistics - Predict API (Beta)](#get-market-statistics-predict-api-beta-) - [Create an order - Predict API (Beta)](#create-an-order-predict-api-beta-) - [Remove orders from the orderbook - Predict API (Beta)](#remove-orders-from-the-orderbook-predict-api-beta-) - [Get orders - Predict API (Beta)](#get-orders-predict-api-beta-) - [Get market last sale information - Predict API (Beta)](#get-market-last-sale-information-predict-api-beta-) - [Get order match events - Predict API (Beta)](#get-order-match-events-predict-api-beta-) - [Get account activity - Predict API (Beta)](#get-account-activity-predict-api-beta-) - [Get connected account - Predict API (Beta)](#get-connected-account-predict-api-beta-) - [Get positions - Predict API (Beta)](#get-positions-predict-api-beta-) - [Unknown](#unknown) - [Set a referral - Predict API (Beta)](#set-a-referral-predict-api-beta-) - [Client Example - Predict API (Beta)](#client-example-predict-api-beta-) - [Get auth message - Predict API (Beta)](#get-auth-message-predict-api-beta-) - [Get positions by address - Predict API (Beta)](#get-positions-by-address-predict-api-beta-) - [Get JWT with valid signature - Predict API (Beta)](#get-jwt-with-valid-signature-predict-api-beta-) - [Search categories and markets - Predict API (Beta)](#search-categories-and-markets-predict-api-beta-) - [Finalize a OAuth connection - Predict API (Beta)](#finalize-a-oauth-connection-predict-api-beta-) - [Get the orders for a OAuth connection - Predict API (Beta)](#get-the-orders-for-a-oauth-connection-predict-api-beta-) - [Understanding the Orderbook - Predict API (Beta)](#understanding-the-orderbook-predict-api-beta-) - [Get category by slug - Predict API (Beta)](#get-category-by-slug-predict-api-beta-) - [Cancel the orders for a OAuth connection - Predict API (Beta)](#cancel-the-orders-for-a-oauth-connection-predict-api-beta-) - [Create an order for a OAuth connection - Predict API (Beta)](#create-an-order-for-a-oauth-connection-predict-api-beta-) - [Get the positions for a OAuth connection - Predict API (Beta)](#get-the-positions-for-a-oauth-connection-predict-api-beta-) - [[TS] How to authenticate your API requests - Predict API (Beta)](#-ts-how-to-authenticate-your-api-requests-predict-api-beta-) - [How to create or cancel orders - Predict API (Beta)](#how-to-create-or-cancel-orders-predict-api-beta-) - [Get categories - Predict API (Beta)](#get-categories-predict-api-beta-) --- # Developer Documentation - Predict API [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") FAQs ==== Copy Page Join our Discord server at [https://discord.gg/predictdotfun](https://discord.gg/predictdotfun) **The REST API is currently in beta. Please, report any issue in our Discord server.** ### Guides[#](https://dev.predict.fun/#guides) [Understanding the Orderbook](https://dev.predict.fun/doc-685654) [How to authenticate your API requests](https://dev.predict.fun/doc-679306) [How to create or cancel orders](https://dev.predict.fun/doc-663127) Where do I request an API key?[#](https://dev.predict.fun/#where-do-i-request-an-api-key) ------------------------------------------------------------------------------------------ To request an API key join the Predict's Discord server and open a support ticket. **Predict's Discord**: [https://discord.gg/predictdotfun](https://discord.gg/predictdotfun) What chains are supported?[#](https://dev.predict.fun/#what-chains-are-supported) ---------------------------------------------------------------------------------- **BNB Mainnet** _(API key required)_: `https://api.predict.fun/` **BNB Testnet** _(API key not required)_: `https://api-testnet.predict.fun/` Is there an SDK to create orders?[#](https://dev.predict.fun/#is-there-an-sdk-to-create-orders) ------------------------------------------------------------------------------------------------ Yes, we have an SDK available in multiple languages: TypeScript **NPM**: [https://www.npmjs.com/package/@predictdotfun/sdk](https://www.npmjs.com/package/@predictdotfun/sdk) **GitHub**: [https://github.com/PredictDotFun/sdk](https://github.com/PredictDotFun/sdk) Python **PyPI**: [https://pypi.org/project/predict-sdk/](https://pypi.org/project/predict-sdk/) **GitHub**: [https://github.com/PredictDotFun/sdk-python](https://github.com/PredictDotFun/sdk-python) Is there any AI familiar with the SDKs?[#](https://dev.predict.fun/#is-there-any-ai-familiar-with-the-sdks) ------------------------------------------------------------------------------------------------------------ Yes, we published our SDKs on Context7, which can be used either via MCP or directly on their website for free to ask question about our SDKs or REST API. **Predict TypeScript SDK**: [https://context7.com/predictdotfun/sdk?tab=chat](https://context7.com/predictdotfun/sdk?tab=chat) **Predict Python SDK**: [https://context7.com/predictdotfun/sdk-python?tab=chat](https://context7.com/predictdotfun/sdk-python?tab=chat) **Predict REST API**: [https://context7.com/llmstxt/dev\_predict\_fun\_llms\_txt?tab=chat](https://context7.com/llmstxt/dev_predict_fun_llms_txt?tab=chat) What rate limit is available on mainnet?[#](https://dev.predict.fun/#what-rate-limit-is-available-on-mainnet) -------------------------------------------------------------------------------------------------------------- On Testnet, we allow up to 240 requests per minute without an API key. On Mainnet, the default rate limit for an API key is 240 requests per minute. Can I use my Predict account via the API/SDK?[#](https://dev.predict.fun/#can-i-use-my-predict-account-via-the-apisdk) ----------------------------------------------------------------------------------------------------------------------- Predict supports interacting with the protocol using either a traditional Externally Owned Account (EOA) or a Smart Wallet ("Predict Account"). If you use the web app, a Smart Wallet is automatically created for you. To interact with your Smart Wallet programmatically using the SDK, follow the example shown in [How to use a Predict account](https://dev.predict.fun/doc-679306#how-to-use-a-predict-account) . If you are using our Smart Wallet, you will need two things: The Predict account address (aka deposit address) The Privy Wallet private key (and the address to fund ETH for on-chain tx) This can be exported from your account's settings at [https://predict.fun/account/settings](https://predict.fun/account/settings) If you want to programmatically interract with Predict via your Smart Wallet (Predict Account) and not a simple EOA, you can check out our guides, which cover both cases: [How to authenticate your API requests](https://dev.predict.fun/doc-663127) [How to create or cancel orders](https://dev.predict.fun/doc-679306) Alternatively, you can look into other Account Abstraction SDKs, like ZeroDev SDK. This requires a greater effort on your side and techincal knowledge. We won't be able to provide much support if you choose to use third parties SDKs. How do I create orders?[#](https://dev.predict.fun/#how-do-i-create-orders) ---------------------------------------------------------------------------- See [How to create or cancel orders](https://dev.predict.fun/doc-679306) . How do I authenticate my requests?[#](https://dev.predict.fun/#how-do-i-authenticate-my-requests) -------------------------------------------------------------------------------------------------- See [How to authenticate your API requests](https://dev.predict.fun/doc-663127) . Is there altervative UI for the API reference?[#](https://dev.predict.fun/#is-there-altervative-ui-for-the-api-reference) -------------------------------------------------------------------------------------------------------------------------- Yes, an alternative UI for the API reference is also available at: [https://api.predict.fun/docs](https://api.predict.fun/docs) Modified at 2025-12-12 03:24:34 [Next\ \ Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0) --- # Developer Documentation - Predict API [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") FAQs ==== Copy Page Join our Discord server at [https://discord.gg/predictdotfun](https://discord.gg/predictdotfun) **The REST API is currently in beta. Please, report any issue in our Discord server.** ### Guides[#](https://dev.predict.fun/faqs-684248m0#guides) [Understanding the Orderbook](https://dev.predict.fun/doc-685654) [How to authenticate your API requests](https://dev.predict.fun/doc-679306) [How to create or cancel orders](https://dev.predict.fun/doc-663127) Where do I request an API key?[#](https://dev.predict.fun/faqs-684248m0#where-do-i-request-an-api-key) ------------------------------------------------------------------------------------------------------- To request an API key join the Predict's Discord server and open a support ticket. **Predict's Discord**: [https://discord.gg/predictdotfun](https://discord.gg/predictdotfun) What chains are supported?[#](https://dev.predict.fun/faqs-684248m0#what-chains-are-supported) ----------------------------------------------------------------------------------------------- **BNB Mainnet** _(API key required)_: `https://api.predict.fun/` **BNB Testnet** _(API key not required)_: `https://api-testnet.predict.fun/` Is there an SDK to create orders?[#](https://dev.predict.fun/faqs-684248m0#is-there-an-sdk-to-create-orders) ------------------------------------------------------------------------------------------------------------- Yes, we have an SDK available in multiple languages: TypeScript **NPM**: [https://www.npmjs.com/package/@predictdotfun/sdk](https://www.npmjs.com/package/@predictdotfun/sdk) **GitHub**: [https://github.com/PredictDotFun/sdk](https://github.com/PredictDotFun/sdk) Python **PyPI**: [https://pypi.org/project/predict-sdk/](https://pypi.org/project/predict-sdk/) **GitHub**: [https://github.com/PredictDotFun/sdk-python](https://github.com/PredictDotFun/sdk-python) Is there any AI familiar with the SDKs?[#](https://dev.predict.fun/faqs-684248m0#is-there-any-ai-familiar-with-the-sdks) ------------------------------------------------------------------------------------------------------------------------- Yes, we published our SDKs on Context7, which can be used either via MCP or directly on their website for free to ask question about our SDKs or REST API. **Predict TypeScript SDK**: [https://context7.com/predictdotfun/sdk?tab=chat](https://context7.com/predictdotfun/sdk?tab=chat) **Predict Python SDK**: [https://context7.com/predictdotfun/sdk-python?tab=chat](https://context7.com/predictdotfun/sdk-python?tab=chat) **Predict REST API**: [https://context7.com/llmstxt/dev\_predict\_fun\_llms\_txt?tab=chat](https://context7.com/llmstxt/dev_predict_fun_llms_txt?tab=chat) What rate limit is available on mainnet?[#](https://dev.predict.fun/faqs-684248m0#what-rate-limit-is-available-on-mainnet) --------------------------------------------------------------------------------------------------------------------------- On Testnet, we allow up to 240 requests per minute without an API key. On Mainnet, the default rate limit for an API key is 240 requests per minute. Can I use my Predict account via the API/SDK?[#](https://dev.predict.fun/faqs-684248m0#can-i-use-my-predict-account-via-the-apisdk) ------------------------------------------------------------------------------------------------------------------------------------ Predict supports interacting with the protocol using either a traditional Externally Owned Account (EOA) or a Smart Wallet ("Predict Account"). If you use the web app, a Smart Wallet is automatically created for you. To interact with your Smart Wallet programmatically using the SDK, follow the example shown in [How to use a Predict account](https://dev.predict.fun/doc-679306#how-to-use-a-predict-account) . If you are using our Smart Wallet, you will need two things: The Predict account address (aka deposit address) The Privy Wallet private key (and the address to fund ETH for on-chain tx) This can be exported from your account's settings at [https://predict.fun/account/settings](https://predict.fun/account/settings) If you want to programmatically interract with Predict via your Smart Wallet (Predict Account) and not a simple EOA, you can check out our guides, which cover both cases: [How to authenticate your API requests](https://dev.predict.fun/doc-663127) [How to create or cancel orders](https://dev.predict.fun/doc-679306) Alternatively, you can look into other Account Abstraction SDKs, like ZeroDev SDK. This requires a greater effort on your side and techincal knowledge. We won't be able to provide much support if you choose to use third parties SDKs. How do I create orders?[#](https://dev.predict.fun/faqs-684248m0#how-do-i-create-orders) ----------------------------------------------------------------------------------------- See [How to create or cancel orders](https://dev.predict.fun/doc-679306) . How do I authenticate my requests?[#](https://dev.predict.fun/faqs-684248m0#how-do-i-authenticate-my-requests) --------------------------------------------------------------------------------------------------------------- See [How to authenticate your API requests](https://dev.predict.fun/doc-663127) . Is there altervative UI for the API reference?[#](https://dev.predict.fun/faqs-684248m0#is-there-altervative-ui-for-the-api-reference) --------------------------------------------------------------------------------------------------------------------------------------- Yes, an alternative UI for the API reference is also available at: [https://api.predict.fun/docs](https://api.predict.fun/docs) Modified at 2025-12-12 03:24:34 [Next\ \ Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0) --- # Understanding the Orderbook - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0 "Understanding the Orderbook") * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0 "[TS] How to authenticate your API requests") * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0 "[PY] How to authenticate your API requests") * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0 "How to create or cancel orders") * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Copy Page Understanding the Orderbook =========================== INFO **The order book stores prices based on the `Yes` outcome.** See the guide below to understand how to calculate the `No` outcome price. Order Book Price Structure Overview[#](https://dev.predict.fun/understanding-the-orderbook-685654m0#order-book-price-structure-overview) ----------------------------------------------------------------------------------------------------------------------------------------- The API returns the order book for a given market with the following JSON structure that contains depth details about both buy (`bids`) and sell (`asks`) prices **for the `Yes` side of the market**. To understand how to derive the corresponding `No` side prices, let’s break down the API response and how prices are calculated. ### Example API Response[#](https://dev.predict.fun/understanding-the-orderbook-685654m0#example-api-response) Here is an example of the API response structure: { "success": true, "data": { "marketId": 1, "updateTimestampMs": 1727910141000, "asks": [\ [0.492, 30192.26],\ [0.493, 20003]\ ], "bids": [\ [0.491, 303518.1],\ [0.49, 1365.44]\ ] } } **`asks`**: A list of the current sell price depth based on the `Yes` side `[price, quantity]` (best/lowest ask first). **`bids`**: A list of the current buy price depth based on the `Yes` side `[price, quantity]` (best/highest bid first). ### Price Calculations[#](https://dev.predict.fun/understanding-the-orderbook-685654m0#price-calculations) The order book stores prices based on the `Yes` outcome. To get the equivalent prices for the `No` outcome, you need the **complement** price **at the market’s decimal precision** (so that `Yes + No = 1` at that precision). 1. **`No` Buy Price**: This is the best price to **buy `No`** (equivalently: **sell `Yes`** into the best `Yes` bid). It’s calculated as: **Explanation**: `bids[0][0]` is the highest bid price for `Yes`. The corresponding best price to buy `No` is the complement of that `Yes` bid. 2. **`No` Sell Price**: This is the best price to **sell `No`** (equivalently: **buy `Yes`** from the best `Yes` ask). It’s calculated as: **Explanation**: `asks[0][0]` is the lowest ask price for `Yes`. The corresponding best price to sell `No` is the complement of that `Yes` ask. If you need the _full depth_ for the `No` side (not just top-of-book), you transform the book by **swapping** sides and complementing each level: ### Notes[#](https://dev.predict.fun/understanding-the-orderbook-685654m0#notes) **Order Book Data**: The order book (`bids` and `asks`) data is already sorted with the best prices first (`bids[0]` highest, `asks[0]` lowest). **Precision Matters**: Use the same `decimalPrecision` as the market/backend expects. Using a raw `1 - price` can produce values that don’t match backend rounding. **Price Range**: Both `Yes` and `No` prices are constrained to the range `[0, 1]`, reflecting probabilities in a market context. **Edge Cases**: If there are no bids or asks (e.g., `bids` or `asks` arrays are empty), additional logic may be needed to handle these cases to avoid errors during price calculation. Modified at 2025-12-12 02:51:57 [Previous\ \ Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0) [Next\ \ \[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) --- # [TS] How to authenticate your API requests - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0 "Understanding the Orderbook") * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0 "[TS] How to authenticate your API requests") * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0 "[PY] How to authenticate your API requests") * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0 "How to create or cancel orders") * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Copy Page \[TS\] How to authenticate your API requests ============================================ ### Authentication with API Key and JWT Token[#](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0#authentication-with-api-key-and-jwt-token) To interact with Predict's API, you'll need two things: 1. **API Key**: Required for all endpoints (only on Mainnet). 2. **JWT Token**: Required for performing personal operations for a specific wallet (e.g., sending a new order or viewing active orders). **Sections**: [**Obtaining a JWT Token _(for EOAs)_**](https://dev.predict.fun/apidoc/ts-how-to-authenticate-your-api-requests-663127m0#obtaining-a-jwt-token-for-eoas) [**Obtaining a JWT Token _(for Predict accounts)_**](https://dev.predict.fun/apidoc/ts-how-to-authenticate-your-api-requests-663127m0#obtaining-a-jwt-token-for-predict-accounts) [**Passing the API Key and JWT Token in the requests**](https://dev.predict.fun/apidoc/ts-how-to-authenticate-your-api-requests-663127m0#passing-the-api-key-and-jwt-token-in-requests) ### Obtaining a JWT Token _(for Predict accounts)_[#](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0#obtaining-a-jwt-token-for-predict-accounts) An API key is required to obtain a JWT token. Follow these steps to generate a JWT token for your wallet: 1. **Retrieve the message to sign**: Send a `GET` request to `/v1/auth/message` to retrieve a message for signing. 2. **Sign the message with your wallet via our SDK**: You will need two wallets: Your Predict account address (aka deposit address) Your Privy Wallet private key (can be exported from the account's settings) **NOTE**: It's reccomended to fund your Privy Wallet with BNB to be able to set approvals and cancel orders. 3. **Send the signature**: Send a `POST` request to `/v1/auth` with the following JSON structure: ### Obtaining a JWT Token _(for EOAs)_[#](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0#obtaining-a-jwt-token-for-eoas) An API key is required to obtain a JWT token. Follow these steps to generate a JWT token for your wallet: 1. **Retrieve the message to sign**: Send a `GET` request to `/v1/auth/message` to retrieve a message for signing. 2. **Sign the message with your wallet**: Use the wallet you want to authenticate with to sign the message retrieved in step 1. 3. **Send the signature**: Send a `POST` request to `/v1/auth` with the following JSON structure: ### Passing the API Key and JWT Token in Requests[#](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0#passing-the-api-key-and-jwt-token-in-requests) To authenticate your requests, you need to include both the API key and the JWT token in the request headers. **The API key and `x-api-key` header are not required on Testnet**. Request headers (as shown on the example above): { "headers": { "x-api-key": "YOUR_API_KEY", "Authorization": "Bearer YOUR_JWT_TOKEN" } } Example usage: Modified at 2025-12-17 15:19:32 [Previous\ \ Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) [Next\ \ \[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) --- # General Information - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0 "General Information") * [Request Format](https://dev.predict.fun/request-format-1915501m0 "Request Format") * [Response Format](https://dev.predict.fun/response-format-1915502m0 "Response Format") * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0 "Subscription Topics") * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0 "Heartbeats") * [Client Example](https://dev.predict.fun/client-example-1915523m0 "Client Example") * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Copy Page General Information =================== General WebSocket API Information[#](https://dev.predict.fun/general-information-1915499m0#general-websocket-api-information) ============================================================================================================================== ### Endpoint Details[#](https://dev.predict.fun/general-information-1915499m0#endpoint-details) **Base Endpoint**: `wss://ws.predict.fun/ws` **Protocol**: Secure WebSocket (`wss`) over standard port 443. **Path**: All connections should be directed to the `/ws` path. Api Key[#](https://dev.predict.fun/general-information-1915499m0#api-key) ========================================================================== **API Key**: API keys can be provided via the `x-api-key` HTTP header or `apiKey` query parameter (e.g., `wss://ws.predict.fun/ws?apiKey=your-key`). API keys will be required in the near future. ### Connection Management[#](https://dev.predict.fun/general-information-1915499m0#connection-management) **Responses**: All responses and pushed messages are in **JSON** format. **Timestamps**: All timestamps in the JSON responses are in **milliseconds** (UTC). **Case Sensitivity**: All field names, methods, and values (unless specified otherwise) are **case-sensitive**. **Connection Stability**: While there is no hard limit on connection duration, clients are encouraged to implement robust reconnection logic with exponential backoff to handle network interruptions. ### Heartbeat & Connectivity[#](https://dev.predict.fun/general-information-1915499m0#heartbeat--connectivity) **Server Heartbeat**: The WebSocket server sends a heartbeat message every **15 seconds**. **Client Response**: Upon receiving a heartbeat message (`type: "M", topic: "heartbeat"`), the client **must** respond with a heartbeat message (`method: "heartbeat"`) containing the same timestamp provided by the server. **Disconnection**: If the server does not receive a valid heartbeat response before the next heartbeat interval, the connection will be terminated to ensure resources are freed. ### Authentication[#](https://dev.predict.fun/general-information-1915499m0#authentication) **Public Streams**: Market data, orderbooks, and price updates do not require authentication. **Private Streams**: Streams specific to a user (e.g., `predictWalletEvents`) require a valid **JWT (JSON Web Token)** passed as part of the topic string. **Credentials**: We support authentication via signed JWTs. Ensure your token is valid and not expired when initiating a subscription. ### Message Ordering & Handling[#](https://dev.predict.fun/general-information-1915499m0#message-ordering--handling) **Chronological Order**: Data is pushed in chronological order as events occur within our matching engine and data feeds. **Request IDs**: Every `subscribe` and `unsubscribe` request must include a unique `requestId` (non-negative integer). This ID is returned in the server's response (`type: "R"`) to help the client track the success of specific operations. **UTF-8 Encoding**: All string data is encoded in UTF-8. This includes market questions and symbol names. ### Rate Limits & Safety[#](https://dev.predict.fun/general-information-1915499m0#rate-limits--safety) **Subscription Limits**: While there is no strict limit on the number of topics per connection, it is recommended to only subscribe to necessary channels to minimize latency and bandwidth. We are likely to enforce limits in the future. **Request Timeout**: Subscription requests generally have a processing timeout of **10 seconds**. If no response is received, the client should assume the state is unknown and may retry or query current status. **Payload Safety**: Avoid including sensitive characters or SQL keywords in your requests to prevent accidental triggering of security filters. Modified at 2026-01-12 16:34:11 [Previous\ \ How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) [Next\ \ Request Format](https://dev.predict.fun/request-format-1915501m0) --- # Request Format - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0 "General Information") * [Request Format](https://dev.predict.fun/request-format-1915501m0 "Request Format") * [Response Format](https://dev.predict.fun/response-format-1915502m0 "Response Format") * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0 "Subscription Topics") * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0 "Heartbeats") * [Client Example](https://dev.predict.fun/client-example-1915523m0 "Client Example") * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Copy Page Request Format ============== Request Format[#](https://dev.predict.fun/request-format-1915501m0#request-format) =================================================================================== Message Protocol[#](https://dev.predict.fun/request-format-1915501m0#message-protocol) --------------------------------------------------------------------------------------- The API uses a JSON-based protocol with specific message structures for client requests and server responses. ### Base Message Structure (Client to Server)[#](https://dev.predict.fun/request-format-1915501m0#base-message-structure-client-to-server) All client requests must follow this format: { "method": "subscribe" | "unsubscribe" | "heartbeat", "requestId": number, "params": string[], "data": any } | Field | Type | Required | Description | | --- | --- | --- | --- | | `method` | string | Yes | The action to perform: `subscribe`, `unsubscribe`, or `heartbeat`. | | `requestId` | number | Conditional | A unique, non-negative integer to track request responses. Required for `subscribe` and `unsubscribe`. | | `params` | string\[\] | Conditional | An array containing the topic string(s). Required for `subscribe` and `unsubscribe`. | | `data` | any | Conditional | Payload for the method. Required for `heartbeat` (must be the timestamp received from server). | Heartbeat Mechanism[#](https://dev.predict.fun/request-format-1915501m0#heartbeat-mechanism) --------------------------------------------------------------------------------------------- To maintain an active connection, the server implements a heartbeat mechanism. 1. **Server Probe**: Every 15 seconds, the server sends: { "type": "M", "topic": "heartbeat", "data": 1736696400000 } 2. **Client Response**: The client must respond within the next 15 seconds with: { "method": "heartbeat", "data": 1736696400000 } _Note: The `data` value must match the timestamp received from the server._ Failure to respond to the heartbeat will result in the server terminating the connection. * * * Subscription Topics[#](https://dev.predict.fun/request-format-1915501m0#subscription-topics) --------------------------------------------------------------------------------------------- Topics are formatted as `topicName/parameter`. ### 1\. Predict Orderbook[#](https://dev.predict.fun/request-format-1915501m0#1-predict-orderbook) Live updates for a specific market's orderbook. **Topic**: `predictOrderbook/{marketId}` **Payload**: Orderbook data (JSON). ### 2\. Asset Price Update[#](https://dev.predict.fun/request-format-1915501m0#2-asset-price-update) Real-time price updates for a specific price feed. **Topic**: `assetPriceUpdate/{priceFeedId}` **Payload**: { "price": number, "publishTime": number, "timestamp": number } ### 3\. Predict Wallet Events (Authenticated)[#](https://dev.predict.fun/request-format-1915501m0#3-predict-wallet-events-authenticated) Live events specific to a user's wallet. Requires a valid JWT. **Topic**: `predictWalletEvents/{jwt}` **Payload**: One of several wallet event types. **Event Types**: `orderAccepted`: Order successfully placed in orderbook. `orderNotAccepted`: Order rejected (e.g., duplicate). `orderExpired`: Order reached its end time. `orderCancelled`: User cancelled the order. `orderTransactionSubmitted`: Order matched, transaction sent to blockchain. `orderTransactionSuccess`: On-chain transaction succeeded. `orderTransactionFailed`: On-chain transaction failed. * * * Error Codes[#](https://dev.predict.fun/request-format-1915501m0#error-codes) ----------------------------------------------------------------------------- | Code | Description | | --- | --- | | `invalid_json` | The message sent by the client is not valid JSON. | | `invalid_topic` | The requested topic is malformed or unknown. | | `invalid_credentials` | (Wallet events) The provided JWT is invalid or expired. | | `internal_server_error` | An unexpected error occurred on the server. | | `unsupported_contract` | The requested market/contract is not supported. | Modified at 2026-01-16 11:16:05 [Previous\ \ General Information](https://dev.predict.fun/general-information-1915499m0) [Next\ \ Response Format](https://dev.predict.fun/response-format-1915502m0) --- # Deployed Contracts - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Deployed Contracts ================== Copy Page BNB Mainnet BNB Testnet ### Shared[#](https://dev.predict.fun/-deployed-contracts-1860295m0#shared) | Name | Address | | --- | --- | | UmaCompatibleOptimisticOracle | [0x76F42e5520E62AD88f8fE583cBb4BfF27eeC2531](https://bscscan.com/address/0x76F42e5520E62AD88f8fE583cBb4BfF27eeC2531#code) | | Vault | [0x09F683d8a144c4ac296D770F839098c3377410c5](https://bscscan.com/address/0x09F683d8a144c4ac296D770F839098c3377410c5#code) | | ZeroDevWithdrawalHelper | [0xf4aa30b537882eca7e69defb68d6f631cda77b00](https://bscscan.com/address/0xf4aa30b537882eca7e69defb68d6f631cda77b00#code) | | RewardDistributor | [0x14e3cB02F48818a8FeF6BC257059767cA9d436Ae](https://bscscan.com/address/0x14e3cB02F48818a8FeF6BC257059767cA9d436Ae#code) | ### Yield Bearing Prediction Market[#](https://dev.predict.fun/-deployed-contracts-1860295m0#yield-bearing-prediction-market) | Name | Address | | --- | --- | | YieldBearingConditionalTokens | [0x9400F8Ad57e9e0F352345935d6D3175975eb1d9F](https://bscscan.com/address/0x9400F8Ad57e9e0F352345935d6D3175975eb1d9F#code) | | UmaCompatibleCtfAdapter | [0x947cc06D38d3cB0a2BB5AdFB668b99B4FF53d7B4](https://bscscan.com/address/0x947cc06D38d3cB0a2BB5AdFB668b99B4FF53d7B4#code) | | CTFExchange | [0x6bEb5a40C032AFc305961162d8204CDA16DECFa5](https://bscscan.com/address/0x6bEb5a40C032AFc305961162d8204CDA16DECFa5#code) | | NegRisk ConditionalTokens | [0xF64b0b318AAf83BD9071110af24D24445719A07F](https://bscscan.com/address/0xF64b0b318AAf83BD9071110af24D24445719A07F#code) | | YieldBearingNegRiskAdapter | [0x41dCe1A4B8FB5e6327701750aF6231B7CD0B2A40](https://bscscan.com/address/0x41dCe1A4B8FB5e6327701750aF6231B7CD0B2A40#code) | | YieldBearingWrappedCollateral | [0xCfb9beF5F7B748aC72311F057f3a888BC73334D9](https://bscscan.com/address/0xCfb9beF5F7B748aC72311F057f3a888BC73334D9#code) | | NegRiskCtfExchange | [0x8A289d458f5a134bA40015085A8F50Ffb681B41d](https://bscscan.com/address/0x8A289d458f5a134bA40015085A8F50Ffb681B41d#code) | | NegRiskOperator | [0xBB7250101e0e3611D7e136fFE73Bc24b98E3e175](https://bscscan.com/address/0xBB7250101e0e3611D7e136fFE73Bc24b98E3e175#code) | | NegRisk UmaCompatibleCtfAdapter | [0x26B366Ab634C43BdA6D784fDCe34F24A37DF8172](https://bscscan.com/address/0x26B366Ab634C43BdA6D784fDCe34F24A37DF8172#code) | | FeeModuleV2 | [0xFbC2259aBB3F01c019ECE1d0200Ee673BB7BA34F](https://bscscan.com/address/0xFbC2259aBB3F01c019ECE1d0200Ee673BB7BA34F#code) | | NegRiskFeeModuleV2 | [0xD172f3FBabe763Ee8E52D8b32421574236dA6057](https://bscscan.com/address/0xD172f3FBabe763Ee8E52D8b32421574236dA6057#code) | | ConditionalTokensFeesHandler | [0xb4D9F13738a50E88E0ade2ecCc89254EF1645f6E](https://bscscan.com/address/0xb4D9F13738a50E88E0ade2ecCc89254EF1645f6E#code) | | RegisterTokenHelper | [0xa48C26abd9024a5CC5a869bBd97A6a3D6B9C2089](https://bscscan.com/address/0xa48C26abd9024a5CC5a869bBd97A6a3D6B9C2089#code) | ### Non Yield Bearing Prediction Market[#](https://dev.predict.fun/-deployed-contracts-1860295m0#non-yield-bearing-prediction-market) | Name | Address | | --- | --- | | ConditionalTokens | [0x22DA1810B194ca018378464a58f6Ac2B10C9d244](https://bscscan.com/address/0x22DA1810B194ca018378464a58f6Ac2B10C9d244#code) | | UmaCompatibleCtfAdapter | [0x242E1Ba24f6fC524bfb410062Ca5689A9622613d](https://bscscan.com/address/0x242E1Ba24f6fC524bfb410062Ca5689A9622613d#code) | | CTFExchange | [0x8BC070BEdAB741406F4B1Eb65A72bee27894B689](https://bscscan.com/address/0x8BC070BEdAB741406F4B1Eb65A72bee27894B689#code) | | NegRisk ConditionalTokens | [0x22DA1810B194ca018378464a58f6Ac2B10C9d244](https://bscscan.com/address/0x22DA1810B194ca018378464a58f6Ac2B10C9d244#code) | | NegRiskAdapter | [0xc3Cf7c252f65E0d8D88537dF96569AE94a7F1A6E](https://bscscan.com/address/0xc3Cf7c252f65E0d8D88537dF96569AE94a7F1A6E#code) | | WrappedCollateral | [0x66239b70133773A72A0D589E5564E88a50Cd39e7](https://bscscan.com/address/0x66239b70133773A72A0D589E5564E88a50Cd39e7#code) | | NegRiskCtfExchange | [0x365fb81bd4A24D6303cd2F19c349dE6894D8d58A](https://bscscan.com/address/0x365fb81bd4A24D6303cd2F19c349dE6894D8d58A#code) | | NegRiskOperator | [0x56020F5024641d577Cb54032aF70a23a986ECfFD](https://bscscan.com/address/0x56020F5024641d577Cb54032aF70a23a986ECfFD#code) | | NegRisk UmaCompatibleCtfAdapter | [0xf61198a64C2e4CAD8CCAf218f3f2ECeFb017902F](https://bscscan.com/address/0xf61198a64C2e4CAD8CCAf218f3f2ECeFb017902F#code) | | FeeModuleV2 | [0xF1f8F5C641F20C48526269EF7DFF19172Efa9783](https://bscscan.com/address/0xF1f8F5C641F20C48526269EF7DFF19172Efa9783#code) | | NegRiskFeeModuleV2 | [0xF2311C668aAA8dEc48D5da577d3018eb94b3132F](https://bscscan.com/address/0xF2311C668aAA8dEc48D5da577d3018eb94b3132F#code) | | ConditionalTokensFeesHandler | [0xD63206243192f1AF3d6fC4442db4e3cf25E64030](https://bscscan.com/address/0xD63206243192f1AF3d6fC4442db4e3cf25E64030#code) | | RegisterTokenHelper | [0x89f92C3c27F18080AF1361024C6a892144fD8e5E](https://bscscan.com/address/0x89f92C3c27F18080AF1361024C6a892144fD8e5E#code) | Modified at 2025-12-12 01:40:40 [Previous\ \ FAQs](https://dev.predict.fun/faqs-684248m0) [Next\ \ Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) --- # How to create or cancel orders - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0 "Understanding the Orderbook") * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0 "[TS] How to authenticate your API requests") * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0 "[PY] How to authenticate your API requests") * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0 "How to create or cancel orders") * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Copy Page How to create or cancel orders ============================== This guide will demonstrate how to create orders using the Predict's TypeScript SDK. #### Sections:[#](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0#sections) [How to install the SDK](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#how-to-install-the-sdk) [How to set approvals](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#how-to-set-approvals) [How to use a Predict account](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#how-to-use-a-predict-account) [How to create a LIMIT order _(recommended)_](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#how-to-create-a-limit-order-recommended) [How to create a MARKET order](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#how-to-create-a-market-order) [How to redeem positions](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#how-to-redeem-positions) [How to merge positions](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#how-to-merge-positions) [How to check USDT balance](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#how-to-check-usdt-balance) [How to interface with contracts](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#how-to-interface-with-contracts) [How to cancel orders](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#how-to-cancel-orders) [License](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#license) How to install the SDK[#](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0#how-to-install-the-sdk) ------------------------------------------------------------------------------------------------------------------ This package has [ethers v6](https://docs.ethers.io/v6/) as a peer dependency. See the [`OrderBuilder`](https://github.com/PredictDotFun/sdk/blob/main/src/OrderBuilder.ts) class for more in-depth details on each function. Predict Account[#](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0#predict-account) ---------------------------------------------------------------------------------------------------- Predict supports interacting with the protocol using either a traditional Externally Owned Account (EOA) or a Smart Wallet ("Predict Account"). If you use the web app, a Smart Wallet is automatically created for you. To interact with your Smart Wallet programmatically using the SDK, follow the example shown in [How to use a Predict account](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#how-to-use-a-predict-account) . How to set approvals[#](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0#how-to-set-approvals) -------------------------------------------------------------------------------------------------------------- Before trading, you need to set approvals for ERC-1155 (`ConditionalTokens`) and ERC-20 (`USDT`). This can be achieved by sending a transaction to the respective contracts and approving both the `CTF_EXCHANGE` and the `NEG_RISK_CTF_EXCHANGE` or via the SDK utils. **Contracts**: The current deployed contracts can be found either in the [`Constants.ts`](https://github.com/PredictDotFun/sdk/blob/main/src/Constants.ts#32) file or in the [Deployed Contracts](https://docs.predict.fun/developers/deployed-contracts) documentation. The following example demonstrates how to set the necessary approvals using the SDK utils. How to use a Predict account[#](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0#how-to-use-a-predict-account) ------------------------------------------------------------------------------------------------------------------------------ Here's an example of how to use a Predict account to create/cancel orders and set approvals. 1. **Initiate the Privy Wallet**: The wallet is needed to sign orders. Can be found in the [account settings](https://predict.fun/account/settings) . 2. **Ensure the Privy Wallet has funds**: You will need to add some BNB to be able to set approvals and cancel orders, if needed. 3. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling `OrderBuilder.make`. NOTE: Include the `predictAccount` address, which is also known as the deposit address. 4. **Set Approvals**: Ensure the necessary approvals are set (refer to [Set Approvals](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#set-approvals) ). 5. **Determine Order Amounts**: Use `getLimitOrderAmounts` to calculate order amounts. 6. **Build Order**: Use `buildOrder` to generate a `LIMIT` strategy order. NOTE: Fetch the `feeRateBps` via the `GET /markets` endpoint on the REST API NOTE: Set the `signer` and `maker` to the `predictAccount` address, **NOT** the signer/privy wallet address. 7. **Generate Typed Data**: Call `buildTypedData` to generate typed data for the order. 8. **Sign Order**: Obtain a `SignedOrder` object by calling `signTypedDataOrder`. 9. **Compute Order Hash**: Compute the order hash using `buildTypedDataHash`. This will allow you to perform operations via your Predict Account (via the smart wallet). How to create a LIMIT order _(recommended)_[#](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0#how-to-create-a-limit-order-recommended) -------------------------------------------------------------------------------------------------------------------------------------------------------- Here's an example of how to use the OrderBuilder to create and sign a `LIMIT` strategy buy order: 1. **Create Wallet**: The wallet is needed to sign orders. 2. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling `OrderBuilder.make`. 3. **Set Approvals**: Ensure the necessary approvals are set (refer to [Set Approvals](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#set-approvals) ). 4. **Determine Order Amounts**: Use `getLimitOrderAmounts` to calculate order amounts. 5. **Build Order**: Use `buildOrder` to generate a `LIMIT` strategy order. NOTE: Fetch the `feeRateBps` via the `GET /markets` endpoint on the REST API 6. **Generate Typed Data**: Call `buildTypedData` to generate typed data for the order. 7. **Sign Order**: Obtain a `SignedOrder` object by calling `signTypedDataOrder`. 8. **Compute Order Hash**: Compute the order hash using `buildTypedDataHash`. How to create a MARKET order[#](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0#how-to-create-a-market-order) ------------------------------------------------------------------------------------------------------------------------------ Similarly to the above, here's the flow to create a `MARKET` sell order: 1. **Create Wallet**: The wallet is needed to sign orders. 2. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling `OrderBuilder.make`. 3. **Set Approvals**: Ensure the necessary approvals are set (refer to [Set Approvals](https://dev.predict.fun/apidoc/how-to-create-or-cancel-orders-679306m0#set-approvals) ). 4. **Fetch Orderbook**: Query the Predict API for the latest orderbook for the market. 5. **Determine Order Amounts**: Use `getMarketOrderAmounts` to calculate order amounts. 6. **Build Order**: Call `buildOrder` to generate a `MARKET` strategy order. NOTE: Fetch the `feeRateBps` via the `GET /markets` endpoint on the REST API 7. **Generate Typed Data**: Use `buildTypedData` to create typed data for the order. 8. **Sign Order**: Obtain a `SignedOrder` object by calling `signTypedDataOrder`. 9. **Compute Order Hash**: Compute the order hash using `buildTypedDataHash`. How to redeem positions[#](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0#how-to-redeem-positions) -------------------------------------------------------------------------------------------------------------------- The `OrderBuilder` class provides the `redeemPositions` method to redeem your positions on the Predict protocol. The method supports all market types through the `isNegRisk` and `isYieldBearing` options. 1. **Create a Wallet**: Initialize a wallet that will be used to sign the redemption transaction. 2. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling the static `make` method. 3. **Redeem Positions**: Call the `redeemPositions` method with the appropriate options. The `conditionId` and `indexSet` can be fetched from the `GET /positions` endpoint. How to merge positions[#](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0#how-to-merge-positions) ------------------------------------------------------------------------------------------------------------------ The `OrderBuilder` class provides the `mergePositions` method to combine both outcome tokens back into collateral (USDT). This is useful when you hold equal amounts of both YES and NO positions. 1. **Create a Wallet**: Initialize a wallet that will be used to sign the merge transaction. 2. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling the static `make` method. 3. **Merge Positions**: Call the `mergePositions` method with the appropriate options. The `conditionId` can be fetched from the `GET /positions` endpoint. How to check USDT balance[#](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0#how-to-check-usdt-balance) ------------------------------------------------------------------------------------------------------------------------ The method `balanceOf` allows to easily check the current USDT balance of the connected signer. How to interface with contracts[#](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0#how-to-interface-with-contracts) ------------------------------------------------------------------------------------------------------------------------------------ To facilitate interactions with Predict's contracts we expose the necessary instances of each contract, including ABIs and types. Some other useful utils, ABIs and types exposed by the SDK. How to cancel orders[#](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0#how-to-cancel-orders) -------------------------------------------------------------------------------------------------------------- Here's an example on how to cancel orders via the SDK 1. **Fetch Orders**: Retrieve your open orders using `GET /orders`. 2. **Group by `isNegRisk` and `isYieldBearing`**: Separate orders based on the `isNegRisk` and `isYieldBearing` properties. 3. **Cancel Orders**: Call the cancel function and provide the orders to cancel and the `isNegRisk` and `isYieldBearing` properties. 4. **Check Transaction Success**: Check to confirm the transaction was successful. License[#](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0#license) ------------------------------------------------------------------------------------ By contributing to this project, you agree that your contributions will be licensed under the project's [MIT License](https://dev.predict.fun/LICENSE) . Modified at 2025-12-19 11:31:41 [Previous\ \ \[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) [Next\ \ General Information](https://dev.predict.fun/general-information-1915499m0) --- # Response Format - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0 "General Information") * [Request Format](https://dev.predict.fun/request-format-1915501m0 "Request Format") * [Response Format](https://dev.predict.fun/response-format-1915502m0 "Response Format") * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0 "Subscription Topics") * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0 "Heartbeats") * [Client Example](https://dev.predict.fun/client-example-1915523m0 "Client Example") * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Copy Page Response Format =============== WebSockets[#](https://dev.predict.fun/response-format-1915502m0#websockets) ============================================================================ This document provides a comprehensive guide to the WebSocket API exposed by predict.fun. Connection Details[#](https://dev.predict.fun/response-format-1915502m0#connection-details) -------------------------------------------------------------------------------------------- **Protocol**: `wss` (or `ws` for local development) **Endpoint**: Base URL of the service. **Heartbeat Interval**: 15 seconds. * * * Message Protocol[#](https://dev.predict.fun/response-format-1915502m0#message-protocol) ---------------------------------------------------------------------------------------- The API uses a JSON-based protocol with specific message structures for client requests and server responses. ### Base Message Structure (Client to Server)[#](https://dev.predict.fun/response-format-1915502m0#base-message-structure-client-to-server) All client requests must follow this format: { "method": "subscribe" | "unsubscribe" | "heartbeat", "requestId": number, "params": string[], "data": any } | Field | Type | Required | Description | | --- | --- | --- | --- | | `method` | string | Yes | The action to perform: `subscribe`, `unsubscribe`, or `heartbeat`. | | `requestId` | number | Conditional | A unique, non-negative integer to track request responses. Required for `subscribe` and `unsubscribe`. | | `params` | string\[\] | Conditional | An array containing the topic string(s). Required for `subscribe` and `unsubscribe`. | | `data` | any | Conditional | Payload for the method. Required for `heartbeat` (must be the timestamp received from server). | ### Base Message Structure (Server to Client)[#](https://dev.predict.fun/response-format-1915502m0#base-message-structure-server-to-client) The server sends two types of messages: **Responses (R)** to client requests and **Messages (M)** which are push notifications (subscriptions). #### Request Response (Type R)[#](https://dev.predict.fun/response-format-1915502m0#request-response-type-r) { "type": "R", "requestId": number, "success": boolean, "data": any, "error": { "code": string, "message": string } } | Field | Type | Description | | --- | --- | --- | | `type` | string | Always `"R"` for request responses. | | `requestId` | number | Matches the `requestId` from the client's request. | | `success` | boolean | Indicates if the request was successful. | | `data` | any | Response data (usually `null` for subscriptions). | | `error` | object | Present only if `success` is `false`. | #### Push Message (Type M)[#](https://dev.predict.fun/response-format-1915502m0#push-message-type-m) { "type": "M", "topic": string, "data": any } | Field | Type | Description | | --- | --- | --- | | `type` | string | Always `"M"` for push messages. | | `topic` | string | The topic the message belongs to (e.g., `predictOrderbook/123`). | | `data` | any | The payload for the specific topic. | * * * Heartbeat Mechanism[#](https://dev.predict.fun/response-format-1915502m0#heartbeat-mechanism) ---------------------------------------------------------------------------------------------- To maintain an active connection, the server implements a heartbeat mechanism. 1. **Server Probe**: Every 15 seconds, the server sends: { "type": "M", "topic": "heartbeat", "data": 1736696400000 } 2. **Client Response**: The client must respond within the next 15 seconds with: { "method": "heartbeat", "data": 1736696400000 } _Note: The `data` value must match the timestamp received from the server._ Failure to respond to the heartbeat will result in the server terminating the connection. * * * Subscription Topics[#](https://dev.predict.fun/response-format-1915502m0#subscription-topics) ---------------------------------------------------------------------------------------------- Topics are formatted as `topicName/parameter`. ### 1\. Predict Orderbook[#](https://dev.predict.fun/response-format-1915502m0#1-predict-orderbook) Live updates for a specific market's orderbook. **Topic**: `predictOrderbook/{marketId}` **Payload**: Orderbook data (JSON). ### 2\. Asset Price Update[#](https://dev.predict.fun/response-format-1915502m0#2-asset-price-update) Real-time price updates for a specific price feed. **Topic**: `assetPriceUpdate/{priceFeedId}` **Payload**: { "price": number, "publishTime": number, "timestamp": number } ### 3\. Predict Wallet Events (Authenticated)[#](https://dev.predict.fun/response-format-1915502m0#3-predict-wallet-events-authenticated) Live events specific to a user's wallet. Requires a valid JWT. **Topic**: `predictWalletEvents/{jwt}` **Payload**: One of several wallet event types. **Event Types**: `orderAccepted`: Order successfully placed in orderbook. `orderNotAccepted`: Order rejected (e.g., duplicate). `orderExpired`: Order reached its end time. `orderCancelled`: User cancelled the order. `orderTransactionSubmitted`: Order matched, transaction sent to blockchain. `orderTransactionSuccess`: On-chain transaction succeeded. `orderTransactionFailed`: On-chain transaction failed. * * * Error Codes[#](https://dev.predict.fun/response-format-1915502m0#error-codes) ------------------------------------------------------------------------------ | Code | Description | | --- | --- | | `invalid_json` | The message sent by the client is not valid JSON. | | `invalid_topic` | The requested topic is malformed or unknown. | | `invalid_credentials` | (Wallet events) The provided JWT is invalid or expired. | | `internal_server_error` | An unexpected error occurred on the server. | | `unsupported_contract` | The requested market/contract is not supported. | Modified at 2026-01-16 11:15:30 [Previous\ \ Request Format](https://dev.predict.fun/request-format-1915501m0) [Next\ \ Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) --- # [PY] How to authenticate your API requests - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0 "Understanding the Orderbook") * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0 "[TS] How to authenticate your API requests") * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0 "[PY] How to authenticate your API requests") * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0 "How to create or cancel orders") * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Copy Page \[PY\] How to authenticate your API requests ============================================ Authentication Guide[#](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0#authentication-guide) ========================================================================================================================= Authentication with API Key and JWT Token[#](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0#authentication-with-api-key-and-jwt-token) ------------------------------------------------------------------------------------------------------------------------------------------------------------------- To interact with Predict's API, you'll need two things: 1. **API Key**: Required for all endpoints (only on Mainnet). 2. **JWT Token**: Required for performing personal operations for a specific wallet (e.g., sending a new order or viewing active orders). **Sections**: [**Obtaining a JWT Token _(for EOAs)_**](https://dev.predict.fun/apidoc/py-how-to-authenticate-your-api-requests-1868364m0#obtaining-a-jwt-token-for-eoas) [**Obtaining a JWT Token _(for Predict accounts)_**](https://dev.predict.fun/apidoc/py-how-to-authenticate-your-api-requests-1868364m0#obtaining-a-jwt-token-for-predict-accounts) [**Passing the API Key and JWT Token in the requests**](https://dev.predict.fun/apidoc/py-how-to-authenticate-your-api-requests-1868364m0#passing-the-api-key-and-jwt-token-in-requests) * * * Obtaining a JWT Token _(for Predict accounts)_[#](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0#obtaining-a-jwt-token-for-predict-accounts) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- An API key is required to obtain a JWT token. Follow these steps to generate a JWT token for your wallet: 1. **Retrieve the message to sign**: Send a `GET` request to `/v1/auth/message` to retrieve a message for signing. 2. **Sign the message with your wallet via our SDK**: You will need two wallets: Your Predict account address (aka deposit address) Your Privy Wallet private key (can be exported from the account's settings) **NOTE**: It's recommended to fund your Privy Wallet with BNB to be able to set approvals and cancel orders. 3. **Send the signature**: Send a `POST` request to `/v1/auth` with the following JSON structure: * * * Obtaining a JWT Token _(for EOAs)_[#](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0#obtaining-a-jwt-token-for-eoas) ------------------------------------------------------------------------------------------------------------------------------------------------- An API key is required to obtain a JWT token. Follow these steps to generate a JWT token for your wallet: 1. **Retrieve the message to sign**: Send a `GET` request to `/v1/auth/message` to retrieve a message for signing. 2. **Sign the message with your wallet**: Use the wallet you want to authenticate with to sign the message retrieved in step 1. 3. **Send the signature**: Send a `POST` request to `/v1/auth` with the following JSON structure: * * * Passing the API Key and JWT Token in Requests[#](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0#passing-the-api-key-and-jwt-token-in-requests) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- To authenticate your requests, you need to include both the API key and the JWT token in the request headers. **The API key and `x-api-key` header are not required on Testnet**. Request headers: Example usage: Modified at 2025-12-17 15:20:06 [Previous\ \ \[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) [Next\ \ How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) --- # Subscription Topics - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0 "General Information") * [Request Format](https://dev.predict.fun/request-format-1915501m0 "Request Format") * [Response Format](https://dev.predict.fun/response-format-1915502m0 "Response Format") * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0 "Subscription Topics") * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0 "Heartbeats") * [Client Example](https://dev.predict.fun/client-example-1915523m0 "Client Example") * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Copy Page Subscription Topics =================== Subscription Topics[#](https://dev.predict.fun/subscription-topics-1915507m0#subscription-topics) ================================================================================================== Topics are formatted as `topicName/parameter`. ### 1\. Predict Orderbook[#](https://dev.predict.fun/subscription-topics-1915507m0#1-predict-orderbook) Live updates for a specific market's orderbook. **Topic**: `predictOrderbook/{marketId}` **Payload**: Orderbook data (JSON). ### 2\. Asset Price Update[#](https://dev.predict.fun/subscription-topics-1915507m0#2-asset-price-update) Real-time price updates for a specific price feed. **Topic**: `assetPriceUpdate/{priceFeedId}` **Payload**: { "price": number, "publishTime": number, "timestamp": number } ### 3\. Predict Wallet Events (Authenticated)[#](https://dev.predict.fun/subscription-topics-1915507m0#3-predict-wallet-events-authenticated) Live events specific to a user's wallet. Requires a valid JWT. **Topic**: `predictWalletEvents/{jwt}` **Payload**: One of several wallet event types. **Event Types**: `orderAccepted`: Order successfully placed in orderbook. `orderNotAccepted`: Order rejected (e.g., duplicate). `orderExpired`: Order reached its end time. `orderCancelled`: User cancelled the order. `orderTransactionSubmitted`: Order matched, transaction sent to blockchain. `orderTransactionSuccess`: On-chain transaction succeeded. `orderTransactionFailed`: On-chain transaction failed. Modified at 2026-01-16 11:12:36 [Previous\ \ Response Format](https://dev.predict.fun/response-format-1915502m0) [Next\ \ Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) --- # Get markets - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get markets =========== Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/markets Try itRun in Apidog Run in Apidog Get information about markets Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Query Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/markets?first&after&isBoosted&status&tagIds&marketVariant&sort' \ --header 'x-api-key: ' Response Response Example { "success": true, "cursor": "string", "data": [\ {\ "id": 0,\ "imageUrl": "string",\ "title": "string",\ "question": "string",\ "description": "string",\ "status": "REGISTERED",\ "isNegRisk": true,\ "isYieldBearing": true,\ "feeRateBps": 0,\ "resolution": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "oracleQuestionId": "string",\ "conditionId": "string",\ "resolverAddress": "string",\ "outcomes": [\ {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ }\ ],\ "questionIndex": 0,\ "spreadThreshold": 0,\ "shareThreshold": 0,\ "isBoosted": true,\ "boostStartsAt": "string",\ "boostEndsAt": "string",\ "polymarketConditionIds": [\ "string"\ ],\ "kalshiMarketTicker": "string",\ "categorySlug": "string",\ "createdAt": "string",\ "decimalPrecision": 2,\ "marketVariant": "DEFAULT",\ "variantData": {\ "type": "CRYPTO_UP_DOWN",\ "startPrice": 0,\ "endPrice": 0,\ "priceFeedId": "string"\ }\ }\ ] } Modified at 2026-01-31 16:05:09 [Previous\ \ Get all tags](https://dev.predict.fun/get-all-tags-27399809e0) [Next\ \ Get market by ID](https://dev.predict.fun/get-market-by-id-25552989e0) --- # Get all tags - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get all tags ============ Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/tags Try itRun in Apidog Run in Apidog Get all tags that have at least one visible category Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/tags' \ --header 'x-api-key: ' Response Response Example { "success": true, "data": [\ {\ "id": "string",\ "name": "string"\ }\ ] } Modified at 2026-01-31 16:05:09 [Previous\ \ Get category by slug](https://dev.predict.fun/get-category-by-slug-25326911e0) [Next\ \ Get markets](https://dev.predict.fun/get-markets-25326905e0) --- # Heartbeats - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0 "General Information") * [Request Format](https://dev.predict.fun/request-format-1915501m0 "Request Format") * [Response Format](https://dev.predict.fun/response-format-1915502m0 "Response Format") * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0 "Subscription Topics") * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0 "Heartbeats") * [Client Example](https://dev.predict.fun/client-example-1915523m0 "Client Example") * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Copy Page Heartbeats ========== Heartbeat Mechanism[#](https://dev.predict.fun/heartbeats-1915508m0#heartbeat-mechanism) ----------------------------------------------------------------------------------------- To maintain an active connection, the server implements a heartbeat mechanism. 1. **Server Probe**: Every 15 seconds, the server sends: { "type": "M", "topic": "heartbeat", "data": 1736696400000 } 2. **Client Response**: The client must respond within the next 15 seconds with: { "method": "heartbeat", "data": 1736696400000 } _Note: The `data` value must match the timestamp received from the server._ Failure to respond to the heartbeat will result in the server terminating the connection. Modified at 2026-01-12 15:31:00 [Previous\ \ Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) [Next\ \ Client Example](https://dev.predict.fun/client-example-1915523m0) --- # Get market by ID - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get market by ID ================ Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/markets/{id} Try itRun in Apidog Run in Apidog Get detailed information about a specific market by its ID Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Path Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/markets/' \ --header 'x-api-key: ' Response Response Example { "success": true, "data": { "id": 0, "imageUrl": "string", "title": "string", "question": "string", "description": "string", "status": "REGISTERED", "isNegRisk": true, "isYieldBearing": true, "feeRateBps": 0, "resolution": { "name": "string", "indexSet": 0, "onChainId": "string", "status": "WON" }, "oracleQuestionId": "string", "conditionId": "string", "resolverAddress": "string", "outcomes": [\ {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ }\ ], "questionIndex": 0, "spreadThreshold": 0, "shareThreshold": 0, "isBoosted": true, "boostStartsAt": "string", "boostEndsAt": "string", "polymarketConditionIds": [\ "string"\ ], "kalshiMarketTicker": "string", "categorySlug": "string", "createdAt": "string", "decimalPrecision": 2, "marketVariant": "DEFAULT", "variantData": { "type": "CRYPTO_UP_DOWN", "startPrice": 0, "endPrice": 0, "priceFeedId": "string" } } } Modified at 2026-01-31 16:05:09 [Previous\ \ Get markets](https://dev.predict.fun/get-markets-25326905e0) [Next\ \ Get market statistics](https://dev.predict.fun/get-market-statistics-25326906e0) --- # Get the orderbook for a market - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get the orderbook for a market ============================== Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/markets/{id}/orderbook Try itRun in Apidog Run in Apidog **The order book stores prices based on the `Yes` outcome.** See [Understanding the Orderbook](https://dev.predict.fun/doc-685654) for calculating the `No` outcome price. Provide marketId and get orderbook for that specific market Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Path Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/markets//orderbook' \ --header 'x-api-key: ' Response Response Example { "success": true, "data": { "marketId": 0, "updateTimestampMs": 0, "lastOrderSettled": { "id": "string", "price": "string", "kind": "string", "marketId": 0, "side": "Ask", "outcome": "Yes" }, "asks": [\ [\ 0\ ]\ ], "bids": [\ [\ 0\ ]\ ] } } Modified at 2026-01-31 16:05:09 [Previous\ \ Get market last sale information](https://dev.predict.fun/get-market-last-sale-information-25326907e0) [Next\ \ Get order by hash](https://dev.predict.fun/get-order-by-hash-25326901e0) --- # Get order by hash - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get order by hash ================= Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/orders/{hash} Try itRun in Apidog Run in Apidog Get the order information for one of your own orders by its hash Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or JWT Bearer Add the parameter Authorization to Headers Example: `Authorization: ********************` or Path Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/orders/' \ --header 'x-api-key: ' Response Response Example { "success": true, "data": { "order": { "hash": "string", "salt": "string", "maker": "string", "signer": "string", "taker": "0x0000000000000000000000000000000000000000", "tokenId": "string", "makerAmount": "string", "takerAmount": "string", "expiration": "string", "nonce": "string", "feeRateBps": "string", "side": 0, "signatureType": 0, "signature": "string" }, "id": "string", "marketId": 0, "currency": "string", "amount": "string", "amountFilled": "string", "isNegRisk": true, "isYieldBearing": true, "strategy": "LIMIT", "status": "OPEN", "rewardEarningRate": 0 } } Modified at 2026-01-31 16:05:09 [Previous\ \ Get the orderbook for a market](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0) [Next\ \ Get orders](https://dev.predict.fun/get-orders-25326902e0) --- # Get market statistics - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get market statistics ===================== Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/markets/{id}/stats Try itRun in Apidog Run in Apidog Get statistics about a specific market Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Path Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/markets//stats' \ --header 'x-api-key: ' Response Response Example { "success": true, "data": { "totalLiquidityUsd": 0, "volumeTotalUsd": 0, "volume24hUsd": 0 } } Modified at 2026-01-31 16:05:09 [Previous\ \ Get market by ID](https://dev.predict.fun/get-market-by-id-25552989e0) [Next\ \ Get market last sale information](https://dev.predict.fun/get-market-last-sale-information-25326907e0) --- # Create an order - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Create an order =============== Prod Env https://api.predict.fun Prod Env https://api.predict.fun POST https://api.predict.fun /v1/orders Try itRun in Apidog Run in Apidog Create a LIMIT or MARKET order for the authenticated user Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or JWT Bearer Add the parameter Authorization to Headers Example: `Authorization: ********************` or Body Params application/jsonRequired Generate Code Examples Responses --------- 🟢201 application/json Response 201 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request POST 'https://api.predict.fun/v1/orders' \ --header 'x-api-key: ' \ --header 'Content-Type: application/json' \ --data-raw '{ "data": { "pricePerShare": "string", "strategy": "LIMIT", "slippageBps": "string", "isFillOrKill": true, "order": { "hash": "string", "salt": "string", "maker": "string", "signer": "string", "taker": "0x0000000000000000000000000000000000000000", "tokenId": "string", "makerAmount": "string", "takerAmount": "string", "expiration": "string", "nonce": "string", "feeRateBps": "string", "side": 0, "signatureType": 0, "signature": "string" } } }' Response Response Example { "success": true, "data": { "code": "OK", "orderId": "string", "orderHash": "string" } } Modified at 2026-01-31 16:05:09 [Previous\ \ Get order match events](https://dev.predict.fun/get-order-match-events-25663812e0) [Next\ \ Remove orders from the orderbook](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0) --- # Remove orders from the orderbook - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Remove orders from the orderbook ================================ Prod Env https://api.predict.fun Prod Env https://api.predict.fun POST https://api.predict.fun /v1/orders/remove Try itRun in Apidog Run in Apidog Remove orders from the orderbook for the JWT signer. **Important:** This will not cancel the order on-chain, you should also cancel the order on-chain as outlined in the documentation. This endpoint allows you to cancel orders fast and batch the on-chain cancellation of orders later. You can also just cancel the order on-chain directly (recommended for most use cases). By using this endpoint, you acknowledge that you understand and accept all the potential risks associated with not invalidating an order on-chain. Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or JWT Bearer Add the parameter Authorization to Headers Example: `Authorization: ********************` or Body Params application/jsonRequired Generate Code Examples Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request POST 'https://api.predict.fun/v1/orders/remove' \ --header 'x-api-key: ' \ --header 'Content-Type: application/json' \ --data-raw '{ "data": { "ids": [\ "string"\ ] } }' Response Response Example { "success": true, "removed": [\ "string"\ ], "noop": [\ "string"\ ] } Modified at 2026-01-31 16:05:09 [Previous\ \ Create an order](https://dev.predict.fun/create-an-order-25326903e0) [Next\ \ Get connected account](https://dev.predict.fun/get-connected-account-25326917e0) --- # Get orders - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get orders ========== Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/orders Try itRun in Apidog Run in Apidog Get a list of your own orders Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or JWT Bearer Add the parameter Authorization to Headers Example: `Authorization: ********************` or Query Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/orders?first&after&status' \ --header 'x-api-key: ' Response Response Example { "success": true, "cursor": "string", "data": [\ {\ "order": {\ "hash": "string",\ "salt": "string",\ "maker": "string",\ "signer": "string",\ "taker": "0x0000000000000000000000000000000000000000",\ "tokenId": "string",\ "makerAmount": "string",\ "takerAmount": "string",\ "expiration": "string",\ "nonce": "string",\ "feeRateBps": "string",\ "side": 0,\ "signatureType": 0,\ "signature": "string"\ },\ "id": "string",\ "marketId": 0,\ "currency": "string",\ "amount": "string",\ "amountFilled": "string",\ "isNegRisk": true,\ "isYieldBearing": true,\ "strategy": "LIMIT",\ "status": "OPEN",\ "rewardEarningRate": 0\ }\ ] } Modified at 2026-01-31 16:05:09 [Previous\ \ Get order by hash](https://dev.predict.fun/get-order-by-hash-25326901e0) [Next\ \ Get order match events](https://dev.predict.fun/get-order-match-events-25663812e0) --- # Get market last sale information - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get market last sale information ================================ Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/markets/{id}/last-sale Try itRun in Apidog Run in Apidog Get the last sale information for a specific market Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Path Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/markets//last-sale' \ --header 'x-api-key: ' Response Response Example { "success": true, "data": { "quoteType": "Ask", "outcome": "Yes", "priceInCurrency": "string", "strategy": "MARKET" } } Modified at 2026-01-31 16:05:09 [Previous\ \ Get market statistics](https://dev.predict.fun/get-market-statistics-25326906e0) [Next\ \ Get the orderbook for a market](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0) --- # Get order match events - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get order match events ====================== Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/orders/matches Try itRun in Apidog Run in Apidog Get a paginated list of order match events with optional filtering by category, market, minimum value and signer. The results are sorted by `executedAt DESC`. Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Query Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/orders/matches?first&after&categoryId&marketId&minValueUsdtWei&signerAddress&isSignerMaker' \ --header 'x-api-key: ' Response Response Example { "success": true, "cursor": "string", "data": [\ {\ "market": {\ "id": 0,\ "imageUrl": "string",\ "title": "string",\ "question": "string",\ "description": "string",\ "status": "REGISTERED",\ "isNegRisk": true,\ "isYieldBearing": true,\ "feeRateBps": 0,\ "resolution": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "oracleQuestionId": "string",\ "conditionId": "string",\ "resolverAddress": "string",\ "outcomes": [\ {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ }\ ],\ "questionIndex": 0,\ "spreadThreshold": 0,\ "shareThreshold": 0,\ "isBoosted": true,\ "boostStartsAt": "string",\ "boostEndsAt": "string",\ "polymarketConditionIds": [\ "string"\ ],\ "kalshiMarketTicker": "string",\ "categorySlug": "string",\ "createdAt": "string",\ "decimalPrecision": 2,\ "marketVariant": "DEFAULT",\ "variantData": {\ "type": "CRYPTO_UP_DOWN",\ "startPrice": 0,\ "endPrice": 0,\ "priceFeedId": "string"\ }\ },\ "taker": {\ "quoteType": "Ask",\ "amount": "string",\ "price": "string",\ "outcome": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "signer": "string",\ "fee": {\ "amount": "string",\ "type": "COLLATERAL"\ }\ },\ "amountFilled": "string",\ "priceExecuted": "string",\ "makers": [\ {\ "quoteType": "Ask",\ "amount": "string",\ "price": "string",\ "outcome": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "signer": "string",\ "fee": {\ "amount": "string",\ "type": "COLLATERAL"\ }\ }\ ],\ "transactionHash": "string",\ "executedAt": "string"\ }\ ] } Modified at 2026-01-31 16:05:09 [Previous\ \ Get orders](https://dev.predict.fun/get-orders-25326902e0) [Next\ \ Create an order](https://dev.predict.fun/create-an-order-25326903e0) --- # Get account activity - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get account activity ==================== Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/account/activity Try itRun in Apidog Run in Apidog Get a paginated list of trading activity including orders, matches, conversions, merges, and splits for the authenticated user Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or JWT Bearer Add the parameter Authorization to Headers Example: `Authorization: ********************` or Query Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/account/activity?first&after' \ --header 'x-api-key: ' Response Response Example { "success": true, "cursor": "string", "data": [\ {\ "name": "CREATE",\ "createdAt": "string",\ "transactionHash": "string",\ "amountFilled": "string",\ "priceExecuted": "string",\ "order": {\ "quoteType": "Ask",\ "amount": "string",\ "price": "string",\ "fee": {\ "amount": "string",\ "type": "COLLATERAL"\ }\ },\ "market": {\ "id": 0,\ "imageUrl": "string",\ "title": "string",\ "question": "string",\ "description": "string",\ "status": "REGISTERED",\ "isNegRisk": true,\ "isYieldBearing": true,\ "feeRateBps": 0,\ "resolution": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "oracleQuestionId": "string",\ "conditionId": "string",\ "resolverAddress": "string",\ "outcomes": [\ {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ }\ ],\ "questionIndex": 0,\ "spreadThreshold": 0,\ "shareThreshold": 0,\ "isBoosted": true,\ "boostStartsAt": "string",\ "boostEndsAt": "string",\ "polymarketConditionIds": [\ "string"\ ],\ "kalshiMarketTicker": "string",\ "categorySlug": "string",\ "createdAt": "string",\ "decimalPrecision": 2,\ "marketVariant": "DEFAULT",\ "variantData": {\ "type": "CRYPTO_UP_DOWN",\ "startPrice": 0,\ "endPrice": 0,\ "priceFeedId": "string"\ }\ },\ "outcome": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ }\ }\ ] } Modified at 2026-01-31 16:05:09 [Previous\ \ Get connected account](https://dev.predict.fun/get-connected-account-25326917e0) [Next\ \ Set a referral](https://dev.predict.fun/set-a-referral-25326918e0) --- # Get connected account - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get connected account ===================== Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/account Try itRun in Apidog Run in Apidog Get information for the connected user account Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or JWT Bearer Add the parameter Authorization to Headers Example: `Authorization: ********************` or Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/account' \ --header 'x-api-key: ' Response Response Example { "success": true, "data": { "name": "string", "address": "string", "imageUrl": "string", "referral": { "code": "string", "status": "LOCKED" }, "points": { "total": 0 } } } Modified at 2026-01-31 16:05:09 [Previous\ \ Remove orders from the orderbook](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0) [Next\ \ Get account activity](https://dev.predict.fun/get-account-activity-26651508e0) --- # Get positions - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get positions ============= Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/positions Try itRun in Apidog Run in Apidog Get data about your positions Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or JWT Bearer Add the parameter Authorization to Headers Example: `Authorization: ********************` or Query Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/positions?first&after' \ --header 'x-api-key: ' Response Response Example { "success": true, "cursor": "string", "data": [\ {\ "id": "string",\ "market": {\ "id": 0,\ "imageUrl": "string",\ "title": "string",\ "question": "string",\ "description": "string",\ "status": "REGISTERED",\ "isNegRisk": true,\ "isYieldBearing": true,\ "feeRateBps": 0,\ "resolution": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "oracleQuestionId": "string",\ "conditionId": "string",\ "resolverAddress": "string",\ "outcomes": [\ {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ }\ ],\ "questionIndex": 0,\ "spreadThreshold": 0,\ "shareThreshold": 0,\ "isBoosted": true,\ "boostStartsAt": "string",\ "boostEndsAt": "string",\ "polymarketConditionIds": [\ "string"\ ],\ "kalshiMarketTicker": "string",\ "categorySlug": "string",\ "createdAt": "string",\ "decimalPrecision": 2,\ "marketVariant": "DEFAULT",\ "variantData": {\ "type": "CRYPTO_UP_DOWN",\ "startPrice": 0,\ "endPrice": 0,\ "priceFeedId": "string"\ }\ },\ "outcome": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "amount": "string",\ "valueUsd": "string"\ }\ ] } Modified at 2026-01-31 16:05:09 [Previous\ \ Set a referral](https://dev.predict.fun/set-a-referral-25326918e0) [Next\ \ Get positions by address](https://dev.predict.fun/get-positions-by-address-27399808e0) --- # Unknown \# Predict API (Beta) ## Docs - \[Developer Documentation - Predict API\](https://dev.predict.fun/faqs-684248m0.md): - \[ Deployed Contracts\](https://dev.predict.fun/-deployed-contracts-1860295m0.md): - Guides \[Understanding the Orderbook\](https://dev.predict.fun/understanding-the-orderbook-685654m0.md): - Guides \[\[TS\] How to authenticate your API requests\](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0.md): - Guides \[\[PY\] How to authenticate your API requests\](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0.md): - Guides \[How to create or cancel orders\](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0.md): - WebSocket \[General Information\](https://dev.predict.fun/general-information-1915499m0.md): - WebSocket \[Request Format\](https://dev.predict.fun/request-format-1915501m0.md): - WebSocket \[Response Format\](https://dev.predict.fun/response-format-1915502m0.md): - WebSocket \[Subscription Topics\](https://dev.predict.fun/subscription-topics-1915507m0.md): - WebSocket \[Heartbeats\](https://dev.predict.fun/heartbeats-1915508m0.md): - WebSocket \[Client Example\](https://dev.predict.fun/client-example-1915523m0.md): ## API Docs - Authorization \[Get auth message\](https://dev.predict.fun/get-auth-message-25326899e0.md): Get the message to sign to generate a JWT token. - Authorization \[Get JWT with valid signature\](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0.md): Provide a signature and get back a valid JWT that allows order actions - Categories \[Get categories\](https://dev.predict.fun/get-categories-25326910e0.md): :::info - Categories \[Get category by slug\](https://dev.predict.fun/get-category-by-slug-25326911e0.md): Get category information and its markets by slug - Categories \[Get all tags\](https://dev.predict.fun/get-all-tags-27399809e0.md): Get all tags that have at least one visible category - Markets \[Get markets\](https://dev.predict.fun/get-markets-25326905e0.md): Get information about markets - Markets \[Get market by ID\](https://dev.predict.fun/get-market-by-id-25552989e0.md): Get detailed information about a specific market by its ID - Markets \[Get market statistics\](https://dev.predict.fun/get-market-statistics-25326906e0.md): Get statistics about a specific market - Markets \[Get market last sale information\](https://dev.predict.fun/get-market-last-sale-information-25326907e0.md): Get the last sale information for a specific market - Markets \[Get the orderbook for a market\](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0.md): :::info\[\] - Orders \[Get order by hash\](https://dev.predict.fun/get-order-by-hash-25326901e0.md): Get the order information for one of your own orders by its hash - Orders \[Get orders\](https://dev.predict.fun/get-orders-25326902e0.md): Get a list of your own orders - Orders \[Get order match events\](https://dev.predict.fun/get-order-match-events-25663812e0.md): Get a paginated list of order match events with optional filtering by category, market, minimum value and signer. The results are sorted by \`executedAt DESC\`. - Orders \[Create an order\](https://dev.predict.fun/create-an-order-25326903e0.md): Create a LIMIT or MARKET order for the authenticated user - Orders \[Remove orders from the orderbook\](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0.md): Remove orders from the orderbook for the JWT signer. - Accounts \[Get connected account\](https://dev.predict.fun/get-connected-account-25326917e0.md): Get information for the connected user account - Accounts \[Get account activity\](https://dev.predict.fun/get-account-activity-26651508e0.md): Get a paginated list of trading activity including orders, matches, conversions, merges, and splits for the authenticated user - Accounts \[Set a referral\](https://dev.predict.fun/set-a-referral-25326918e0.md): Set a referral code if not already set - Positions \[Get positions\](https://dev.predict.fun/get-positions-25326909e0.md): Get data about your positions - Positions \[Get positions by address\](https://dev.predict.fun/get-positions-by-address-27399808e0.md): Get positions for a specific wallet address - Search \[Search categories and markets\](https://dev.predict.fun/search-categories-and-markets-27399810e0.md): Full-text search across categories and markets. Returns separate arrays for each type, sorted by relevance. - OAuth \[Finalize a OAuth connection\](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0.md): \[This endpoint is not available for general use\] - OAuth \[Get the orders for a OAuth connection\](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0.md): \[This endpoint is not available for general use\] - OAuth \[Create an order for a OAuth connection\](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0.md): \[This endpoint is not available for general use\] - OAuth \[Cancel the orders for a OAuth connection\](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0.md): \[This endpoint is not available for general use\] - OAuth \[Get the positions for a OAuth connection\](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0.md): \[This endpoint is not available for general use\] --- # Set a referral - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Set a referral ============== Prod Env https://api.predict.fun Prod Env https://api.predict.fun POST https://api.predict.fun /v1/account/referral Try itRun in Apidog Run in Apidog Set a referral code if not already set Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or JWT Bearer Add the parameter Authorization to Headers Example: `Authorization: ********************` or Body Params application/jsonRequired Generate Code Examples Responses --------- 🟢201 application/json Response 201 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request POST 'https://api.predict.fun/v1/account/referral' \ --header 'x-api-key: ' \ --header 'Content-Type: application/json' \ --data-raw '{ "data": { "referralCode": "strin" } }' Response Response Example { "success": true } Modified at 2026-01-31 16:05:09 [Previous\ \ Get account activity](https://dev.predict.fun/get-account-activity-26651508e0) [Next\ \ Get positions](https://dev.predict.fun/get-positions-25326909e0) --- # Client Example - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Ctrl+K * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0 "General Information") * [Request Format](https://dev.predict.fun/request-format-1915501m0 "Request Format") * [Response Format](https://dev.predict.fun/response-format-1915502m0 "Response Format") * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0 "Subscription Topics") * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0 "Heartbeats") * [Client Example](https://dev.predict.fun/client-example-1915523m0 "Client Example") * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Copy Page Client Example ============== Realtime Client Example[#](https://dev.predict.fun/client-example-1915523m0#realtime-client-example) ===================================================================================================== An example implementation of consuming our websocket api with graceful handling of heartbeats, subscribem, and message parsing. Modified at 2026-01-16 11:14:48 [Previous\ \ Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) [Next\ \ Get auth message](https://dev.predict.fun/get-auth-message-25326899e0) --- # Get auth message - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Ctrl+K * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get auth message ================ Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/auth/message Try itRun in Apidog Run in Apidog Get the message to sign to generate a JWT token. Do not hardcode this message as it is dynamic and can be subject to changes. Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/auth/message' \ --header 'x-api-key: ' Response Response Example { "success": true, "data": { "message": "string" } } Modified at 2026-01-31 16:05:09 [Previous\ \ Client Example](https://dev.predict.fun/client-example-1915523m0) [Next\ \ Get JWT with valid signature](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0) --- # Get positions by address - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get positions by address ======================== Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/positions/{address} Try itRun in Apidog Run in Apidog Get positions for a specific wallet address Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Path Params Generate Code Query Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/positions/?first&after' \ --header 'x-api-key: ' Response Response Example { "success": true, "cursor": "string", "data": [\ {\ "id": "string",\ "market": {\ "id": 0,\ "imageUrl": "string",\ "title": "string",\ "question": "string",\ "description": "string",\ "status": "REGISTERED",\ "isNegRisk": true,\ "isYieldBearing": true,\ "feeRateBps": 0,\ "resolution": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "oracleQuestionId": "string",\ "conditionId": "string",\ "resolverAddress": "string",\ "outcomes": [\ {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ }\ ],\ "questionIndex": 0,\ "spreadThreshold": 0,\ "shareThreshold": 0,\ "isBoosted": true,\ "boostStartsAt": "string",\ "boostEndsAt": "string",\ "polymarketConditionIds": [\ "string"\ ],\ "kalshiMarketTicker": "string",\ "categorySlug": "string",\ "createdAt": "string",\ "decimalPrecision": 2,\ "marketVariant": "DEFAULT",\ "variantData": {\ "type": "CRYPTO_UP_DOWN",\ "startPrice": 0,\ "endPrice": 0,\ "priceFeedId": "string"\ }\ },\ "outcome": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "amount": "string",\ "valueUsd": "string"\ }\ ] } Modified at 2026-01-31 16:05:09 [Previous\ \ Get positions](https://dev.predict.fun/get-positions-25326909e0) [Next\ \ Search categories and markets](https://dev.predict.fun/search-categories-and-markets-27399810e0) --- # Get JWT with valid signature - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get JWT with valid signature ============================ Prod Env https://api.predict.fun Prod Env https://api.predict.fun POST https://api.predict.fun /v1/auth Try itRun in Apidog Run in Apidog Provide a signature and get back a valid JWT that allows order actions Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Body Params application/jsonRequired Generate Code Examples Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request POST 'https://api.predict.fun/v1/auth' \ --header 'x-api-key: ' \ --header 'Content-Type: application/json' \ --data-raw '{ "signer": "string", "signature": "string", "message": "string" }' Response Response Example { "success": true, "data": { "token": "string" } } Modified at 2026-01-31 16:05:09 [Previous\ \ Get auth message](https://dev.predict.fun/get-auth-message-25326899e0) [Next\ \ Get categories](https://dev.predict.fun/get-categories-25326910e0) --- # Search categories and markets - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Search categories and markets ============================= Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/search Try itRun in Apidog Run in Apidog Full-text search across categories and markets. Returns separate arrays for each type, sorted by relevance. Default rate limit: 50 RPM Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Query Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/search?query&includeResolved&limit' \ --header 'x-api-key: ' Response Response Example { "success": true, "data": { "categories": [\ {\ "id": 0,\ "slug": "string",\ "title": "string",\ "description": "string",\ "imageUrl": "string",\ "isNegRisk": true,\ "isYieldBearing": true,\ "marketVariant": "DEFAULT",\ "variantData": {\ "type": "CRYPTO_UP_DOWN",\ "startPrice": 0,\ "endPrice": 0,\ "priceFeedId": "string"\ },\ "createdAt": "string",\ "publishedAt": "string",\ "markets": [\ {\ "id": 0,\ "imageUrl": "string",\ "title": "string",\ "question": "string",\ "description": "string",\ "status": "REGISTERED",\ "isNegRisk": true,\ "isYieldBearing": true,\ "feeRateBps": 0,\ "resolution": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "oracleQuestionId": "string",\ "conditionId": "string",\ "resolverAddress": "string",\ "outcomes": [\ {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ }\ ],\ "questionIndex": 0,\ "spreadThreshold": 0,\ "shareThreshold": 0,\ "isBoosted": true,\ "boostStartsAt": "string",\ "boostEndsAt": "string",\ "polymarketConditionIds": [\ "string"\ ],\ "kalshiMarketTicker": "string",\ "categorySlug": "string",\ "createdAt": "string",\ "decimalPrecision": 2,\ "marketVariant": "DEFAULT"\ }\ ],\ "startsAt": "string",\ "endsAt": "string",\ "status": "OPEN",\ "tags": [\ {\ "id": "string",\ "name": "string"\ }\ ]\ }\ ], "markets": [\ {\ "id": 0,\ "imageUrl": "string",\ "title": "string",\ "question": "string",\ "description": "string",\ "status": "REGISTERED",\ "isNegRisk": true,\ "isYieldBearing": true,\ "feeRateBps": 0,\ "resolution": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "oracleQuestionId": "string",\ "conditionId": "string",\ "resolverAddress": "string",\ "outcomes": [\ {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ }\ ],\ "questionIndex": 0,\ "spreadThreshold": 0,\ "shareThreshold": 0,\ "isBoosted": true,\ "boostStartsAt": "string",\ "boostEndsAt": "string",\ "polymarketConditionIds": [\ "string"\ ],\ "kalshiMarketTicker": "string",\ "categorySlug": "string",\ "createdAt": "string",\ "decimalPrecision": 2,\ "marketVariant": "DEFAULT",\ "variantData": {\ "type": "CRYPTO_UP_DOWN",\ "startPrice": 0,\ "endPrice": 0,\ "priceFeedId": "string"\ }\ }\ ] } } Modified at 2026-01-31 16:05:09 [Previous\ \ Get positions by address](https://dev.predict.fun/get-positions-by-address-27399808e0) [Next\ \ Finalize a OAuth connection](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0) --- # Finalize a OAuth connection - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Finalize a OAuth connection =========================== Developing Prod Env https://api.predict.fun Prod Env https://api.predict.fun POST https://api.predict.fun /v1/oauth/finalize Try itRun in Apidog Run in Apidog \[This endpoint is not available for general use\] Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Body Params application/jsonRequired Generate Code Examples Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request POST 'https://api.predict.fun/v1/oauth/finalize' \ --header 'x-api-key: ' \ --header 'Content-Type: application/json' \ --data-raw '{ "signer": "string", "account": "string", "signature": "string", "data": { "timestamp": 0, "clientId": "string", "authCode": "string" } }' Response Response Example { "success": true, "data": { "token": "string" } } Modified at 2026-01-31 16:05:09 [Previous\ \ Search categories and markets](https://dev.predict.fun/search-categories-and-markets-27399810e0) [Next\ \ Get the orders for a OAuth connection](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0) --- # Get the orders for a OAuth connection - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get the orders for a OAuth connection ===================================== Developing Prod Env https://api.predict.fun Prod Env https://api.predict.fun POST https://api.predict.fun /v1/oauth/orders Try itRun in Apidog Run in Apidog \[This endpoint is not available for general use\] Request ------- Authorization Bearer Token Provide your bearer token in the Authorization header when making requests to protected resources. Example: `Authorization: Bearer ********************` or API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Body Params application/jsonRequired Generate Code Examples Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request POST 'https://api.predict.fun/v1/oauth/orders' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "signer": "string", "account": "string", "signature": "string", "data": { "first": "string", "after": "string", "status": "OPEN", "timestamp": 0 } }' Response Response Example { "success": true, "cursor": "string", "data": [\ {\ "order": {\ "hash": "string",\ "salt": "string",\ "maker": "string",\ "signer": "string",\ "taker": "0x0000000000000000000000000000000000000000",\ "tokenId": "string",\ "makerAmount": "string",\ "takerAmount": "string",\ "expiration": "string",\ "nonce": "string",\ "feeRateBps": "string",\ "side": 0,\ "signatureType": 0,\ "signature": "string"\ },\ "id": "string",\ "marketId": 0,\ "currency": "string",\ "amount": "string",\ "amountFilled": "string",\ "isNegRisk": true,\ "isYieldBearing": true,\ "strategy": "LIMIT",\ "status": "OPEN",\ "rewardEarningRate": 0\ }\ ] } Modified at 2026-01-31 16:05:09 [Previous\ \ Finalize a OAuth connection](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0) [Next\ \ Create an order for a OAuth connection](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0) --- # Understanding the Orderbook - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0 "Understanding the Orderbook") * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0 "[TS] How to authenticate your API requests") * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0 "[PY] How to authenticate your API requests") * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0 "How to create or cancel orders") * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Copy Page Understanding the Orderbook =========================== INFO **The order book stores prices based on the `Yes` outcome.** See the guide below to understand how to calculate the `No` outcome price. Order Book Price Structure Overview[#](https://dev.predict.fun/doc-685654#order-book-price-structure-overview) --------------------------------------------------------------------------------------------------------------- The API returns the order book for a given market with the following JSON structure that contains depth details about both buy (`bids`) and sell (`asks`) prices **for the `Yes` side of the market**. To understand how to derive the corresponding `No` side prices, let’s break down the API response and how prices are calculated. ### Example API Response[#](https://dev.predict.fun/doc-685654#example-api-response) Here is an example of the API response structure: { "success": true, "data": { "marketId": 1, "updateTimestampMs": 1727910141000, "asks": [\ [0.492, 30192.26],\ [0.493, 20003]\ ], "bids": [\ [0.491, 303518.1],\ [0.49, 1365.44]\ ] } } **`asks`**: A list of the current sell price depth based on the `Yes` side `[price, quantity]` (best/lowest ask first). **`bids`**: A list of the current buy price depth based on the `Yes` side `[price, quantity]` (best/highest bid first). ### Price Calculations[#](https://dev.predict.fun/doc-685654#price-calculations) The order book stores prices based on the `Yes` outcome. To get the equivalent prices for the `No` outcome, you need the **complement** price **at the market’s decimal precision** (so that `Yes + No = 1` at that precision). 1. **`No` Buy Price**: This is the best price to **buy `No`** (equivalently: **sell `Yes`** into the best `Yes` bid). It’s calculated as: **Explanation**: `bids[0][0]` is the highest bid price for `Yes`. The corresponding best price to buy `No` is the complement of that `Yes` bid. 2. **`No` Sell Price**: This is the best price to **sell `No`** (equivalently: **buy `Yes`** from the best `Yes` ask). It’s calculated as: **Explanation**: `asks[0][0]` is the lowest ask price for `Yes`. The corresponding best price to sell `No` is the complement of that `Yes` ask. If you need the _full depth_ for the `No` side (not just top-of-book), you transform the book by **swapping** sides and complementing each level: ### Notes[#](https://dev.predict.fun/doc-685654#notes) **Order Book Data**: The order book (`bids` and `asks`) data is already sorted with the best prices first (`bids[0]` highest, `asks[0]` lowest). **Precision Matters**: Use the same `decimalPrecision` as the market/backend expects. Using a raw `1 - price` can produce values that don’t match backend rounding. **Price Range**: Both `Yes` and `No` prices are constrained to the range `[0, 1]`, reflecting probabilities in a market context. **Edge Cases**: If there are no bids or asks (e.g., `bids` or `asks` arrays are empty), additional logic may be needed to handle these cases to avoid errors during price calculation. Modified at 2025-12-12 02:51:57 [Previous\ \ Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0) [Next\ \ \[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) --- # Get category by slug - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get category by slug ==================== Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/categories/{slug} Try itRun in Apidog Run in Apidog Get category information and its markets by slug Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Path Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/categories/' \ --header 'x-api-key: ' Response Response Example { "success": true, "data": { "id": 0, "slug": "string", "title": "string", "description": "string", "imageUrl": "string", "isNegRisk": true, "isYieldBearing": true, "marketVariant": "DEFAULT", "variantData": { "type": "CRYPTO_UP_DOWN", "startPrice": 0, "endPrice": 0, "priceFeedId": "string" }, "createdAt": "string", "publishedAt": "string", "markets": [\ {\ "id": 0,\ "imageUrl": "string",\ "title": "string",\ "question": "string",\ "description": "string",\ "status": "REGISTERED",\ "isNegRisk": true,\ "isYieldBearing": true,\ "feeRateBps": 0,\ "resolution": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "oracleQuestionId": "string",\ "conditionId": "string",\ "resolverAddress": "string",\ "outcomes": [\ {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ }\ ],\ "questionIndex": 0,\ "spreadThreshold": 0,\ "shareThreshold": 0,\ "isBoosted": true,\ "boostStartsAt": "string",\ "boostEndsAt": "string",\ "polymarketConditionIds": [\ "string"\ ],\ "kalshiMarketTicker": "string",\ "categorySlug": "string",\ "createdAt": "string",\ "decimalPrecision": 2,\ "marketVariant": "DEFAULT"\ }\ ], "startsAt": "string", "endsAt": "string", "status": "OPEN", "tags": [\ {\ "id": "string",\ "name": "string"\ }\ ] } } Modified at 2026-01-31 16:05:09 [Previous\ \ Get categories](https://dev.predict.fun/get-categories-25326910e0) [Next\ \ Get all tags](https://dev.predict.fun/get-all-tags-27399809e0) --- # Cancel the orders for a OAuth connection - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Cancel the orders for a OAuth connection ======================================== Developing Prod Env https://api.predict.fun Prod Env https://api.predict.fun POST https://api.predict.fun /v1/oauth/orders/cancel Try itRun in Apidog Run in Apidog \[This endpoint is not available for general use\] Request ------- Authorization Bearer Token Provide your bearer token in the Authorization header when making requests to protected resources. Example: `Authorization: Bearer ********************` or API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Body Params application/jsonRequired Generate Code Examples Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request POST 'https://api.predict.fun/v1/oauth/orders/cancel' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "signer": "string", "account": "string", "signature": "string", "data": { "timestamp": 0, "ids": [\ "string"\ ] } }' Response Response Example { "success": true } Modified at 2026-01-31 16:05:09 [Previous\ \ Create an order for a OAuth connection](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0) [Next\ \ Get the positions for a OAuth connection](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0) --- # Create an order for a OAuth connection - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Create an order for a OAuth connection ====================================== Developing Prod Env https://api.predict.fun Prod Env https://api.predict.fun POST https://api.predict.fun /v1/oauth/orders/create Try itRun in Apidog Run in Apidog \[This endpoint is not available for general use\] Request ------- Authorization Bearer Token Provide your bearer token in the Authorization header when making requests to protected resources. Example: `Authorization: Bearer ********************` or API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Body Params application/jsonRequired Generate Code Examples Responses --------- 🟢201 application/json Response 201 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request POST 'https://api.predict.fun/v1/oauth/orders/create' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "signer": "string", "account": "string", "signature": "string", "data": { "timestamp": 0, "pricePerShare": "string", "strategy": "LIMIT", "slippageBps": "string", "isFillOrKill": true, "order": { "hash": "string", "salt": "string", "maker": "string", "signer": "string", "taker": "0x0000000000000000000000000000000000000000", "tokenId": "string", "makerAmount": "string", "takerAmount": "string", "expiration": "string", "nonce": "string", "feeRateBps": "string", "side": 0, "signatureType": 0 } } }' Response Response Example { "success": true, "data": { "code": "OK", "orderId": "string", "orderHash": "string" } } Modified at 2026-01-31 16:05:09 [Previous\ \ Get the orders for a OAuth connection](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0) [Next\ \ Cancel the orders for a OAuth connection](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0) --- # Get the positions for a OAuth connection - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get the positions for a OAuth connection ======================================== Developing Prod Env https://api.predict.fun Prod Env https://api.predict.fun POST https://api.predict.fun /v1/oauth/positions Try itRun in Apidog Run in Apidog \[This endpoint is not available for general use\] Request ------- Authorization Bearer Token Provide your bearer token in the Authorization header when making requests to protected resources. Example: `Authorization: Bearer ********************` or API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Body Params application/jsonRequired Generate Code Examples Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request POST 'https://api.predict.fun/v1/oauth/positions' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "signer": "string", "account": "string", "signature": "string", "data": { "timestamp": 0, "first": "string", "after": "string" } }' Response Response Example { "success": true, "cursor": "string", "data": [\ {\ "id": "string",\ "market": {\ "id": 0,\ "imageUrl": "string",\ "title": "string",\ "question": "string",\ "description": "string",\ "status": "REGISTERED",\ "isNegRisk": true,\ "isYieldBearing": true,\ "feeRateBps": 0,\ "resolution": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "oracleQuestionId": "string",\ "conditionId": "string",\ "resolverAddress": "string",\ "outcomes": [\ {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ }\ ],\ "questionIndex": 0,\ "spreadThreshold": 0,\ "shareThreshold": 0,\ "isBoosted": true,\ "boostStartsAt": "string",\ "boostEndsAt": "string",\ "polymarketConditionIds": [\ "string"\ ],\ "kalshiMarketTicker": "string",\ "categorySlug": "string",\ "createdAt": "string",\ "decimalPrecision": 2,\ "marketVariant": "DEFAULT",\ "variantData": {\ "type": "CRYPTO_UP_DOWN",\ "startPrice": 0,\ "endPrice": 0,\ "priceFeedId": "string"\ }\ },\ "outcome": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "amount": "string",\ "valueUsd": "string"\ }\ ] } Modified at 2026-01-31 16:05:09 [Previous\ \ Cancel the orders for a OAuth connection](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0) --- # [TS] How to authenticate your API requests - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0 "Understanding the Orderbook") * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0 "[TS] How to authenticate your API requests") * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0 "[PY] How to authenticate your API requests") * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0 "How to create or cancel orders") * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Copy Page \[TS\] How to authenticate your API requests ============================================ ### Authentication with API Key and JWT Token[#](https://dev.predict.fun/doc-663127#authentication-with-api-key-and-jwt-token) To interact with Predict's API, you'll need two things: 1. **API Key**: Required for all endpoints (only on Mainnet). 2. **JWT Token**: Required for performing personal operations for a specific wallet (e.g., sending a new order or viewing active orders). **Sections**: [**Obtaining a JWT Token _(for EOAs)_**](https://dev.predict.fun/apidoc/doc-663127#obtaining-a-jwt-token-for-eoas) [**Obtaining a JWT Token _(for Predict accounts)_**](https://dev.predict.fun/apidoc/doc-663127#obtaining-a-jwt-token-for-predict-accounts) [**Passing the API Key and JWT Token in the requests**](https://dev.predict.fun/apidoc/doc-663127#passing-the-api-key-and-jwt-token-in-requests) ### Obtaining a JWT Token _(for Predict accounts)_[#](https://dev.predict.fun/doc-663127#obtaining-a-jwt-token-for-predict-accounts) An API key is required to obtain a JWT token. Follow these steps to generate a JWT token for your wallet: 1. **Retrieve the message to sign**: Send a `GET` request to `/v1/auth/message` to retrieve a message for signing. 2. **Sign the message with your wallet via our SDK**: You will need two wallets: Your Predict account address (aka deposit address) Your Privy Wallet private key (can be exported from the account's settings) **NOTE**: It's reccomended to fund your Privy Wallet with BNB to be able to set approvals and cancel orders. 3. **Send the signature**: Send a `POST` request to `/v1/auth` with the following JSON structure: ### Obtaining a JWT Token _(for EOAs)_[#](https://dev.predict.fun/doc-663127#obtaining-a-jwt-token-for-eoas) An API key is required to obtain a JWT token. Follow these steps to generate a JWT token for your wallet: 1. **Retrieve the message to sign**: Send a `GET` request to `/v1/auth/message` to retrieve a message for signing. 2. **Sign the message with your wallet**: Use the wallet you want to authenticate with to sign the message retrieved in step 1. 3. **Send the signature**: Send a `POST` request to `/v1/auth` with the following JSON structure: ### Passing the API Key and JWT Token in Requests[#](https://dev.predict.fun/doc-663127#passing-the-api-key-and-jwt-token-in-requests) To authenticate your requests, you need to include both the API key and the JWT token in the request headers. **The API key and `x-api-key` header are not required on Testnet**. Request headers (as shown on the example above): { "headers": { "x-api-key": "YOUR_API_KEY", "Authorization": "Bearer YOUR_JWT_TOKEN" } } Example usage: Modified at 2025-12-17 15:19:32 [Previous\ \ Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) [Next\ \ \[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) --- # How to create or cancel orders - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0 "Understanding the Orderbook") * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0 "[TS] How to authenticate your API requests") * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0 "[PY] How to authenticate your API requests") * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0 "How to create or cancel orders") * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") Copy Page How to create or cancel orders ============================== This guide will demonstrate how to create orders using the Predict's TypeScript SDK. #### Sections:[#](https://dev.predict.fun/doc-679306#sections) [How to install the SDK](https://dev.predict.fun/apidoc/doc-679306#how-to-install-the-sdk) [How to set approvals](https://dev.predict.fun/apidoc/doc-679306#how-to-set-approvals) [How to use a Predict account](https://dev.predict.fun/apidoc/doc-679306#how-to-use-a-predict-account) [How to create a LIMIT order _(recommended)_](https://dev.predict.fun/apidoc/doc-679306#how-to-create-a-limit-order-recommended) [How to create a MARKET order](https://dev.predict.fun/apidoc/doc-679306#how-to-create-a-market-order) [How to redeem positions](https://dev.predict.fun/apidoc/doc-679306#how-to-redeem-positions) [How to merge positions](https://dev.predict.fun/apidoc/doc-679306#how-to-merge-positions) [How to check USDT balance](https://dev.predict.fun/apidoc/doc-679306#how-to-check-usdt-balance) [How to interface with contracts](https://dev.predict.fun/apidoc/doc-679306#how-to-interface-with-contracts) [How to cancel orders](https://dev.predict.fun/apidoc/doc-679306#how-to-cancel-orders) [License](https://dev.predict.fun/apidoc/doc-679306#license) How to install the SDK[#](https://dev.predict.fun/doc-679306#how-to-install-the-sdk) ------------------------------------------------------------------------------------- This package has [ethers v6](https://docs.ethers.io/v6/) as a peer dependency. See the [`OrderBuilder`](https://github.com/PredictDotFun/sdk/blob/main/src/OrderBuilder.ts) class for more in-depth details on each function. Predict Account[#](https://dev.predict.fun/doc-679306#predict-account) ----------------------------------------------------------------------- Predict supports interacting with the protocol using either a traditional Externally Owned Account (EOA) or a Smart Wallet ("Predict Account"). If you use the web app, a Smart Wallet is automatically created for you. To interact with your Smart Wallet programmatically using the SDK, follow the example shown in [How to use a Predict account](https://dev.predict.fun/apidoc/doc-679306#how-to-use-a-predict-account) . How to set approvals[#](https://dev.predict.fun/doc-679306#how-to-set-approvals) --------------------------------------------------------------------------------- Before trading, you need to set approvals for ERC-1155 (`ConditionalTokens`) and ERC-20 (`USDT`). This can be achieved by sending a transaction to the respective contracts and approving both the `CTF_EXCHANGE` and the `NEG_RISK_CTF_EXCHANGE` or via the SDK utils. **Contracts**: The current deployed contracts can be found either in the [`Constants.ts`](https://github.com/PredictDotFun/sdk/blob/main/src/Constants.ts#32) file or in the [Deployed Contracts](https://docs.predict.fun/developers/deployed-contracts) documentation. The following example demonstrates how to set the necessary approvals using the SDK utils. How to use a Predict account[#](https://dev.predict.fun/doc-679306#how-to-use-a-predict-account) ------------------------------------------------------------------------------------------------- Here's an example of how to use a Predict account to create/cancel orders and set approvals. 1. **Initiate the Privy Wallet**: The wallet is needed to sign orders. Can be found in the [account settings](https://predict.fun/account/settings) . 2. **Ensure the Privy Wallet has funds**: You will need to add some BNB to be able to set approvals and cancel orders, if needed. 3. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling `OrderBuilder.make`. NOTE: Include the `predictAccount` address, which is also known as the deposit address. 4. **Set Approvals**: Ensure the necessary approvals are set (refer to [Set Approvals](https://dev.predict.fun/apidoc/doc-679306#set-approvals) ). 5. **Determine Order Amounts**: Use `getLimitOrderAmounts` to calculate order amounts. 6. **Build Order**: Use `buildOrder` to generate a `LIMIT` strategy order. NOTE: Fetch the `feeRateBps` via the `GET /markets` endpoint on the REST API NOTE: Set the `signer` and `maker` to the `predictAccount` address, **NOT** the signer/privy wallet address. 7. **Generate Typed Data**: Call `buildTypedData` to generate typed data for the order. 8. **Sign Order**: Obtain a `SignedOrder` object by calling `signTypedDataOrder`. 9. **Compute Order Hash**: Compute the order hash using `buildTypedDataHash`. This will allow you to perform operations via your Predict Account (via the smart wallet). How to create a LIMIT order _(recommended)_[#](https://dev.predict.fun/doc-679306#how-to-create-a-limit-order-recommended) --------------------------------------------------------------------------------------------------------------------------- Here's an example of how to use the OrderBuilder to create and sign a `LIMIT` strategy buy order: 1. **Create Wallet**: The wallet is needed to sign orders. 2. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling `OrderBuilder.make`. 3. **Set Approvals**: Ensure the necessary approvals are set (refer to [Set Approvals](https://dev.predict.fun/apidoc/doc-679306#set-approvals) ). 4. **Determine Order Amounts**: Use `getLimitOrderAmounts` to calculate order amounts. 5. **Build Order**: Use `buildOrder` to generate a `LIMIT` strategy order. NOTE: Fetch the `feeRateBps` via the `GET /markets` endpoint on the REST API 6. **Generate Typed Data**: Call `buildTypedData` to generate typed data for the order. 7. **Sign Order**: Obtain a `SignedOrder` object by calling `signTypedDataOrder`. 8. **Compute Order Hash**: Compute the order hash using `buildTypedDataHash`. How to create a MARKET order[#](https://dev.predict.fun/doc-679306#how-to-create-a-market-order) ------------------------------------------------------------------------------------------------- Similarly to the above, here's the flow to create a `MARKET` sell order: 1. **Create Wallet**: The wallet is needed to sign orders. 2. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling `OrderBuilder.make`. 3. **Set Approvals**: Ensure the necessary approvals are set (refer to [Set Approvals](https://dev.predict.fun/apidoc/doc-679306#set-approvals) ). 4. **Fetch Orderbook**: Query the Predict API for the latest orderbook for the market. 5. **Determine Order Amounts**: Use `getMarketOrderAmounts` to calculate order amounts. 6. **Build Order**: Call `buildOrder` to generate a `MARKET` strategy order. NOTE: Fetch the `feeRateBps` via the `GET /markets` endpoint on the REST API 7. **Generate Typed Data**: Use `buildTypedData` to create typed data for the order. 8. **Sign Order**: Obtain a `SignedOrder` object by calling `signTypedDataOrder`. 9. **Compute Order Hash**: Compute the order hash using `buildTypedDataHash`. How to redeem positions[#](https://dev.predict.fun/doc-679306#how-to-redeem-positions) --------------------------------------------------------------------------------------- The `OrderBuilder` class provides the `redeemPositions` method to redeem your positions on the Predict protocol. The method supports all market types through the `isNegRisk` and `isYieldBearing` options. 1. **Create a Wallet**: Initialize a wallet that will be used to sign the redemption transaction. 2. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling the static `make` method. 3. **Redeem Positions**: Call the `redeemPositions` method with the appropriate options. The `conditionId` and `indexSet` can be fetched from the `GET /positions` endpoint. How to merge positions[#](https://dev.predict.fun/doc-679306#how-to-merge-positions) ------------------------------------------------------------------------------------- The `OrderBuilder` class provides the `mergePositions` method to combine both outcome tokens back into collateral (USDT). This is useful when you hold equal amounts of both YES and NO positions. 1. **Create a Wallet**: Initialize a wallet that will be used to sign the merge transaction. 2. **Initialize `OrderBuilder`**: Instantiate the `OrderBuilder` class by calling the static `make` method. 3. **Merge Positions**: Call the `mergePositions` method with the appropriate options. The `conditionId` can be fetched from the `GET /positions` endpoint. How to check USDT balance[#](https://dev.predict.fun/doc-679306#how-to-check-usdt-balance) ------------------------------------------------------------------------------------------- The method `balanceOf` allows to easily check the current USDT balance of the connected signer. How to interface with contracts[#](https://dev.predict.fun/doc-679306#how-to-interface-with-contracts) ------------------------------------------------------------------------------------------------------- To facilitate interactions with Predict's contracts we expose the necessary instances of each contract, including ABIs and types. Some other useful utils, ABIs and types exposed by the SDK. How to cancel orders[#](https://dev.predict.fun/doc-679306#how-to-cancel-orders) --------------------------------------------------------------------------------- Here's an example on how to cancel orders via the SDK 1. **Fetch Orders**: Retrieve your open orders using `GET /orders`. 2. **Group by `isNegRisk` and `isYieldBearing`**: Separate orders based on the `isNegRisk` and `isYieldBearing` properties. 3. **Cancel Orders**: Call the cancel function and provide the orders to cancel and the `isNegRisk` and `isYieldBearing` properties. 4. **Check Transaction Success**: Check to confirm the transaction was successful. License[#](https://dev.predict.fun/doc-679306#license) ------------------------------------------------------- By contributing to this project, you agree that your contributions will be licensed under the project's [MIT License](https://dev.predict.fun/LICENSE) . Modified at 2025-12-19 11:31:41 [Previous\ \ \[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) [Next\ \ General Information](https://dev.predict.fun/general-information-1915499m0) --- # Get categories - Predict API (Beta) [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) Copy Page [![](https://assets.apidog.com/app/apidoc-image/custom/20240830/50acffae-b4c9-4c10-8279-23314322b83b.png)\ \ **Predict API (Beta)**](https://dev.predict.fun/) * [FAQs](https://dev.predict.fun/faqs-684248m0 "FAQs") * [Deployed Contracts](https://dev.predict.fun/-deployed-contracts-1860295m0 " Deployed Contracts") * Guides * [Understanding the Orderbook](https://dev.predict.fun/understanding-the-orderbook-685654m0) * [\[TS\] How to authenticate your API requests](https://dev.predict.fun/ts-how-to-authenticate-your-api-requests-663127m0) * [\[PY\] How to authenticate your API requests](https://dev.predict.fun/py-how-to-authenticate-your-api-requests-1868364m0) * [How to create or cancel orders](https://dev.predict.fun/how-to-create-or-cancel-orders-679306m0) * WebSocket * [General Information](https://dev.predict.fun/general-information-1915499m0) * [Request Format](https://dev.predict.fun/request-format-1915501m0) * [Response Format](https://dev.predict.fun/response-format-1915502m0) * [Subscription Topics](https://dev.predict.fun/subscription-topics-1915507m0) * [Heartbeats](https://dev.predict.fun/heartbeats-1915508m0) * [Client Example](https://dev.predict.fun/client-example-1915523m0) * Authorization * [Get auth message\ \ GET](https://dev.predict.fun/get-auth-message-25326899e0 "Get auth message") * [Get JWT with valid signature\ \ POST](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0 "Get JWT with valid signature") * Categories * [Get categories\ \ GET](https://dev.predict.fun/get-categories-25326910e0 "Get categories") * [Get category by slug\ \ GET](https://dev.predict.fun/get-category-by-slug-25326911e0 "Get category by slug") * [Get all tags\ \ GET](https://dev.predict.fun/get-all-tags-27399809e0 "Get all tags") * Markets * [Get markets\ \ GET](https://dev.predict.fun/get-markets-25326905e0 "Get markets") * [Get market by ID\ \ GET](https://dev.predict.fun/get-market-by-id-25552989e0 "Get market by ID") * [Get market statistics\ \ GET](https://dev.predict.fun/get-market-statistics-25326906e0 "Get market statistics") * [Get market last sale information\ \ GET](https://dev.predict.fun/get-market-last-sale-information-25326907e0 "Get market last sale information") * [Get the orderbook for a market\ \ GET](https://dev.predict.fun/get-the-orderbook-for-a-market-25326908e0 "Get the orderbook for a market") * Orders * [Get order by hash\ \ GET](https://dev.predict.fun/get-order-by-hash-25326901e0 "Get order by hash") * [Get orders\ \ GET](https://dev.predict.fun/get-orders-25326902e0 "Get orders") * [Get order match events\ \ GET](https://dev.predict.fun/get-order-match-events-25663812e0 "Get order match events") * [Create an order\ \ POST](https://dev.predict.fun/create-an-order-25326903e0 "Create an order") * [Remove orders from the orderbook\ \ POST](https://dev.predict.fun/remove-orders-from-the-orderbook-25326904e0 "Remove orders from the orderbook") * Accounts * [Get connected account\ \ GET](https://dev.predict.fun/get-connected-account-25326917e0 "Get connected account") * [Get account activity\ \ GET](https://dev.predict.fun/get-account-activity-26651508e0 "Get account activity") * [Set a referral\ \ POST](https://dev.predict.fun/set-a-referral-25326918e0 "Set a referral") * Positions * [Get positions\ \ GET](https://dev.predict.fun/get-positions-25326909e0 "Get positions") * [Get positions by address\ \ GET](https://dev.predict.fun/get-positions-by-address-27399808e0 "Get positions by address") * Search * [Search categories and markets\ \ GET](https://dev.predict.fun/search-categories-and-markets-27399810e0 "Search categories and markets") * OAuth * [Finalize a OAuth connection\ \ POST](https://dev.predict.fun/finalize-a-oauth-connection-25326912e0 "Finalize a OAuth connection") * [Get the orders for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-orders-for-a-oauth-connection-25326913e0 "Get the orders for a OAuth connection") * [Create an order for a OAuth connection\ \ POST](https://dev.predict.fun/create-an-order-for-a-oauth-connection-25326914e0 "Create an order for a OAuth connection") * [Cancel the orders for a OAuth connection\ \ POST](https://dev.predict.fun/cancel-the-orders-for-a-oauth-connection-25326915e0 "Cancel the orders for a OAuth connection") * [Get the positions for a OAuth connection\ \ POST](https://dev.predict.fun/get-the-positions-for-a-oauth-connection-25326916e0 "Get the positions for a OAuth connection") MCP Copy Page Get categories ============== Prod Env https://api.predict.fun Prod Env https://api.predict.fun GET https://api.predict.fun /v1/categories Try itRun in Apidog Run in Apidog INFO Markets within `RESOLVED` categories are not tradable. You can filter them with the `status` query parameter. Get categories information and their markets Request ------- Authorization API Key Add parameter in header x-api-key Example: `x-api-key: ********************` or Query Params Generate Code Responses --------- 🟢200 application/json Response 200 Body Generate Code Request Request Example Shell JavaScript Java Swift cURLcURL-WindowsHttpiewgetPowerShell curl --location --request GET 'https://api.predict.fun/v1/categories?first&after&status&sort&tagIds&marketVariant' \ --header 'x-api-key: ' Response Response Example { "success": true, "cursor": "string", "data": [\ {\ "id": 0,\ "slug": "string",\ "title": "string",\ "description": "string",\ "imageUrl": "string",\ "isNegRisk": true,\ "isYieldBearing": true,\ "marketVariant": "DEFAULT",\ "variantData": {\ "type": "CRYPTO_UP_DOWN",\ "startPrice": 0,\ "endPrice": 0,\ "priceFeedId": "string"\ },\ "createdAt": "string",\ "publishedAt": "string",\ "markets": [\ {\ "id": 0,\ "imageUrl": "string",\ "title": "string",\ "question": "string",\ "description": "string",\ "status": "REGISTERED",\ "isNegRisk": true,\ "isYieldBearing": true,\ "feeRateBps": 0,\ "resolution": {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ },\ "oracleQuestionId": "string",\ "conditionId": "string",\ "resolverAddress": "string",\ "outcomes": [\ {\ "name": "string",\ "indexSet": 0,\ "onChainId": "string",\ "status": "WON"\ }\ ],\ "questionIndex": 0,\ "spreadThreshold": 0,\ "shareThreshold": 0,\ "isBoosted": true,\ "boostStartsAt": "string",\ "boostEndsAt": "string",\ "polymarketConditionIds": [\ "string"\ ],\ "kalshiMarketTicker": "string",\ "categorySlug": "string",\ "createdAt": "string",\ "decimalPrecision": 2,\ "marketVariant": "DEFAULT"\ }\ ],\ "startsAt": "string",\ "endsAt": "string",\ "status": "OPEN",\ "tags": [\ {\ "id": "string",\ "name": "string"\ }\ ]\ }\ ] } Modified at 2026-01-31 16:05:09 [Previous\ \ Get JWT with valid signature](https://dev.predict.fun/get-jwt-with-valid-signature-25326900e0) [Next\ \ Get category by slug](https://dev.predict.fun/get-category-by-slug-25326911e0) ---