API reference · Bots

Link a Polymarket wallet

POST/v1/bots/{bot_id}/wallets

Attach a Polygon address's Polymarket fills from Langbot's own on-chain recording. Read-only: no key is involved, and the address's trades are public.

On this page

Auth. An account token (Authorization: Bearer lb_…) or a signed-in web session. A report-only token (lbr_…) is refused here with 403 scope_denied.

Limits. Counts against your plan's API requests (60, 600 or 3,000 a minute on Free, Builder and Standard).

Parameters

Path parameters

NameTypeRequiredDescription
bot_idstringyesThe bot id (bot_…); it must list polymarket.

Body

NameTypeRequiredDescription
chainstringnopolygon. Default polygon.
addressstringyesThe address that holds the positions (0x + 40 hex): the wallet your Polymarket profile shows, not a signing key. Mixed case must be a valid checksum.
backfill_hoursintegernoHow far back to attach fills from, in hours (at most 6 days). 0 to 144. Default 24.

Request

Terminal
curl -X POST "https://api.langbot.ai/v1/bots/bot_01M6G72RFQRQ8JGNG8T1447GGP/wallets" \
  -H "Authorization: Bearer $LANGBOT_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"chain": "polygon", "address": "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", "backfill_hours": 24}'

Response

201 Created

JSON
{
  "id": "bw_01M6G72VJ4YE3V9SPJRKD7NK0W",
  "chain": "polygon",
  "address": "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed",
  "linked_at": 1793693150788,
  "backfill_from": 1793606750788,
  "backfill_done_at": null
}

Fills appear within a minute of being recorded on chain, as fills with source: "chain"; the backfill runs in the background (backfill_done_at). While a wallet is linked, Polymarket fills your bot reports itself are kept but do not move P&L (applied: false), so nothing is counted twice. On-chain fills carry no fee (fee: null).

Errors

StatuscodeWhen
404not_foundNo bot with that id on your account (or it was deleted).
409conflictThe address is already linked on your account, or the bot has 5 wallets.
401auth_requiredNo token was sent.
401token_invalidThe token was not recognised (mistyped, revoked or expired).
422validation_errorA parameter failed validation; detail[].loc names it.
429rate_limitedOver your request budget; wait Retry-After seconds.

Every error body is {"detail": …, "code": "…"}; branch on code. All codes: Errors.