# setPublicChannel

Source: <https://telegafirst.com/docs/api-op-setpublicchannel>
Locale: ru
releaseGitSha: 005a4dc9d76f69a0815df4e3f98b9050d4d46afb
sourceContentDigest: 22c5212ed494ba806f23f3195e6eb909e98886b4d796e02999f6815b1f4f828f
Version: 5

# setPublicChannel

`POST /api/v1/tools/public-channels/{channel}`

Bind the public channel of one messenger

## Авторизация и права

Scopes: ALL. Auth alternatives: OR; scopes внутри альтернативы: ALL.

| Поле | Значение |
| - | - |
| security.0.hubApiKey | \[] |
| security.1.hubBearer | \[] |
| securitySchemes.hubApiKey.in | "header" |
| securitySchemes.hubApiKey.name | "X-Api-Key" |
| securitySchemes.hubApiKey.type | "apiKey" |
| securitySchemes.hubBearer.scheme | "bearer" |
| securitySchemes.hubBearer.type | "http" |
| x-required-scopes | \["public-channel:write"] |

## Параметры запроса

| Поле | Значение |
| - | - |
| 0.in | "path" |
| 0.name | "channel" |
| 0.required | true |
| 0.schema | [0.schema](https://telegafirst.com/docs/schema-40154830306e66d3d03952dd53e5fd93db19c444ad28259a3bbc9596a51c0c7c) |

## Тело запроса

| Поле | Значение |
| - | - |
| content.application/json.schema | [PublicChannelSetBody](https://telegafirst.com/docs/schema-9287c4c7856357382b0354acac4235c6f392c27d37786b55b21b575aab84260c) |
| required | true |

## Ответы

| Поле | Значение |
| - | - |
| 200.content.application/json.schema | [PublicChannelSetResult](https://telegafirst.com/docs/schema-ab8f9e706f5dab9bee96c72443f7dfbd6ea8e03125ba042bdb9ffff2e5575f11) |
| 200.description | "Bound, unchanged or not checked" |

## Ошибки

| Поле | Значение |
| - | - |
| 400.content.application/problem+json.schema | [ProblemDetails](https://telegafirst.com/docs/schema-47fdf0d8395ef5a30fe38dcbde38e65bcdd30fe0fcf5d639ae3a647e01aef684) |
| 400.description | "VALIDATION\_ERROR: unknown messenger, or a channel\_ref that is neither a signed decimal id nor an @handle" |
| 401.content.application/problem+json.schema | [ProblemDetails](https://telegafirst.com/docs/schema-47fdf0d8395ef5a30fe38dcbde38e65bcdd30fe0fcf5d639ae3a647e01aef684) |
| 401.description | "INVALID\_API\_KEY" |
| 403.content.application/problem+json.schema | [ProblemDetails](https://telegafirst.com/docs/schema-47fdf0d8395ef5a30fe38dcbde38e65bcdd30fe0fcf5d639ae3a647e01aef684) |
| 403.description | "INSUFFICIENT\_SCOPE: public-channel:\* (a member needs the settings permission)" |
| 422.content.application/problem+json.schema | [ProblemDetails](https://telegafirst.com/docs/schema-47fdf0d8395ef5a30fe38dcbde38e65bcdd30fe0fcf5d639ae3a647e01aef684) |
| 422.description | "PUBLIC\_CHANNEL\_BOT\_NOT\_ADMIN: the bot is not an administrator of the channel, or no such channel exists (the id or @handle names none); INVALID\_INPUT: the messenger is not enabled, or it addresses a channel by id only and channel\_ref is an @handle" |
| 429.content.application/problem+json.schema | [ProblemDetails](https://telegafirst.com/docs/schema-47fdf0d8395ef5a30fe38dcbde38e65bcdd30fe0fcf5d639ae3a647e01aef684) |
| 429.description | "RATE\_LIMIT\_EXCEEDED or RATE\_LIMIT\_UNAVAILABLE" |

## Дополнительные условия

| Поле | Значение |
| - | - |
| description | "\`channel\_ref\` is the numeric id of the channel or, for Telegram, the @handle of a public channel; a handle is resolved once to the id and only the id is stored. The business bot of that messenger must be an administrator of the channel; it is checked before anything changes. \`outcome: unavailable\` — the messenger did not answer and nothing changed. The owner and the Settings group are notified of a change." |
| operationId | "setPublicChannel" |
| summary | "Bind the public channel of one messenger" |
| tags | \["public-channels"] |
