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

# Use Polymarket in Deepline

> Search or list markets first to get a market id, conditionId, and clobTokenIds; price, order-book, and history tools take an outcome token id, while trades.

[Human guide: work with your agent →](https://deepline.com/docs/human/providers/polymarket/guide.md)
Inspect one Polymarket action before starting provider-backed work. Your first result is a verified input and output contract.

## Provider-specific requirements

Use Polymarket for read-only prediction-market data: what a market asks, what it is priced at, how that price moved, and how it resolved. There is no trading.

Identifiers differ by tool, and all of them come from a market record:

* `id` (numeric market id): `polymarket_get_market`.
* `clobTokenIds` (one token per outcome, in the same order as `outcomes`): `polymarket_get_price`, `polymarket_get_midpoint`, `polymarket_get_spread`, `polymarket_get_order_book`, `polymarket_get_price_history`, `polymarket_get_batch_price_history`.
* `conditionId` (0x hash): the `market` input of `polymarket_list_trades`, `polymarket_get_holders`, `polymarket_get_open_interest`.
* event `id`: `polymarket_get_live_volume`.

1. Find markets with `polymarket_search` (keyword) or `polymarket_list_markets` (filters). Search returns events with nested `markets`.
2. A market record already carries current prices in `outcomePrices`, so pricing many markets needs no per-token call. Use `polymarket_get_midpoint` or `polymarket_get_price` for a fresh single quote, and `polymarket_get_spread` or `polymarket_get_order_book` to judge whether a thinly traded price is meaningful.
3. For past prices, call `polymarket_get_price_history` with the outcome token as `market`. Use `interval` (`1h`, `6h`, `1d`, `1w`, `1m`, `max`) with a `fidelity` in minutes. An explicit `startTs`/`endTs` window longer than a few weeks is rejected as too long, so prefer `interval: "max"` with a coarse `fidelity` such as `1440` for long ranges. History remains available after a market resolves.
4. For past results, call `polymarket_list_markets` with `closed: true`. A resolved market has `umaResolutionStatus: "resolved"` and `outcomePrices` of `1` for the winning outcome and `0` for the others.

Polymarket sends `outcomes`, `outcomePrices`, and `clobTokenIds` as JSON-encoded strings. Deepline results return them as arrays, index-aligned with each other. Prices are probabilities between 0 and 1, usually decimal strings. Timestamps in price history (`t`) are unix seconds.

In `polymarket_get_holders` the top-level `token` of each group is masked as `[REDACTED]` by Deepline's generic secret filter. Read the outcome token id from `holders[].asset` instead, and the outcome from `holders[].outcomeIndex`.

## Find an applicable action

Confirm your effective workspace, then search the live catalog:

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline auth status --json
deepline search "Polymarket" --type tools --json
```

Search returns candidates. Check the returned provider and operation rather than selecting a similar title automatically.

## Inspect the selected contract

Replace `<returned-tool-id>` with the identifier returned by discovery:

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline describe <returned-tool-id> --json
```

These commands do not execute the selected provider action. Read its required inputs, supported access mode, pricing unit, outputs, and limits.

A connection does not establish that every action supports BYOK. Follow the provider-specific requirements above and the live action contract.

## Prepare one reviewed input

Use one authorized record that matches the inspected schema. Preserve its source identity and define the result you will accept.

Open the action reference for its payload and response shape. Provider-backed execution can incur usage or external effects.

For reusable logic, follow [Write Plays](https://deepline.com/docs/sdk-v2/plays.md). For direct-call recovery, use [Tool execution recovery](https://deepline.com/docs/sdk-v2/tool-execution-recovery.md).

> [!TIP]
>
> Continue only when the workspace, provider, required fields, acceptance rule, and applicable price are understood. Keep unavailable access separate from no-result evidence.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.