> ## Documentation Index
> Fetch the complete documentation index at: https://docs.parlayx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Place your first order with the ParlayX TypeScript SDK

This walks through the full path: find a market, pick an outcome, submit a
market order, and read it back. Resource methods return the typed payload
directly and throw a [`RequestError`](/sdk/errors) on any non-2xx response.

```ts theme={null}
import { createClient, RequestError } from "@parlayx/sdk";

const client = createClient({ apiKey: process.env.PARLAYX_API_KEY! });

try {
  const { markets } = await client.searchMarkets({
    q: "election",
    venues: ["polymarket"],
    limit: 1,
  });
  const summary = markets[0];
  if (!summary || summary.venue !== "polymarket") throw new Error("no Polymarket market found");

  const { market } = await client.getMarket(summary.venue, summary.marketId);
  const outcome = market.outcomes[0];
  if (!outcome) throw new Error("no outcomes found");

  const { orderId } = await client.submitOrder({
    marketOrders: [
      {
        marketInfo: { venue: "polymarket", outcomeId: outcome.outcomeId },
        side: "buy",
        amount: 5,
        type: "market",
        timeInForce: { type: "FOK" },
      },
    ],
  });

  const order = await client.getOrder(orderId);
  console.log("order status:", order.status);
} catch (error) {
  if (error instanceof RequestError) {
    console.error(`API error ${error.status} (${error.code ?? "unknown"}): ${error.message}`);
  } else {
    throw error;
  }
}
```

`submitOrder` attaches an idempotency key for you, so retrying a failed call
won't submit twice; pass your own with `client.submitOrder(body, { idempotencyKey })`
to make a specific retry idempotent. Order amounts are in USDC with a \$1 minimum
per order.
