> 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/place-order.md).

# Place Order

> Submit a signed order on behalf of a user.

## Usage (Recommended)

Use `placeOrderForUserFromBuildResult()` with the output from `buildOrderForSigning()`:

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

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

// Step 1: Build the order
const orderData = await builder.buildOrderForSigning({
  marketId: 123,
  tokenId: 'token_id',
  userWalletAddress: safeAddress,
  side: OrderSide.BUY,
  orderType: OrderType.LIMIT_ORDER,
  amount: 10,
  price: '0.5',
  signerAddress: userEOA,
});

// Step 2: User signs the struct hash
const signature = await user.signHash(orderData.structHash);

// Step 3: Place the order (convenience method)
const result = await builder.placeOrderForUserFromBuildResult(
  orderData,
  signature,
  safeAddress,
);
```

## Convenience Method

```typescript
async placeOrderForUserFromBuildResult(
  buildResult: BuildOrderResult,
  signature: string,
  userWalletAddress: string,
  postOnly?: boolean,
): Promise<Record<string, unknown>>
```

| Parameter           | Type             | Required | Description                                                                                 |
| ------------------- | ---------------- | -------- | ------------------------------------------------------------------------------------------- |
| `buildResult`       | BuildOrderResult | Yes      | Result from `buildOrderForSigning()`                                                        |
| `signature`         | string           | Yes      | User's signature (0x-prefixed hex string)                                                   |
| `userWalletAddress` | string           | Yes      | User's Safe wallet address (must match `order.maker`)                                       |
| postOnly            | boolean          | No       | Post-only mode for limit orders; crossing orders are cancelled instead of taking liquidity. |

## Full Method

For advanced use cases, you can call `placeOrderForUser()` directly:

```typescript
const result = await builder.placeOrderForUser({
  order: orderData.order,
  signature: signature,
  userWalletAddress: safeAddress,
  marketId: orderData.marketId,
  orderType: orderData.orderType,
  price: orderData.price,
  currencyAddress: orderData.currencyAddress,
  postOnly: true,
});
```

| Parameter           | Type                    | Required | Description                                                                                 |
| ------------------- | ----------------------- | -------- | ------------------------------------------------------------------------------------------- |
| `order`             | Record\<string, string> | Yes      | Order struct from `buildOrderForSigning()`                                                  |
| `signature`         | string                  | Yes      | User's signature (0x-prefixed hex string)                                                   |
| `userWalletAddress` | string                  | Yes      | User's Safe wallet address (must match `order.maker`)                                       |
| `marketId`          | number                  | No       | Market ID                                                                                   |
| `orderType`         | number                  | No       | Order type (1=market, 2=limit)                                                              |
| `price`             | string                  | No       | Order price                                                                                 |
| `currencyAddress`   | string                  | No       | Quote token address                                                                         |
| postOnly            | boolean                 | No       | Post-only mode for limit orders; crossing orders are cancelled instead of taking liquidity. |

## Notes

* The convenience method `placeOrderForUserFromBuildResult()` is recommended. It automatically extracts `marketId`, `orderType`, `price`, and `currencyAddress` from the build result.
* The `order.maker` must match `userWalletAddress` or the request will be rejected.
* The signature must be a hex string starting with `0x`.
* Order placement is gasless (counts toward the 2,000/day limit).
* Post-only is supported only for limit orders; orders that would cross the spread are cancelled instead of taking liquidity.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.opinion.trade/developer-guide/opinion-clob-typescript-sdk/builder-mode/place-order.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
