# ChainHilt Polymarket Order Constructor

> ChainHilt Polymarket Order Constructor is a paid API for AI agents from chainhilt.ai, paid per call via x402, $0.01/call, status unknown (last checked 2026-11-16).

Constructs (but does not submit) a Polymarket prediction-market limit order, returning a typed-data signature action for wallet signing and a construction token for submission.

## Facts

- Endpoint: POST https://chainhilt.ai/api/v1/predict/polymarket/orders/construct?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-16
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/chainhilt-polymarket-order-constructor-d2c66353
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_17zFSInVombQxM2OL2nw9

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability chainhilt-polymarket-order-constructor-d2c66353 -d '<json body>'
```

Example prompt: Construct a GTC buy order on Polymarket for market ID 'abc123' on outcome token 'tok456' — 10 shares at a limit price of 0.42 pUSD using my deposit wallet at address 0xAbC...1234, using the credential token I got earlier, and show me the fee breakdown and any warnings before I sign anything.

## When to prefer this

Use this endpoint when you need to construct and review a Polymarket order — including fee estimates and warnings — before committing a wallet signature. It is the required first step before calling /predict/polymarket/orders/submit. Prefer this over direct venue interaction when operating an AI agent that needs to validate order parameters, inspect fees, and present a confirmation step to the user prior to on-chain action.

## Known failure modes

- 400 Bad Request — invalid input parameters such as malformed price, size below minOrderSize, or invalid address format
- 401 Unauthorized — credentialToken is invalid, expired, or does not match the account
- 422 Unprocessable Entity — order refused by venue logic (e.g. price not on tick, market inactive, GTD expiry too soon)
- 502 Bad Gateway — Polymarket venue is unreachable or returned an error upstream

## How this service works

Construct a prediction-market order; never submits. Needs a `credentialToken` from /predict/polymarket/credentials. Returns `construction` and a signature action the chainhilt wallet signs and POSTs to /predict/polymarket/orders/submit. Review orderSummary and warnings before signing: `estimatedBuilderFee` (ours) and `estimatedVenueFee` (Polymarket's) are pUSD on top of the principal. Errors: 400 invalid input, 401 invalid credentialToken, 422 order refused, 502 venue failure.

## Output

Returns a `construction` object containing the order wire parameters, orderSummary (side, shares, limitPrice, estimatedBuilderFee in pUSD, estimatedVenueFee in pUSD), a constructionToken, and any warnings. Also returns a `response.actions` array with a single `signature` action containing the EIP-712 typedData the wallet must sign and the `submitPath` to POST it to, along with any errors.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "side": {
   "enum": [
    "buy",
    "sell"
   ],
   "type": "string",
   "description": "Buy or sell outcome shares."
  },
  "size": {
   "type": "string",
   "pattern": "^[0-9]+(\\.[0-9]{1,2})?$",
   "description": "Shares, up to 2 decimals; at least the market's `minOrderSize`."
  },
  "price": {
   "type": "string",
   "pattern": "^0\\.[0-9]{1,6}$",
   "description": "Limit price per share in pUSD, strictly between 0 and 1 (e.g. \"0.42\"), a multiple of the market's `tickSize`."
  },
  "account": {
   "type": "string",
   "pattern": "^0x[a-fA-F0-9]{40}$",
   "description": "The signer EOA. With walletType deposit_wallet, the maker is its derived deposit wallet."
  },
  "marketId": {
   "type": "string",
   "pattern": "^[A-Za-z0-9_-]{1,128}$",
   "description": "Polymarket market id from markets/search."
  },
  "postOnly": {
   "type": "boolean",
   "default": false,
   "description": "Only rest on the book, never cross on arrival. Default false."
  },
  "expiresAt": {
   "type": "string",
   "description": "ISO 8601 expiry: required for GTD, refused for GTC, at least 3 minutes out. Polymarket expires the order 60 seconds earlier."
  },
  "orderType": {
   "enum": [
    "GTC",
    "GTD"
   ],
   "type": "string",
   "description": "GTC rests until filled or cancelled; GTD expires 60 seconds before `expiresAt`, Polymarket's security threshold."
  },
  "walletType": {
   "enum": [
    "deposit_wallet",
    "eoa"
   ],
   "type": "string",
   "default": "deposit_wallet",
   "description": "deposit_wallet (default, signatureType 3) or eoa; the venue rejects plain EOA makers unless allowlisted."
  },
  "outcomeTokenId": {
   "type": "string",
   "minLength": 1,
   "description": "The outcome's `tokenId` from the market's `outcomes`; must belong to `marketId`."
  },
  "credentialToken": {
   "type": "string",
   "minLength": 1,
   "description": "Sealed venue credentials for `account` from POST /predict/polymarket/credentials."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "response": {
   "errors": [],
   "actions": [
    {
     "data": {
      "typedData": {
       "primaryType": "TypedDataSign"
      },
      "credentialToken": "pcr1.…",
      "constructionToken": "…"
     },
     "type": "signature",
     "chainId": 137,
     "protocol": "polymarket",
     "submitPath": "/predict/polymarket/orders/submit"
    }
   ],
   "warnings": []
  },
  "construction": {
   "wire": {
    "postOnly": false,
    "orderType": "GTC",
    "expiration": "0"
   },
   "venue": "polymarket",
   "warnings": [],
   "orderSummary": {
    "side": "buy",
    "shares": "10",
    "limitPrice": "0.42",
    "estimatedVenueFee": {
     "asset": "pUSD",
     "amount": "0"
    },
    "estimatedBuilderFee": {
     "asset": "pUSD",
     "amount": "0.021"
    }
   },
   "constructionToken": "…"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/chainhilt-polymarket-order-constructor-d2c66353/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from chainhilt.ai](https://www.zero.xyz/host/chainhilt.ai/llms.txt)
