Documentation Index Fetch the complete documentation index at: https://polymarket-data.com/llms.txt
Use this file to discover all available pages before exploring further.
Get up and running with polymarket-data in minutes. This guide walks through installation,
configuration, and your first live requests.
Install
npm install polymarket-data
# or
pnpm add polymarket-data
yarn add polymarket-data
The package ships as ESM with bundled TypeScript declarations.
Create a client
import { Polymarket } from "polymarket-data" ;
const client = new Polymarket ();
Optional configuration Option Description Default dataEndpointBase URL for the classic data API. https://data-api.polymarket.comgammaEndpointBase URL for the gamma API. https://gamma-api.polymarket.comfetchCustom Fetch implementation (for SSR/tests). globalThis.fetch
const client = new Polymarket ({
dataEndpoint: "https://custom-data.polymarket.com" ,
gammaEndpoint: "https://custom-gamma.polymarket.com" ,
fetch: myCustomFetch ,
});
Mocking in tests — pass a stubbed fetch that returns predefined payloads. All methods
pipe through the injected fetch before validation.
Verify connectivity
const status = await client . health ();
console . log ( status ); // { data: "OK" }
If this call fails, verify network access and endpoint URLs. The SDK throws HttpError for API
failures and Error("Network error: …") for connectivity issues.
Make your first requests
// Portfolio analytics
const positions = await client . data . core . getPositions ({
user: "0x56687bf447db6ffa42ffe2204a05edaa20f55839" ,
limit: 10 ,
});
// Market discovery
const markets = await client . gamma . markets . listMarkets ({
closed: false ,
liquidity_num_min: 1000 ,
limit: 5 ,
});
Use named imports for types: import type { Position , Market } from "polymarket-data" ;
Next steps
Data API Explore positions, trades, activity, holders, and value endpoints.
Gamma API Discover search, comments, series, markets, and events modules.