> For the complete documentation index, see [llms.txt](https://docs.opinion.trade/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.opinion.trade/developer-guide/opinion-clob-typescript-sdk/builder-mode/get-market.md).

# Get Market

> Query market details and orderbook depth.

## Get Market

```typescript
import { BuilderClient } from '@opinion-labs/opinion-clob-sdk';

const builder = new BuilderClient({
  host: 'https://openapi.opinion.trade/openapi',
  builderApiKey: 'YOUR_BUILDER_KEY',
  chainId: 56,
});

const market = await builder.getMarket(123);

console.log(market.marketId);      // Market ID
console.log(market.conditionId);   // Condition ID (used for split/merge/redeem)
console.log(market.quoteToken);    // Quote token address
console.log(market.chainId);       // Chain ID
console.log(market.status);        // Market status
```

### Parameters

| Parameter  | Type    | Required | Description                                  |
| ---------- | ------- | -------- | -------------------------------------------- |
| `marketId` | number  | Yes      | Market ID (positive integer)                 |
| `useCache` | boolean | No       | Use cached data if available (default: true) |

### Response

Returns a `MarketData` object:

```typescript
interface MarketData {
  marketId: number;
  chainId: string;
  quoteToken: string;
  conditionId: string;
  status: number;
  [key: string]: unknown;  // Additional fields from API
}
```

## Get Orderbook

```typescript
const orderbook = await builder.getOrderbook('token_id_here');
```

### Parameters

| Parameter | Type   | Required | Description      |
| --------- | ------ | -------- | ---------------- |
| `tokenId` | string | Yes      | Outcome token ID |

### Response

Returns the raw API response containing bid/ask depth.

## Notes

* Market data is cached for 5 minutes by default (configurable via `marketCacheTtl`).
* Pass `false` to bypass the cache: `await builder.getMarket(123, false)`.
* The `conditionId` from `getMarket()` is required for split, merge, and redeem operations.
* The `quoteToken` address identifies which currency this market uses.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.opinion.trade/developer-guide/opinion-clob-typescript-sdk/builder-mode/get-market.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
