---
title: "Connect a bot by its token and register the webhook"
method: POST
path: "/api/v1/workspaces/{workspaceId}/telegram-bots"
tags: ["Telegram bots"]
---

# Connect a bot by its token and register the webhook

`POST /api/v1/workspaces/{workspaceId}/telegram-bots`

## Request

- Base URL: `https://otprun.com`
- URL: `https://otprun.com/api/v1/workspaces/{workspaceId}/telegram-bots`
- Auth: HTTP bearer

## Path parameters

- `workspaceId` integer, required

## Request body

- ConnectInputBody
  - `token` string, required: Bot token from @BotFather

## Response `201`

Created

- TelegramBotBody
  - `created_at` string, date-time, required
  - `id` string, required
  - `last_error` string, required
  - `status` 'active' | 'disabled' | 'invalid', required
  - `username` string, required

## Other responses

- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict
- `422`: Unprocessable Entity
- `500`: Internal Server Error

---

[API](https://skmtc.dev/otprun/apis/otp-run-api.md) · [All operations](https://skmtc.dev/otprun/apis/otp-run-api/llms.txt) · [OpenAPI document](https://skmtc.dev/otprun/apis/otp-run-api/revisions/43d40d5f4050?raw)
