> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Builder Methods
> Methods for querying orders and trades attributed to your builder code.
## Overview
Builder attribution in V2 is handled natively through the order struct — you attach your **builder code** (a `bytes32` identifier from your [Builder Profile](https://polymarket.com/settings?tab=builder)) to every order you submit. No separate client configuration is required.
```typescript TypeScript theme={null}
import { ClobClient } from "@polymarket/clob-client-v2";
const client = new ClobClient({
host: "https://clob.polymarket.com",
chain: 137,
signer,
creds: apiCreds,
signatureType,
funderAddress,
});
// Attach your builder code on every order
const response = await client.createAndPostOrder(
{
tokenID: "0x...",
price: 0.55,
size: 100,
side: Side.BUY,
builderCode: process.env.POLY_BUILDER_CODE!,
},
{ tickSize: "0.01", negRisk: false },
);
```
```python Python theme={null}
from py_clob_client_v2 import ClobClient
from py_clob_client_v2 import OrderArgs, PartialCreateOrderOptions
from py_clob_client_v2.order_builder.constants import BUY
import os
client = ClobClient(
host="https://clob.polymarket.com",
chain_id=137,
key=os.getenv("PRIVATE_KEY"),
creds=creds,
signature_type=signature_type,
funder=funder,
)
# Attach your builder code on every order
response = client.create_and_post_order(
OrderArgs(
token_id="0x...",
price=0.55,
size=100,
side=BUY,
builder_code=os.environ["POLY_BUILDER_CODE"],
),
options=PartialCreateOrderOptions(tick_size="0.01", neg_risk=False),
)
```
See [Order Attribution](/trading/orders/attribution) for the full attribution flow.
***
## Methods
***
### getOrder
Get details for a specific order by ID.
```typescript Signature theme={null}
async getOrder(orderID: string): Promise
```
```typescript TypeScript theme={null}
const order = await client.getOrder("0xb816482a...");
console.log(order);
```
```python Python theme={null}
order = client.get_order("0xb816482a...")
print(order)
```
***
### getOpenOrders
Get all open orders attributed to your builder code.
```typescript Signature theme={null}
async getOpenOrders(
params?: OpenOrderParams,
only_first_page?: boolean,
): Promise
```
**Params**
Optional. Filter by order ID.
Optional. Filter by market condition ID.
Optional. Filter by token ID.
```typescript TypeScript theme={null}
// All open orders for this builder
const orders = await client.getOpenOrders();
// Filtered by market
const marketOrders = await client.getOpenOrders({
market: "0xbd31dc8a...",
});
```
***
### getBuilderTrades
Retrieves all trades attributed to your builder code. Use this to track which trades were routed through your platform.
```typescript Signature theme={null}
async getBuilderTrades(
params?: TradeParams,
): Promise
```
**Params (`TradeParams`)**
Optional. Filter trades by trade ID.
Optional. Filter trades by maker address.
Optional. Filter trades by market condition ID.
Optional. Filter trades by asset (token) ID.
Optional. Return trades created before this cursor value.
Optional. Return trades created after this cursor value.
**Response (`BuilderTradesPaginatedResponse`)**
Array of trades attributed to the builder account.
Cursor string for fetching the next page of results.
Maximum number of trades returned per page.
Total number of trades returned in this response.
**`BuilderTrade` fields**
Unique identifier for the trade.
Type of the trade.
Hash of the taker order associated with this trade.
Builder code attributed to this trade.
Condition ID of the market this trade belongs to.
Token ID of the asset traded.
Side of the trade (e.g. BUY or SELL).
Size of the trade in shares.
Size of the trade denominated in USDC.
Price at which the trade was executed.
Current status of the trade.
Outcome label associated with the traded asset.
Index of the outcome within the market.
Address of the order owner (taker).
Address of the maker in the trade.
On-chain transaction hash for the trade.
Timestamp when the trade was matched.
Bucket index used for trade grouping.
Fee charged for the trade in shares.
Fee charged for the trade denominated in USDC.
Optional. Error message if the trade encountered an issue, otherwise null.
Timestamp when the trade record was created, or null if unavailable.
Timestamp when the trade record was last updated, or null if unavailable.
***
## See Also
Learn about the Builders Program and its benefits.
Attach your builder code to orders for volume credit.
Place and manage orders with API credentials.
Execute onchain operations without paying gas.