API reference · Bots

Create a bot

POST/v1/bots

Register a bot you run yourself so Langbot can watch it. Langbot never receives its exchange keys and never trades for it.

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). Each bot counts toward your plan's bots (1, 5 or 50; custom on Desk).

Parameters

Body

NameTypeRequiredDescription
namestringyesA name you will recognise, unique on your account.
venuesarray of stringyesWhere the bot trades: kalshi, polymarket, polymarket_us. Up to 3 items.
descriptionstringnoAnything to remember it by.
test_run_idstringnoA Sim run of yours (POST /v1/sim/runs) to compare live results against.

Request

Terminal
curl -X POST "https://api.langbot.ai/v1/bots" \
  -H "Authorization: Bearer $LANGBOT_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "mention-sniper", "venues": ["kalshi", "polymarket"], "description": "Kalshi mention markets"}'

Response

201 Created

JSON
{
  "id": "bot_01M6G72RFQRQ8JGNG8T1447GGP",
  "name": "mention-sniper",
  "description": "Kalshi mention markets",
  "venues": [
    "kalshi",
    "polymarket"
  ],
  "test_run_id": null,
  "status": "new",
  "status_reason": "no events yet",
  "created_at": 1793693147639,
  "updated_at": 1793693147639,
  "last_event_at": null,
  "last_heartbeat_at": null,
  "halted_at": null,
  "halt_reason": null,
  "retention_days": 90,
  "wallets": []
}

status is new until the first event, then ok, stale (no heartbeat inside the heartbeat window) or halted.

Errors

StatuscodeWhen
402quota_exceededYour plan's bots are all in use; delete one or move up a plan. quota.dimension is bots.
404not_foundtest_run_id is not a Sim run on your account.
409conflictA bot with that name already exists.
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.