API coverage¶
Bot API 1.0.0 has 22 operations and one outgoing webhook, and every one of them has a method here, on both clients and both bots. The table says which, and where the SDK’s own rules differ from the document.
SDK method: the same name on
AsyncClient,Client,BotandSyncBot. The bots add encryption, caches and chat objects on top (see Bot).tests/test_parity.py::test_every_operation_of_the_spec_is_a_method_of_both_clientsfails if an operation of the spec has no method, and the request shape of every operation is checked againstopenapi.jsonitself. That test, not this page, is what keeps the list honest.
Endpoint |
HTTP method |
operationId |
SDK method |
Models |
Documentation |
|---|---|---|---|---|---|
|
GET |
|
|
|
|
|
GET |
|
|
|
|
|
GET |
|
|
|
|
|
POST |
|
|
|
|
|
DELETE |
|
|
|
|
|
PUT |
|
|
|
|
|
GET |
|
|
|
|
|
PUT |
|
|
|
|
|
DELETE |
|
|
|
|
|
POST |
|
|
|
|
|
PATCH |
|
|
|
|
|
DELETE |
|
|
|
|
|
POST |
|
|
|
|
|
GET |
|
|
|
|
|
GET |
|
|
|
|
|
GET |
|
|
|
|
|
GET |
|
|
|
|
|
POST |
|
|
|
|
|
POST |
|
|
|
|
|
GET |
|
|
|
|
|
GET |
|
|
|
|
|
POST |
|
|
|
|
webhook |
POST |
— |
|
|
|
|
GET |
— |
|
|
The media download is not an operation of the Bot API document: the server gives media[].url
in messages and serves GET /media/{id} without authentication. It is listed because bots need
it.
Error codes¶
All 26 codes of the spec’s ErrorCode enum have their own exception class
(Exceptions). tests/test_errors.py checks the table against
openapi.json both ways, so a code added to the spec fails the tests until it is mapped.
Where the spec and the server differ¶
PGPCbot follows what the server actually does where the document is silent or different. The list below was checked against a running server in October 2026:
Topic |
The spec says |
The server does |
What PGPCbot does |
|---|---|---|---|
Text length |
|
counts UTF-16 code units, the way JavaScript’s |
counts UTF-16 units |
Control characters |
not stated |
refuses all but |
turns |
Empty text |
|
trims with JavaScript’s |
the same set of spaces |
|
must be the key’s |
takes it from the request body |
the SDK computes it from the key itself, so the two always match |
|
wait |
the body always says 60; the |
trusts the header |
|
an example with a few names |
more names ( |
types the known ones, keeps all in |
Readable text |
the text |
trimmed, runs of empty lines folded, cut at 4000 characters |
documented; encrypted text comes exact |
|
no unit |
milliseconds |
|
Readable chats always use |
yes |
a body that merely contains |
an |
Second press on a message |
“the same press” |
a press on a different button of the same message is a new callback: a press is identified by user, message and data |
nothing to change |
|
|
|
returns what the server says |
|
|
no |
|
|
https and a public address only |
a server set up for local development can also accept http and private addresses |
leaves the scheme to the server (the integration tests rely on it) |
Command description |
|
accepts up to 1000 raw characters, and applies 256 after folding whitespace |
folds whitespace the same way, then checks 256 |
|
not in the spec |
public, no token |
downloads without the token |
Attachments in encrypted groups |
not stated |
the phone seals them to the group’s key list only, not to the bots it addresses |
documented; |