Quick Start
Go from token to first request in minutes
Create your bot
Create a bot in your MPChat workflow and keep the token private.
Verify access
Call getMe to confirm the token is active before wiring product logic.
Ship the first flow
Send a message, enable updates, and continue into the full reference when you need more methods.
Featured Methods
Start with the endpoints most bots need first
getMe
Get bot information
sendMessage
Send text message
chat_idtextparse_modegetUpdates
Get updates by polling
setWebhook
Set webhook
urlsecret_tokenmax_connectionsBrowse by category
Move from onboarding into the full API surface
Developer Notes
MPChat Bot API keeps public endpoints on one predictable path shape: https://call.mp.net/bot/bot<bot-token>/methodName. Use this page to move from setup into request details, field definitions, and product-specific notes.
Three Documentation Entry Points
- [Bot Guide](#bot-guide): what a bot is, how the token is used, the first
getMe/sendMessagecalls, and how to receive Updates. - [Bot API Reference](#bot-api-reference): method paths, request fields, response envelopes, error codes, and MPChat compatibility notes for
/bot{token}/methodName. - [MiniApp Guide](./webapps): MiniApp creation, the source of
miniapp_id,shortNamedirect links,sendMessageentry buttons, and backendinitDataverification.
Bot Guide
A bot is an MPChat account controlled by your backend. Use the bot token to call the Bot API, send messages into existing conversations, receive user or group events, and optionally send MiniApp entry points to users.
1. Create the bot and store the token. Public API paths always use https://call.mp.net/bot/bot<bot-token>/methodName; the real token only appears in the bot<bot-token> path segment.
2. First getMe call: confirm the token is valid, the bot username is correct, and the username is available for direct links.
3. First sendMessage: use a chat_id from an existing user or group context. A bot cannot create a conversation from nothing.
4. Choose how to receive Updates: use getUpdates long polling for development, or setWebhook with secret_token for production.
5. To open a MiniApp, read the [MiniApp Guide](./webapps) first so miniapp_id, shortName, entryUrl, direct links, and web_app.url are not mixed together.
Basics
- Authentication: put the token in the URL path, or use
/bot/methodNamewithAuthorization: Bearer <bot-token>; Bearer takes precedence when both are present. Never put a real token in public logs, screenshots, or support tickets. - Route boundary: the public Bot gateway uses
/bot.../methodName;https://core.mp.net/botsis the service namespace, for example/bots/getMe, and the documentation URL is not a Bot API route. - Request body: most write methods accept
application/json. Media methods may also supportmultipart/form-datawhere documented. - Response envelope: success uses
{ ok: true, result }; errors use{ ok: false, description, error_code }. - Rate limit: each token is limited to 30 requests per second by default. Exceeding the limit returns
429. - Error codes: common Bot API errors include
400,401,403,404,405,409,429,500, and50001. With valid authentication, an unknown method returns a Bot API JSON404, and an unsupported HTTP method on a known endpoint returns a Bot API JSON405. Authentication and rate limiting still return JSON401or429first. - Bot blocked by user: sending to that private chat, including forwarding or copying, returns HTTP
403,error_code: 403, andForbidden: bot was blocked by the user. The service does not retry automatically. A rejected batch stops subsequent sends and keeps messages already sent. Once the user unblocks the bot, a new send request can succeed. - Integer-like IDs: some ID fields accept either an integer from
0to9007199254740991, or a decimal string representing the same safe integer range.
Receive Updates
Use getUpdates for long polling, or configure Webhook with setWebhook.
getUpdatessupportsoffset,limit,timeout, andallowed_updates. Omission keeps the stored policy, an empty array resets to the default set, and a non-empty array stores an explicit set; the default excludeschat_member,message_reaction, andmessage_reaction_count.setWebhookrequires an HTTPS URL. Ifsecret_tokenis set, the same value is returned in the webhook request header for signature-style validation on your side. Webhook andgetUpdatesshare the policy above, and filtered updates are not counted as pending.- Group creation, member joins and departures, title changes, photo changes, and owner changes use
Update.message.group_chat_created,new_chat_members,left_chat_member,new_chat_title,new_chat_photo, andchat_owner_changedrespectively. - Group message pins use
Update.message.pinned_message; anInaccessibleMessageis returned when the original identity exists but its content cannot be accessed. - Member status uses
Update.my_chat_member/Update.chat_member, and join requests includeUpdate.chat_join_request.user_chat_id. Kafka-sourced group events and join-request actions remain pre-release. - Calling
getUpdateswhile Webhook is enabled returns409.
MiniApp
- [MiniApp API](./webapps):
miniapp_idsource,mp.net/{botUsername}/{shortName}direct link rules,sendMessageentry sending,window.MpChat.WebAppinitialization,initDatabackend verification, and field support status. - [Telegram compatibility notes](./miniapp-telegram-differences.md): phase one does not support
web_app_data,sendData,answerWebAppQuery, or platform access token exchange. - [QA checklist](./miniapp-qa-checklist.md): positive signatures, tampered signatures, expired
auth_date, disabled apps, ownership, and per-botshort_nameuniqueness. recallMessage/recallMessagesare MPChat extension methods for recall.deleteMessage/deleteMessagesremain the compatible delete methods. In group chats, administrator bots with the Recall messages permission can handle regular member messages, but not owner or administrator messages.
Message Edit Compatibility
MPChat currently exposes exactly four message-edit methods. All use chat_id + message_id and return Message on success:
| Method | Editable targets | Fields accepted in one edit | Content types |
|---|---|---|---|
editMessageText | Native text and media-free V1/V2 Inline text | text, entities, link preview, buttons | JSON, form |
editMessageCaption | photo, video, animation, document | caption, caption entities, buttons (non-empty only on V2 media) | JSON, form |
editMessageMedia | Same-type photo, video, animation, document | media, caption/entities, buttons (non-empty only on V2 media) | JSON, form, multipart attach:// |
editMessageReplyMarkup | Native text and V1/V2 Inline | Buttons only; all other content is preserved | JSON, form |
This release changes compound edits to replacement semantics. Omitting reply_markup, passing null, or sending an empty keyboard clears old buttons. An omitted or empty media caption clears old caption/entities. Omitting entities from editMessageText reruns raw-mention enhancement; an explicit empty array clears entities without enhancement. Resubmit the complete old button or caption value when it must be preserved.
Business/inline messages, parse_mode, Rich/game messages, show_caption_above_media, audio/live-photo, albums, cross-type replacement, and text/rich-to-media currently return an explicit 400; they are never silently ignored. Other Telegram edit* methods are not exposed by MPChat and remain visible in the unsupported-method list at the end of the page.
sendPhoto, sendVideo, sendAnimation, and sendDocument all accept caption_entities. Omission keeps raw-mention enhancement, while an explicit empty array disables it. sendDocument.reply_markup is explicitly rejected with 400.
Bot API Reference
The main reference below is generated from openapi.yaml and shows the MPChat Bot API methods that are currently available.
When MPChat behavior differs from common Bot API expectations, the page shows a short difference note so you can adjust client logic early.
FAQ
- Can I reuse an existing
file_id? Not in the current MPChat Bot API. Use a public URL or multipart upload where the method supports it. - Does
banChatMemberkick a user? No. In the current MPChat Bot API it restricts the member from speaking instead of removing them from the chat. - Can a bot start a conversation first? No. A user or chat must establish context before bot interaction can continue.
- Where should docs be deployed? The public documentation page is designed for
https://core.mp.net/bots.
Large local files with the Node.js SDK
Install the published server-side @mpchat/bot-sdk package from npm. It automatically uploads and sends media without OSS credentials, another upload SDK, or an H5 page:
npm install @mpchat/bot-sdk
import { MPChatBot } from '@mpchat/bot-sdk';
const bot = new MPChatBot({
token: process.env.MPCHAT_BOT_TOKEN!,
apiBaseUrl: 'https://call.mp.net/bot',
});
const message = await bot.sendVideo(chatId, './video.mp4', {
onProgress: ({ percent }) => console.log(percent),
});
await bot.sendDocument(chatId, './report.zip');
Requires Node.js 20.11+. apiBaseUrl is the Bot API prefix without /bot<token>/methodName; the SDK appends that path. Use HTTPS in production and keep the token on the developer's server. Local uploads use independent 8 MiB requests and support up to 1 GiB. MP4 videos above the existing 500 MiB video threshold follow the server's document fallback. Upload progress reaching 100% is separate from successful message delivery. Use resume: error.checkpoint after upload failures; provide an AbortSignal to cancel. When error.phase === 'send' and error.uncertain is true, verify delivery before sending again. Final sends are never automatically retried.
The five media upload methods below are MPChat extensions and are not available through MTProto or a Local Bot API Server. Most developers only need the SDK sendVideo / sendDocument methods. Additional capabilities will be delivered in future SDK releases.
MiniApp API
MPChat Bot MiniApp API
MPChat MiniApps use an MPChat SDK object named window.MpChat.WebApp. To make migration easier for existing MiniApps, some field names follow common MiniApp conventions; the supported scope is defined by the status notes in this document.
Current phase focuses on opening the MiniApp, exposing signed initialization data, and letting your backend verify user identity. It does not implement the full WebApp JavaScript API surface.
MiniApp Guide
- Creating a MiniApp requires the short name (
shortName), title, description, icon, and Web App URL (entryUrl). After creation, recordminiapp_id,shortName, andentryUrl;miniapp_idis generated by MPChat and is not a frontend-defined page ID. - Send
web_app.urlwithsendMessageso users can open the MiniApp from a message button. The request body does not need a separateminiapp_id. - Open it directly with
https://mp.net/{botUsername}/{shortName};botUsernameresolves the bot, andshortNameresolves the specific MiniApp owned by that bot. - Read the raw signed string from
window.MpChat.WebApp.initDataon the frontend and send it to your backend. - Verify
hashandauth_datewith the bot token on the backend before trusting user, chat, orminiapp_idfields.
Core Identifiers
Creating and opening a MiniApp involves a few similar identifiers with different roles:
| Name | Source | Purpose |
|---|---|---|
miniapp_id | Generated by MPChat after you create a MiniApp in BotFather with /newapp or through the internal MiniApp management API. It usually looks like ma_.... | MiniApp business identifier. It appears in creation results, BotFather MiniApp details, the internal sharing payload as appID, and the signed launch context field initData.miniapp_id. |
shortName / short_name | The short link name you set when creating the MiniApp; this is the short name prompt in BotFather /newapp. | Combined with the bot username to form a direct link: https://mp.net/{botUsername}/{shortName}. It is unique under the same bot and resolves a specific MiniApp. |
entryUrl / entry_url | The H5 entry URL you set when creating the MiniApp. | The page users ultimately open. sendMessage can use this URL in web_app.url. |
botUsername | The bot username. | Used as the first path segment in direct links, such as demo_bot in https://mp.net/demo_bot/demo_app. |
miniapp_id is not a frontend-defined page ID, and it is not the same thing as shortName. If your backend binds a request to one MiniApp, verify the raw initData first, then check that the signed miniapp_id matches the value you expect.
shortName rule: BotFather /newapp currently accepts ^[a-zA-Z0-9_]{3,30}$, meaning 3 to 30 characters, letters, digits, and underscore only, and it is case-sensitive. Do not include spaces, slashes, question marks, non-ASCII characters, @, or hyphens. The lower-level internal MiniApp management API follows its own field schema in the API Reference; public creation through /newapp should follow the BotFather rule.
Integration Flow
- Create a MiniApp in BotFather with
/newapp: choose the bot, then enter the title, description, icon, Web App URL (entryUrl), and short name (shortName). After creation, record theminiapp_id,shortName, and entry URL. - To share a MiniApp link with users, use the direct link shape
https://mp.net/{botUsername}/{shortName}, for examplehttps://mp.net/demo_bot/demo_app. - Add the MPChat WebApp SDK to your MiniApp page.
- Read initialization data synchronously from
window.MpChat.WebAppafter the SDK is loaded. - Send the raw
initDatastring to your backend. - Verify the
hashwith the bot token before trusting user, chat, or MiniApp fields. - Map the verified
user.idto your own account model if your product needs a durable user account.
Never store the bot token in frontend code. Do not put the bot token in WebView code, browser storage, URLs, logs, screenshots, analytics, or error reporting.
Sending a MiniApp entry
Use sendMessage to send a message with a button that opens a MiniApp. Put the button configuration in reply_markup.inline_keyboard[].web_app; the server uses web_app.url to identify the MiniApp owned by the current bot and generate the entry message.
Ordinary web_app inline keyboards, reply keyboards, and message edits are supported only in private chats with the current bot.
sendMessage keeps one MPChat group-sharing compatibility path: when inline_keyboard has exactly one row with one button and that button contains only text and web_app, the MiniApp sharing card may be sent to a group or supergroup that the bot has joined. Channels are not supported by this exception; all other web_app button combinations in groups or supergroups return { ok: false, error_code: 400 }.
An unsupported chat context returns the chat-type error before MiniApp lookup. MiniApp lookup runs only for an allowed private chat or strict group share. Before a positive test, configure a matching enabled MiniApp for the current bot. MiniApp not found or MiniApp is disabled in an allowed context means that prerequisite is missing and does not verify the chat-type restriction.
The sendMessage request body does not require miniapp_id. Provide web_app.url: the server accepts a MiniApp entryUrl registered under the current bot, or the fixed platform direct-link form https://mp.net/{currentBotUsername}/{shortName}. A direct link can carry arbitrary query parameters, for example https://mp.net/demo_bot/demo?startapp=from_message&mode=compact&ref=campaign; the server resolves a MiniApp only from the host, path, current Bot username, and registered shortName, and never guesses a MiniApp from query parameters or an arbitrary URL's final path segment. After resolution, the internal MiniApp sharing payload contains appID = miniapp_id and preserves the original direct link with all query parameters for the client to process startapp when opened. Bot API callers do not need to build miniProgramSharing://, an internal IM message body, or launch context.
Minimal request example:
{
"chat_id": "12345",
"text": "Open Demo MiniApp",
"reply_markup": {
"inline_keyboard": [[
{
"text": "Open",
"web_app": {
"url": "https://mp.net/demo_bot/demo?startapp=from_message"
}
}
]]
}
}
The successful response keeps the Telegram-style { ok: true, result: Message } envelope, and result.reply_markup.inline_keyboard preserves web_app.url. Internally MPChat verifies that the URL maps to an enabled MiniApp owned by the current bot, then converts the message to an RC:ImgTextMsg MiniApp sharing message. MiniApp data is stored in the internal content.url value as miniProgramSharing:// JSON; Bot API callers do not need to construct the internal IM message body.
If the message should keep only the text and button semantics without showing any preview card, set link_preview_options.is_disabled = true in the same /bot{token}/sendMessage request. This disables both normal link previews and the web_app MiniApp entry card. The server still verifies that web_app.url belongs to an enabled MiniApp owned by the current bot, but the internal message is sent as RC:TxtMsg and does not build RC:ImgTextMsg or miniProgramSharing://. The disabled state is written to the platform-reserved top-level field extra.link_preview_options inside the IM message content.extra, so MPChat clients and later non-Bot message producers can reuse the same rendering rule. Bot API callers still do not construct internal IM message bodies.
Example with the entry card disabled:
{
"chat_id": "12345",
"text": "Open Demo MiniApp",
"link_preview_options": {
"is_disabled": true
},
"reply_markup": {
"inline_keyboard": [[
{
"text": "Open",
"web_app": {
"url": "https://mini.example.com/demo"
}
}
]]
}
}
Sending Member Invitation Mentions
A MiniApp can let the user choose members from the group member list, then have the bot call sendMessage to send member invitation mentions. Put the visible @ text in text, and use entities to mark which text range belongs to which user:
{
"chat_id": "12345",
"text": "@Chen @Lei invites you to this activity",
"entities": [
{
"type": "text_mention",
"offset": 0,
"length": 5,
"user": {
"id": "2000000154"
}
},
{
"type": "text_mention",
"offset": 6,
"length": 4,
"user": {
"id": "2000000168"
}
}
]
}
entities[].user.id is the user id returned by the Bot API / MiniApp surface. The server verifies that each text_mention target user is in the group, then the platform generates the group @ reminder. Bot API callers only need to send text and entities; do not build internal message fields or put mention targets in extra.
If a group-chat sendMessage request omits entities entirely, the server attempts to resolve raw @username text by unique group-member username match and auto-fill text_mention. Text without a unique match is sent as normal text.
entities currently supports only text_mention, which generates a group @ reminder.
This feature supports specific group members only. It does not support @all, and it does not infer targets from raw @nickname, display-name, or fuzzy text matches. entities works for normal text messages and for reference messages with reply_to_message_id; do not combine it with reply_markup.inline_keyboard[].web_app entry cards yet. web_app messages do not trigger username auto-fill.
Direct Link Rules
MiniApp direct links use this fixed shape:
https://mp.net/{botUsername}/{shortName}
Direct links with a launch parameter use startapp:
https://mp.net/{botUsername}/{shortName}?startapp=command
Example: https://mp.net/{botUsername}/{shortName}?startapp=command.
A direct link may include multiple query parameters, for example https://mp.net/{botUsername}/{shortName}?startapp=command&mode=compact&ref=campaign. The server does not use query parameters to resolve MiniApp ownership and preserves the original URL; startapp retains its launch-parameter behavior.
{botUsername}is the bot username. Do not include@in the URL path.{shortName}is the short link name you set when creating the MiniApp. For BotFather/newapp, it must match^[a-zA-Z0-9_]{3,30}$and is case-sensitive.shortNameis unique under the same bot. Different bots may use the sameshortName.- Passing only
botUsernameresolves only the bot and does not select a default MiniApp; includeshortNameto open a specific MiniApp. - If the direct link includes
?startapp=command,startappis passed as the signedinitData.start_param; the MiniApp frontend can read the same value fromwindow.MpChat.WebApp.initDataUnsafe.startParamfor page routing. The backend should still trust only thestart_paramvalue after verifying the rawinitData.
When a user opens a MiniApp through a direct link, MPChat resolves the MiniApp by botUsername + shortName, then generates the launch context. The miniapp_id in that launch context is a signed field, so your backend can use it to confirm which MiniApp the request belongs to.
Initializing Mini Apps
Add the SDK script before your MiniApp code:
<script src="https://mp.net/i/mpchat-web-app.js"></script>
After the SDK is loaded, window.MpChat.WebApp exposes initialization data synchronously:
<script>
const initData = window.MpChat.WebApp.initData;
const initDataUnsafe = window.MpChat.WebApp.initDataUnsafe;
console.log("initData:", initData);
console.log("initDataUnsafe:", initDataUnsafe);
</script>
initData is the original signed query string. Send this exact string to your backend and verify it before use.
initDataUnsafe is the parsed object for UI display and convenience. It is not trusted data. Do not use it as proof of identity, login state, payment ownership, or authorization.
WebApp Field Support
Status: Supported means MPChat provides stable runtime semantics that can be used as described in this document. Partially supported means the compatibility entry point or object structure exists, but MPChat currently only commits to the core fields listed here; unlisted fields are not guaranteed to exist or behave the same way. Not supported yet means the field or method is reserved for compatibility planning and should not be used in production.
| Category | Field or method | Type | Status | Notes |
|---|---|---|---|---|
| Data | initData | String | Supported | Raw signed initialization string for backend verification. |
| Data | initDataUnsafe | WebAppInitData | Partially supported | Parsed convenience object covering the current MiniApp launch, user, and chat context fields. Use initData for security checks. |
| Runtime metadata | version, platform, colorScheme, themeParams | String or object | Not supported yet | Planned runtime metadata. |
| View state | isActive, isExpanded, viewportHeight, viewportStableHeight, headerColor, backgroundColor, bottomBarColor | Boolean, number, or string | Not supported yet | Planned UI state fields. |
| View state | isClosingConfirmationEnabled, isVerticalSwipesEnabled, isFullscreen, isOrientationLocked, safeAreaInset, contentSafeAreaInset | Boolean or object | Not supported yet | Planned view and safe-area controls. |
| UI objects | BackButton, MainButton, SecondaryButton, SettingsButton, HapticFeedback | Object | Not supported yet | Planned native UI controls. |
| Storage and device objects | CloudStorage, BiometricManager, Accelerometer, DeviceOrientation, Gyroscope, LocationManager, DeviceStorage, SecureStorage | Object | Not supported yet | Planned storage and device APIs. |
| Methods | isVersionAtLeast, setHeaderColor, setBackgroundColor, setBottomBarColor, ready, expand, close, onEvent, offEvent | Function | Not supported yet | Planned WebApp methods. |
| Methods | sendData, switchInlineQuery, openLink, openMPChatLink, openInvoice, popup, QR, contact, sharing, fullscreen, orientation, home screen, download, storage, and device methods | Function | Not supported yet | Do not rely on client return flows in the current phase. |
If you call native methods through window.MpChat.WebApp.call(methodName, params), only use methods explicitly announced as supported by your MPChat client version.
WebAppInitData
This object contains data transferred to the MiniApp when it is opened. MPChat uses signed field names in initData to carry launch context, so existing MiniApps can integrate and backends can verify the payload consistently. initDataUnsafe is a parsed convenience object and may additionally expose camelCase derived fields for display or frontend reads.
| Field | Type | Status | MPChat parsed field | Notes |
|---|---|---|---|---|
query_id | String | Supported | queryId | MiniApp session identifier. In the current phase it is only session context and cannot be used to trigger return flows. |
user | WebAppUser | Partially supported | user | Current user. See WebAppUser field support. |
receiver | WebAppUser | Not supported yet | - | Attachment-menu private chat receiver. |
chat | WebAppChat | Partially supported | chat | Chat context when available. See WebAppChat field support. |
chat_type | String | Supported | chatType | Supports only private, group, or supergroup. |
chat_instance | String | Not supported yet | - | Direct-link chat instance identifier. |
start_param | String | Supported | startParam | Launch parameter, also useful for loading the correct MiniApp screen. |
can_send_after | Integer | Not supported yet | - | Return-flow delay field. Not used by current MPChat return flow. |
auth_date | Integer | Supported | authDate | Unix timestamp when the MiniApp was opened. Validate freshness on your backend. |
bot_id | Integer | Supported | botId | MPChat extension containing the current bot's server-side internal identifier. It is included in the signed launch context. |
miniapp_id | String | Supported | miniappId | MPChat extension containing the current MiniApp business identifier. Backends bound to one MiniApp must compare this field after verification. |
nonce | String | Supported | nonce | MPChat extension containing a server-generated random value. It is signed and can be used for application-level replay checks. |
hash | String | Supported | hash | HMAC hash used for backend verification. |
signature | String | Not supported yet | - | Third-party Ed25519 validation field. |
WebAppUser
User IDs may have more than 32 significant bits. Store them as a safe integer or decimal string in systems where integer precision matters.
| Field | Type | Status | MPChat parsed field | Notes |
|---|---|---|---|---|
id | Integer | Supported | id | Global user surrogate ID assigned by mp-bot-service. |
is_bot | Boolean | Not supported yet | - | Indicates that the receiver is a bot. |
first_name | String | Supported | firstName | User first name. |
last_name | String | Not supported yet | - | Optional user last name. |
username | String | Supported | username | Optional username. |
email | String | Supported | email | MPChat extension. Optional after user authorization; appears only when an Email is available and is omitted otherwise. |
language_code | String | Supported | languageCode | Optional RFC 5646 / BCP 47 language tag. |
is_premium | Boolean | Supported | isPremium | Optional premium flag when available. |
added_to_attachment_menu | True | Not supported yet | - | Attachment-menu flag. |
allows_write_to_pm | True | Not supported yet | - | Private-chat write-permission flag. |
photo_url | String | Supported | photoUrl | Optional profile photo URL. When provided upstream, it is written to the raw initData with the user JSON and signed. |
WebAppChat
Chat IDs may also exceed 32-bit integer range. Store them with the same precision care as user IDs.
| Field | Type | Status | MPChat parsed field | Notes |
|---|---|---|---|---|
id | Integer | Supported | id | Unique chat identifier. |
type | String | Supported | type | group, supergroup, or channel. |
title | String | Supported | title | Chat title. |
username | String | Supported | username | Optional chat username. |
photo_url | String | Not supported yet | - | Optional chat photo URL. |
MPChat Extension Fields
These fields are MPChat additions exposed for frontend routing and backend checks. Raw initData and the server-side init_data_unsafe object use snake_case fields; the MPChat WebApp runtime may also expose the camelCase parsed fields shown below. They do not replace signed initData verification.
| Raw field | Parsed field | Type | Notes |
|---|---|---|---|
bot_id | botId | Int64 | Current bot's server-side internal identifier, useful for frontend routing. |
miniapp_id | miniappId | String | Current MiniApp business ID. When binding requests to one MiniApp, verify the signed miniapp_id in the raw initData; do not trust an extra unsigned miniappId submitted by the frontend. |
nonce | nonce | String | Server-generated random value. Treat it as signed context and verify it through initData; for replay protection, the application backend must also record and reject reused nonces. |
MPChat initData verification
Verify initData on your backend:
- Parse
initDataas a query string. - Extract
hashand remove it from the signed field set. - Sort the remaining fields by key, format them as
key=valuelines, and join them with\nto builddata_check_string. - Compute the secret key with
HMAC-SHA256, usingWebAppDataas the key and the bot token as the message. - Compute the expected hash with
HMAC-SHA256, using the secret key as the key anddata_check_stringas the message. - Compare the expected hash and the received
hashin constant time. - Check that
auth_dateis still valid. A 300-second TTL is recommended by default. - If your backend binds a request to one MiniApp, also verify that the signed
miniapp_idmatches your expected MiniApp. Do not trust an extra unsignedminiappIdsubmitted by the frontend. user.emailis signed with theuserJSON when present, and optionaluser.photo_urluses the same signed payload. Verify the rawinitDatabefore using either field.
Node.js Verification Example
import { createHmac, timingSafeEqual } from "node:crypto";
function buildCheckString(fields: URLSearchParams): string {
return [...fields.entries()]
.filter(([key]) => key !== "hash")
.sort(([left], [right]) => left.localeCompare(right))
.map(([key, value]) => `${key}=${value}`)
.join("\n");
}
export function verifyMiniAppInitData(
initData: string,
botToken: string,
options: { nowSeconds?: number; ttlSeconds?: number; miniappId?: string } = {},
) {
const params = new URLSearchParams(initData);
const hash = params.get("hash");
const authDate = Number(params.get("auth_date"));
const miniappId = params.get("miniapp_id");
if (!hash || !Number.isFinite(authDate)) {
throw new Error("INIT_DATA_INVALID");
}
const checkString = buildCheckString(params);
const secret = createHmac("sha256", "WebAppData").update(botToken).digest();
const expectedHash = createHmac("sha256", secret).update(checkString).digest("hex");
const left = Buffer.from(hash, "hex");
const right = Buffer.from(expectedHash, "hex");
if (left.length !== right.length || !timingSafeEqual(left, right)) {
throw new Error("INIT_DATA_INVALID");
}
const nowSeconds = options.nowSeconds ?? Math.floor(Date.now() / 1000);
const ttlSeconds = options.ttlSeconds ?? 300;
if (nowSeconds - authDate > ttlSeconds) {
throw new Error("INIT_DATA_INVALID");
}
if (options.miniappId && miniappId !== options.miniappId) {
throw new Error("MINIAPP_FORBIDDEN");
}
const userRaw = params.get("user");
if (!userRaw) {
throw new Error("INIT_DATA_INVALID");
}
return JSON.parse(userRaw) as {
id: number | string;
first_name: string;
username?: string;
email?: string;
language_code?: string;
};
}
Recommended Error Codes
| Scenario | Code | Notes |
|---|---|---|
initData is missing fields, malformed, tampered, or expired | INIT_DATA_INVALID | Do not expose signature internals. |
| MiniApp does not exist | MINIAPP_NOT_FOUND | Useful for wrong entry configuration. |
| MiniApp is disabled | MINIAPP_DISABLED | The frontend should show an unavailable state. |
miniapp_id does not belong to the expected bot or business context | MINIAPP_FORBIDDEN | Do not expose internal bot IDs or database IDs. |
Error responses and logs must not include the bot token, token_enc, full initData, database IDs, stack traces, or sensitive config.
Platform Endpoints Not Provided
MPChat Bot MiniApp phase one does not provide /miniapp/auth/token/verify or /miniapp/auth/userinfo, and it does not issue platform access tokens. Your backend does not need to call a platform Bearer-token endpoint to retrieve user information.
User information comes from verified initData.user. When authorized and available, read Email from verified initData.user.email; when authorization or Email is absent, the field is omitted. Complete client data return capabilities are not supported in the current phase, including web_app_data, sendData, and answerWebAppQuery flows.
Generated from openapi.yaml
API Methods
Core
Core
Bot identity, lifecycle, and update polling.
/bot{token}/getMe
getMe Get bot information
Returns the current Bot as a Telegram `User`. `result.id` (that is, `getMe.id`) is the Bot's global surrogate user ID. It is identical to the Bot ID in `Message.from`, `CallbackQuery.message.from`, and `ChatMember.user`, and `getMe.id` can be used directly as `getChatMember.user_id` when querying the current Bot.
No request body fields.
200 Returns bot user information401
curl -X GET "https://call.mp.net/bot/bot<bot-token>/getMe" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/getMe
getMe Get bot information (POST)
Returns the current Bot as a Telegram `User`. `result.id` (that is, `getMe.id`) is the Bot's global surrogate user ID. It is identical to the Bot ID in `Message.from`, `CallbackQuery.message.from`, and `ChatMember.user`, and `getMe.id` can be used directly as `getChatMember.user_id` when querying the current Bot.
No request body fields.
200 Returns bot user information401
curl -X POST "https://call.mp.net/bot/bot<bot-token>/getMe" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/getMyDefaultNotification
getMyDefaultNotification Get the Bot default notification policy
Returns the current Bot's global default notification policy. Private and group chats share this one value; an unset value returns `false` to preserve audible delivery.
No request body fields.
200 Default notification policy401
curl -X POST "https://call.mp.net/bot/bot<bot-token>/getMyDefaultNotification" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/getUpdates
getUpdates Get updates by polling
Polls for pending updates. **Note**: calling this method while a webhook is configured returns 409 Conflict. **Retention**: pending updates that have not been successfully delivered are retained for at most 24 hours; older updates are no longer returned. **timeout**: supports `0..50` seconds of long polling. If updates are already available, the response returns immediately; otherwise the server waits up to `timeout` seconds before returning an empty array. **allowed_updates**: a non-empty array stores and uses an explicit type set; an empty array resets the policy to the default set; omission keeps the Bot's stored policy, using the default set only when none exists. The default set excludes `chat_member`, `message_reaction`, and `message_reaction_count`. A successful response consumes only the updates actually returned in that batch.
The group-service contract includes `group_chat_created`, `new_chat_members`, `left_chat_member`, `new_chat_title`, `new_chat_photo`, `pinned_message`, and `chat_owner_changed`; member updates include `my_chat_member` / `chat_member`, and join requests include `chat_join_request.user_chat_id`. Omitted `allowed_updates` keeps the stored policy, an empty array resets to the default set, and a non-empty array stores an explicit set; the default excludes `chat_member`, `message_reaction`, and `message_reaction_count`. Kafka-sourced group events remain pre-release, while join-request actions remain unavailable.
No request body fields.
200 List of updates400 401 409 Conflict — webhook is already configured, so getUpdates cannot be used
curl -X GET "https://call.mp.net/bot/bot<bot-token>/getUpdates" \
-H "Content-Type: application/json" \
-d '{
"timeout": 30,
"limit": 50
}'
/bot{token}/getUpdates
getUpdates Get updates by polling (POST)
Same behavior as GET. Supports `0..50` seconds of long polling; when no updates are currently available, the server waits up to `timeout` seconds. Omitted **allowed_updates** keeps the stored policy, an empty array resets it to the default set, and a non-empty array stores an explicit set. A successful response consumes only the returned batch.
The group-service contract includes `group_chat_created`, `new_chat_members`, `left_chat_member`, `new_chat_title`, `new_chat_photo`, `pinned_message`, and `chat_owner_changed`; member updates include `my_chat_member` / `chat_member`, and join requests include `chat_join_request.user_chat_id`. Omitted `allowed_updates` keeps the stored policy, an empty array resets to the default set, and a non-empty array stores an explicit set; the default excludes `chat_member`, `message_reaction`, and `message_reaction_count`. Kafka-sourced group events remain pre-release, while join-request actions remain unavailable.
| Field | Type | Required | Description |
|---|---|---|---|
offset |
integer | no | |
limit |
integer | no | |
timeout |
integer | no | |
allowed_updates |
array<string> | no |
200 List of updates400 401 409 Conflict — webhook is already configured
curl -X POST "https://call.mp.net/bot/bot<bot-token>/getUpdates" \
-H "Content-Type: application/json" \
-d '{
"timeout": 30,
"limit": 50
}'
/bot{token}/logOut
logOut Log out bot
Marks the bot as inactive, clears related cache, and disables associated webhooks.
No request body fields.
200 Bot logged out401
curl -X POST "https://call.mp.net/bot/bot<bot-token>/logOut" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/setMyDefaultNotification
setMyDefaultNotification Set the Bot default notification policy
Sets the current Bot's global default notification policy. Future send or pin calls that omit `disable_notification` use this value; an explicit request value takes precedence.
| Field | Type | Required | Description |
|---|---|---|---|
default_disable_notification |
boolean | yes | Default silent-delivery value used when this Bot omits `disable_notification`. |
200 Updated default notification policy400 401
curl -X POST "https://call.mp.net/bot/bot<bot-token>/setMyDefaultNotification" \
-H "Content-Type: application/json" \
-d '{}'
Message
Message
Send text, media, location, poll, and chat action messages.
/bot{token}/answerCallbackQuery
answerCallbackQuery Answer a callback query
Ends client loading within 300 seconds of the callback. Currently, only `callback_query_id` has an effect in IM clients. To preserve Telegram compatibility, the API still accepts `text` and `show_alert`; the server currently filters user-provided `text`, while `show_alert` remains in the protocol but clients do not yet display a Toast or Alert. Each button press creates a distinct callback query. The same `callback_query_id` can succeed only once; repeated, in-flight, expired, or invalid IDs return 400 without sending another control message. Telegram `url` and `cache_time` are not supported.
Only callback_query_id currently has an effect in MP clients. For Telegram compatibility, the API still accepts text up to 200 characters and show_alert, but the server filters user-provided text; show_alert remains in the protocol and clients do not display a Toast or Alert yet. The answer window is fixed at 300 seconds; url and cache_time are not supported. Each button press creates a distinct callback query. The same callback_query_id can succeed only once; repeated, in-flight, expired, or invalid IDs return 400 without sending another control message.
| Field | Type | Required | Description |
|---|---|---|---|
callback_query_id |
string | yes | The `callback_query.id` received by the current bot; the answer window is fixed at 300 seconds. |
text |
string | no | Telegram compatibility field; currently filtered by the server until IM clients support it. |
show_alert |
boolean | no | Telegram compatibility field retained in the protocol; IM clients do not display an Alert yet. |
200 First answer accepted successfully400 401 403 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/answerCallbackQuery" \
-H "Content-Type: application/json" \
-d '{
"callback_query_id": "callback-message-uid"
}'
/bot{token}/sendAnimation
sendAnimation Send an animation
Sends a GIF or silent H.264/MPEG-4 animation from an HTTPS URL, form URL, or multipart upload. Animations always use `MM:MpBotInlineMsg V2`; `reply_markup` accepts the four strict Telegram variants documented by this service. Existing `file_id` reuse is not supported. A group target where the bot is not a member returns 403. `caption_entities` supports the same explicit `text_mention` validation and UTF-16 offsets as text entities. When omitted, a non-empty caption automatically resolves raw `@username`; an explicit empty array disables automatic enhancement. If the user has blocked the bot in a private chat, sending returns HTTP `403`, `error_code: 403`, and `Forbidden: bot was blocked by the user`.
MP supports animation HTTPS URLs, multipart upload, caption_entities, disable_notification, and the documented reply_markup subset. It always maps to MM:MpBotInlineMsg V2 and does not support existing file_id reuse. Omitted caption_entities enables raw-mention enhancement; an explicit empty array disables it. Ordinary Inline button url also supports HTTP/HTTPS/mppay:// with the same client support as sendMessage.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
animation |
string:uri | yes | Public HTTPS animation URL. |
duration |
integer | no | |
width |
integer | no | |
height |
integer | no | |
caption |
string | no | |
caption_entities |
array<MessageEntity> | no | Explicit caption entities. Form/multipart requests use a JSON array string; an empty array disables raw-mention auto-enhancement. |
reply_markup |
InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | no | Canonical Telegram ReplyMarkup union. An object must match exactly one discriminator field. Undeclared fields and unsupported Telegram button actions return 400. |
disable_notification |
boolean | no | Whether to deliver silently. When omitted, the Bot default policy applies and defaults to audible delivery. |
200 Sent successfully400 401 403 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/sendAnimation" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "12345",
"animation": "https://example.com/animation.gif",
"caption": "animation"
}'
/bot{token}/sendChatAction
sendChatAction Send chat action
Sends a temporary chat action indicator. Clients usually show this state briefly and do not persist it as a message.
This method is currently not supported and returns 501.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
action |
enum(typing | upload_photo | record_video | upload_video | upload_document | choose_sticker | find_location | record_voice | upload_voice) | yes |
200 Chat action sent400 401
curl -X POST "https://call.mp.net/bot/bot<bot-token>/sendChatAction" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/sendDocument
sendDocument Send document message
Sends a document message to the specified MPChat conversation. Supports public file URLs and multipart uploads; existing `file_id` reuse is not currently supported. `caption_entities` supports the same explicit `text_mention` validation and UTF-16 offsets as text entities. When omitted, a non-empty caption automatically resolves raw `@username`; an explicit empty array disables automatic enhancement. `reply_markup` is intentionally unsupported for documents and is rejected with 400. If the user has blocked the bot in a private chat, sending returns HTTP `403`, `error_code: 403`, and `Forbidden: bot was blocked by the user`.
MP supports public file URLs, multipart upload, caption_entities, and disable_notification, but not existing file_id reuse; reply_markup is explicitly rejected with 400.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
document |
string:uri | yes | Public file URL. Existing `file_id` reuse is not currently supported. |
caption |
string | no | |
caption_entities |
array<MessageEntity> | no | Explicit caption entities. Form/multipart requests use a JSON array string; an empty array disables raw-mention auto-enhancement. |
disable_notification |
boolean | no | Whether to deliver silently. When omitted, the Bot default policy applies and defaults to audible delivery. |
200 Sent successfully400 401 403
curl -X POST "https://call.mp.net/bot/bot<bot-token>/sendDocument" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "12345",
"document": "https://example.com/file.pdf",
"caption": "document"
}'
/bot{token}/sendLocation
sendLocation Send location message (not supported)
This method is not supported in the current release and returns `501`. The request body is still validated using the existing field rules; invalid parameters return `400`.
This method is not supported in the current release and returns 501.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
latitude |
number | yes | |
longitude |
number | yes | |
horizontal_accuracy |
number | no | |
disable_notification |
boolean | no | Whether to deliver silently. When omitted, the Bot default policy applies and defaults to audible delivery. |
400 401 501
curl -X POST "https://call.mp.net/bot/bot<bot-token>/sendLocation" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/sendMessage
sendMessage Send text message
Sends a text message to the specified MPChat conversation. Supports the `parse_mode` and `reply_to_message_id` parameters. Supports Telegram-style `reply_markup.inline_keyboard[].web_app` for MiniApp entry messages. Ordinary `web_app` inline keyboards, reply keyboards, and message edits are supported only in private chats with the current bot. `sendMessage` keeps one MPChat group-sharing compatibility path: when `inline_keyboard` contains exactly one row with one button and that button contains only `text` and `web_app`, it may be sent to a group or supergroup that the bot has joined. Channels are not supported by this exception; all other `web_app` combinations in groups or supergroups return 400. An unsupported chat context returns the chat-type error before MiniApp lookup. MiniApp resolution runs only for an allowed private chat or strict group share. Positive tests require a matching enabled MiniApp configured for the current bot; otherwise the response is `MiniApp not found` or `MiniApp is disabled`, which does not verify the chat-type restriction. A `web_app.url` must be either the current bot's registered MiniApp `entryUrl` or a platform direct link in the form `https://mp.net/{currentBotUsername}/{shortName}`. A direct link may include query parameters such as `?startapp=...&mode=compact`; query parameters do not participate in MiniApp ownership resolution. The server never infers a MiniApp from an arbitrary URL's final path segment. Supports Telegram-style `link_preview_options`; `is_disabled = true` disables normal link previews and makes `web_app` MiniApp entries send as text without an entry card. Supports `entities` for @ text ranges; currently only `text_mention` is supported. Explicit entities retain strict group-member validation and group @ reminder semantics. When a private, group, or supergroup request omits the `entities` field entirely, the server attempts global exact resolution of raw `@username` text and applies automatic enhancement. An explicit empty array disables automatic enhancement. A raw username consumes `[A-Za-z0-9_-]+`, preserves its original case, and is matched case-sensitively; email-like text is not recognized as a mention, and nicknames, display names, and fuzzy matches are never used to infer identity. The default limit is 100 raw mention tokens per message. More than 100 tokens sends the original text and must not read mention caches, perform a global lookup, replace nicknames, or build automatic entities. A cache hit cannot bypass the over-limit decision. Nickname replacement can be disabled by configuration while identity resolution and entity construction remain enabled. A clickable display entity is separate from a group @ reminder: private-chat users and group non-members can still receive display entities, while only confirmed group members produce group reminders. If the user has blocked the bot in a private chat, sending returns HTTP `403`, `error_code: 403`, and `Forbidden: bot was blocked by the user`.
reply_markup supports InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, and ForceReply. Reply Keyboard drives an independent right-side keyboard toggle without affecting the left-side Bot Menu Button. one_time_keyboard collapses after use but remains summonable, is_persistent requests continued visibility, remove_keyboard deletes effective state, and force_reply preserves the keyboard snapshot. Buttons are limited to callback_data, HTTP/HTTPS/MPPAY url, an enabled MiniApp web_app owned by the current bot, object-form copy_text, and optional style. Ordinary web_app inline keyboards, reply keyboards, and message edits are supported only in private chats with the current bot. When sendMessage receives an inline_keyboard with exactly one row and one button containing only text and web_app, that MiniApp sharing card is an MPChat group-sharing compatibility exception and may target a group or supergroup that the bot has joined. Channels are not supported by this exception; all other web_app combinations in groups or supergroups return 400 before MiniApp lookup. Allowed contexts still require a matching enabled MiniApp configured for the current bot; MiniApp not found or MiniApp is disabled means the positive-test prerequisite is missing and does not verify the chat-type restriction. Other Telegram button fields return 400. LinkPreviewOptions, text_mention, and disable_notification (request value overrides the Bot default) are supported; full web_app_data, sendData, and answerWebAppQuery return flows are not supported yet. Ordinary Inline button url supports HTTP/HTTPS and the MPChat payment scheme mppay:// (for example mppay://ord_example), preserved unchanged. This extension requires an MPChat client with MPPAY support; clients reading only the legacy keyboard projection cannot display ordinary URL buttons. The server does not validate orders or execute payments; web_app and Bot Menu Button retain separate HTTPS rules.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
text |
string | yes | |
parse_mode |
enum(Markdown | HTML) | no | |
reply_to_message_id |
integer | string | no | Message ID input. Accepts either an integer between 0 and 9007199254740991 or a decimal string representing the same safe integer range. |
entities |
array<MessageEntity> | no | @ text entity ranges. Currently only `text_mention` is supported. Explicit entities retain group-member validation and group @ reminder semantics; `user.id` is the user ID returned by the Bot API / MiniApp surface. Automatic enhancement of global raw `[A-Za-z0-9_-]+` usernames runs only when this field is omitted entirely; email text is excluded. An explicit empty array disables automatic enhancement. A successfully resolved automatic entity returns the exact-case real username from IM in `user.username`. Nickname replacement is configurable. Display entities and group reminders are independent, so private-chat users and group non-members do not receive group reminders. This field cannot be combined with `web_app` MiniApp entry cards yet. |
reply_markup |
InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | no | Canonical Telegram ReplyMarkup union. An object must match exactly one discriminator field. Undeclared fields and unsupported Telegram button actions return 400. |
link_preview_options |
object | no | Telegram-style link preview options. The service enforces `is_disabled`; `url`, `show_above_text`, `prefer_small_media`, and `prefer_large_media` are passed through as MPChat client preview rendering hints. The service does not fetch web pages or generate preview media. |
disable_web_page_preview |
boolean | no | Legacy Telegram compatibility field. When `link_preview_options` is absent and this field is true, it is treated as `link_preview_options.is_disabled = true`. |
disable_notification |
boolean | no | Whether to deliver silently. When omitted, the Bot default policy applies and defaults to audible delivery. |
200 Sent successfully400 401 403 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/sendMessage" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "12345",
"text": "@Chen @Lei invites you to this activity",
"entities": [
{
"type": "text_mention",
"offset": 0,
"length": 5,
"user": {
"id": "2000000154"
}
},
{
"type": "text_mention",
"offset": 6,
"length": 4,
"user": {
"id": "2000000168"
}
}
]
}'
/bot{token}/sendPhoto
sendPhoto Send photo message
Sends a photo message to the specified MPChat conversation. Supports public image URLs and multipart uploads; existing `file_id` reuse is not currently supported. When source metadata is available, the server uses the actual media dimensions and file size in the returned Message. Generated thumbnails target a 240-pixel longest side while preserving aspect ratio and avoiding enlargement of smaller images; a valid candidate slightly above that recommendation does not fail the request. If thumbnail generation fails, the photo is still sent without a thumbnail. `caption_entities` supports the same explicit `text_mention` validation and UTF-16 offsets as text entities. When omitted, a non-empty caption automatically resolves raw `@username`; an explicit empty array disables automatic enhancement. If the user has blocked the bot in a private chat, sending returns HTTP `403`, `error_code: 403`, and `Forbidden: bot was blocked by the user`.
MP supports public image URLs, multipart upload, caption_entities, disable_notification, and the documented reply_markup subset, but not existing file_id reuse. Omitted caption_entities enables raw-mention enhancement; an explicit empty array disables it. Ordinary Inline button url also supports HTTP/HTTPS/mppay:// with the same client support as sendMessage.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
photo |
string:uri | yes | Public image URL. Existing `file_id` reuse is not currently supported. |
caption |
string | no | |
caption_entities |
array<MessageEntity> | no | Explicit caption entities. Form/multipart requests use a JSON array string; an empty array disables raw-mention auto-enhancement. |
reply_markup |
InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | no | Canonical Telegram ReplyMarkup union. An object must match exactly one discriminator field. Undeclared fields and unsupported Telegram button actions return 400. |
full |
boolean | no | Whether to send with original-image semantics. For multipart uploads, this flag also controls the generated media metadata. |
disable_notification |
boolean | no | Whether to deliver silently. When omitted, the Bot default policy applies and defaults to audible delivery. |
200 Sent successfully400 401 403 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/sendPhoto" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "12345",
"photo": "https://example.com/cat.jpg",
"caption": "hello"
}'
/bot{token}/sendPoll
sendPoll Send poll message (currently unsupported)
This route currently retains only the shared authentication and request validation entry point; poll delivery is not supported. Parameters that do not match the request schema return `400` before the Service is called, while a valid request returns `501`. `options` must be an array of strings; a `400` caused by object options does not mean poll delivery is implemented.
This method is currently not supported and returns 501.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
question |
string | yes | |
options |
array<string> | yes | |
is_anonymous |
boolean | no | |
allows_multiple_answers |
boolean | no | |
disable_notification |
boolean | no | Whether to deliver silently. When omitted, the Bot default policy applies and defaults to audible delivery. |
400 401 501
curl -X POST "https://call.mp.net/bot/bot<bot-token>/sendPoll" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/sendVideo
sendVideo Send video message
Sends a video message to the specified MPChat conversation. Supports public video URLs and multipart uploads; existing `file_id` reuse is not currently supported. The server uses metadata from the final server-managed media object for the returned Message dimensions, duration, and file size. Request duration, width, and height values remain accepted as compatibility hints but are not used as fallback values. Display dimensions account for rotation, and the returned duration is the actual fractional duration rounded up to a whole second. Video transcoding is not performed. Videos up to 500 MiB are delivered with original-video semantics (`full=true`); videos above 500 MiB and up to 1 GiB are delivered as file messages, while larger inputs are rejected with `error_code: 400`. Every new native video requires a valid first-frame thumbnail. Thumbnails target a 240-pixel longest side while preserving aspect ratio and avoiding enlargement; server-side fallback processing is used when local generation is unavailable. The request fails before delivery with `error_code: 50001` when metadata or both thumbnail stages fail, or when bounded compression cannot keep the complete video message with its thumbnail within 131072 UTF-8 bytes. `caption_entities` supports the same explicit `text_mention` validation and UTF-16 offsets as text entities. When omitted, a non-empty caption automatically resolves raw `@username`; an explicit empty array disables automatic enhancement. If the user has blocked the bot in a private chat, sending returns HTTP `403`, `error_code: 403`, and `Forbidden: bot was blocked by the user`.
MP supports public video URLs, multipart upload, caption_entities, disable_notification, and the documented reply_markup subset, but not existing file_id reuse. Omitted caption_entities enables raw-mention enhancement; an explicit empty array disables it. Ordinary Inline button url also supports HTTP/HTTPS/mppay:// with the same client support as sendMessage.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
video |
string:uri | yes | Public video URL. Existing `file_id` reuse is not currently supported. |
duration |
integer | no | Compatibility duration hint in seconds. Final messages use the actual duration obtained from the server-managed media object. |
width |
integer | no | Compatibility width hint. Final messages use the actual rotation-normalized width. |
height |
integer | no | Compatibility height hint. Final messages use the actual rotation-normalized height. |
caption |
string | no | |
caption_entities |
array<MessageEntity> | no | Explicit caption entities. Form/multipart requests use a JSON array string; an empty array disables raw-mention auto-enhancement. |
reply_markup |
InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | no | Canonical Telegram ReplyMarkup union. An object must match exactly one discriminator field. Undeclared fields and unsupported Telegram button actions return 400. |
full |
boolean | no | Compatibility input. Because the service does not currently transcode videos, direct videos up to 500 MiB always use `full=true`. |
disable_notification |
boolean | no | Whether to deliver silently. When omitted, the Bot default policy applies and defaults to audible delivery. |
200 Sent successfully400 401 403 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/sendVideo" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "12345",
"video": "https://example.com/video.mp4",
"caption": "video"
}'
Management
Management
Edit, pin, delete, forward, and copy messages.
/bot{token}/copyMessage
copyMessage Copy message
Copies an existing message into the target conversation and returns the new `message_id`. The result does not include `forward_from`. Returns 400 when the source message does not exist, is not accessible, or the message type is not currently supported for copying. If the user has blocked the bot in a private chat, sending returns HTTP `403`, `error_code: 403`, and `Forbidden: bot was blocked by the user`.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
from_chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_id |
integer | string | yes | Message ID input. Accepts either an integer between 0 and 9007199254740991 or a decimal string representing the same safe integer range. |
caption |
string | no | |
disable_notification |
boolean | no | Whether to deliver silently. When omitted, the Bot default policy applies and defaults to audible delivery. |
200 Copied successfully400 401 403 404 The source message does not exist or is not accessible to the current bot500 Internal service error
curl -X POST "https://call.mp.net/bot/bot<bot-token>/copyMessage" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/copyMessages
copyMessages Copy messages in batch
Copies the specified messages one by one using `copyMessage` semantics. Returns 400 when any source message does not exist, is not accessible, or the message type is not currently supported for copying. The response does not include partial `message_ids` results. If the user has blocked the bot in a private chat, sending returns HTTP `403`, `error_code: 403`, and `Forbidden: bot was blocked by the user`. If the user blocks the bot during a batch, subsequent sends stop; messages already sent remain and are not rolled back.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
from_chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_ids |
array<MessageIdInput> | yes | |
caption |
string | no | |
disable_notification |
boolean | no | Whether to deliver silently. When omitted, the Bot default policy applies and defaults to audible delivery. |
200 Batch copy succeeded400 401 403 404 The source message does not exist or is not accessible to the current bot500 Internal service error
curl -X POST "https://call.mp.net/bot/bot<bot-token>/copyMessages" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/deleteMessage
deleteMessage Delete message
Deletes a message sent by the current bot or received by the current bot in a private chat. Every deletable message requires a trusted sent time and can be deleted only within 48 hours of that time; missing, already-deleted, or expired messages return 400. In group chats, an administrator bot with the Recall messages permission can also delete messages sent by regular members. Messages sent by the group owner or administrators cannot be deleted by another administrator bot; administrator permission does not exempt the message from the 48-hour limit, and insufficient permission returns 403.
Bot-authored messages and messages received by the Bot in a private chat require a trusted sent time and can be deleted only within 48 hours; missing, already-deleted, or expired messages return 400. An administrator bot with the Recall messages permission can delete a regular group member message, but is subject to the same time limit.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_id |
integer | string | yes | Message ID input. Accepts either an integer between 0 and 9007199254740991 or a decimal string representing the same safe integer range. |
200 Deleted successfully400 401 403 404 Message not found500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/deleteMessage" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "12345",
"message_id": 678
}'
/bot{token}/deleteMessages
deleteMessages Delete messages in batch
Deletes multiple messages sent by the current bot or received by the current bot in a private chat. Every deletable message requires a trusted sent time and can be deleted only within 48 hours of that time. An administrator bot can delete a regular group member's message only within that same time limit. In group chats, an administrator bot with the Recall messages permission can also delete messages sent by regular members. Messages sent by the group owner or administrators cannot be deleted by another administrator bot. Each request uses one chat_id and must contain 1 to 100 distinct message_ids after numeric-string normalization. Every message is checked for mapping, sender, sent time, and permission before any deletion is sent. If preflight fails, no other message in the batch is deleted. After preflight, remote deletion is sequential; an execution failure returns an error while earlier completed deletions remain effective, with no cross-service rollback.
Each request accepts one chat_id and 1 to 100 distinct message_ids after numeric-string normalization. Numeric strings and numbers are both accepted, but for example 123 and "123" are duplicates and return 400. All local preflight checks finish before sequential deletion starts; an execution failure returns an error, completed earlier items remain deleted, and no rollback is promised.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_ids |
array<MessageIdInput> | yes | Must contain 1 to 100 distinct message IDs after numeric-string normalization. |
200 Batch delete succeeded400 401 403 404 Message not found500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/deleteMessages" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "12345",
"message_ids": [
678,
"679"
]
}'
/bot{token}/editMessageCaption
editMessageCaption Edit a media caption
Edits the `caption` of a bot-authored photo, video, animation, or document using `chat_id + message_id`. Omitting the caption or passing an empty string clears both caption and entities; entities and buttons use replacement semantics. Native photo/video/document messages can update caption/entities but cannot accept non-empty buttons. V2 photo/video/animation messages can update caption/entities/buttons atomically. Business/inline messages, `parse_mode`, and `show_caption_above_media` return 400.
MP edits bot-authored photo/video/animation/document via chat_id + message_id and supports JSON/form caption, caption_entities, and replacement reply_markup. Native photo/video/document can update caption/entities but reject non-empty buttons; V2 photo/video/animation can update all three atomically. Omitted or empty caption clears old caption/entities. Business, inline_message_id, parse_mode, and show_caption_above_media return 400.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_id |
integer | string | yes | Message ID input. Accepts either an integer between 0 and 9007199254740991 or a decimal string representing the same safe integer range. |
caption |
string | no | New caption; omission or an empty string clears both caption and caption entities. |
caption_entities |
array<MessageEntity> | no | When omitted, a non-empty caption is auto-enhanced; an empty array clears entities. Form requests use a JSON array string. |
reply_markup |
InlineKeyboardMarkup | EmptyInlineKeyboardMarkup | null | no | V2 photo/video/animation messages can replace buttons atomically. Native media rejects a non-empty keyboard. Omission, null, or an empty keyboard clears buttons. |
200 Edited successfully400 401 403 404 Message does not exist, was deleted, or cannot be read429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/editMessageCaption" \
-H "Content-Type: application/json" \
-d '{
"chat_id": 12345,
"message_id": 678,
"caption": "Updated caption"
}'
/bot{token}/editMessageMedia
editMessageMedia Replace media with the same type
Replaces a bot-authored photo, video, animation, or document with media of the same type using `chat_id + message_id`. JSON/form URLs and multipart `attach://<file_attach_name>` are accepted. External URLs and uploaded files enter controlled OSS only after permission, ownership, target type, entity, and button validation. Omitting or emptying `media.caption` clears the old caption/entities. Omitting top-level `reply_markup`, passing null, or passing an empty keyboard clears old buttons. Native media does not accept non-empty buttons. Audio/live-photo, albums, cross-type edits, text-to-media conversion, Business messages, and inline messages return 400.
MP replaces bot-authored photo/video/animation/document only with the same type via chat_id + message_id. JSON/form URLs and multipart attach:// uploads are supported; controlled OSS ingestion starts only after permission, ownership, type, entity, and button validation. media caption/entities and top-level reply_markup use replacement semantics, so omission clears old values. Native media rejects non-empty buttons. Business, inline_message_id, audio/live-photo, albums, cross-type edits, text/rich-to-media, and file_id reuse are unsupported.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_id |
integer | string | yes | Message ID input. Accepts either an integer between 0 and 9007199254740991 or a decimal string representing the same safe integer range. |
media |
InputMediaPhoto | InputMediaVideo | InputMediaAnimation | InputMediaDocument | yes | InputMedia object; form/multipart requests use a JSON string. Only same-type photo/video/animation/document is accepted. `media` may be an HTTP(S) URL or multipart `attach://<file_attach_name>`. |
reply_markup |
InlineKeyboardMarkup | EmptyInlineKeyboardMarkup | null | no | V2 media can replace media, caption/entities, and buttons atomically. Native media rejects a non-empty keyboard. Omission, null, or an empty keyboard clears buttons. |
200 Edited successfully400 401 403 404 Message does not exist, was deleted, or cannot be read429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/editMessageMedia" \
-H "Content-Type: application/json" \
-d '{
"chat_id": 12345,
"message_id": 678,
"media": {
"type": "photo",
"media": "https://cdn.example.com/replacement.jpg",
"caption": "Optional new caption"
}
}'
/bot{token}/editMessageReplyMarkup
editMessageReplyMarkup Edit a message Inline Keyboard
Uses `chat_id + message_id` to replace only the buttons of a native text or locally readable Inline message sent by the current bot. For native text, the InlineKeyboardMarkup is written to `content.extra.reply_markup`, preserving the original text, `message_id`, and other message identity fields without converting it to an Inline message. Inline messages preserve text, entities, media, and other content. Omitting `reply_markup`, passing `null`, or passing an empty `inline_keyboard` removes the buttons. A replacement `web_app.url` must remain either the current bot's registered MiniApp `entryUrl` or a platform direct link in the form `https://mp.net/{currentBotUsername}/{shortName}`. A direct link may include query parameters such as `?startapp=...&mode=compact`, which do not participate in MiniApp ownership resolution. Business messages and `inline_message_id` are unsupported. Body, caption, entity, and media fields are rejected by the strict schema with 400. Success always returns `Message`.
MP accepts JSON/form and locates bot-authored native text or locally readable V1/V2 Inline messages by chat_id + message_id. It replaces buttons only and preserves text, entities, link preview, caption, media, and mp_ext. Omitted/null/empty reply_markup removes buttons. Business, inline_message_id, and body/caption/entity/media fields return 400; success always returns Message. Ordinary Inline button url also supports HTTP/HTTPS/mppay://.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_id |
integer | string | yes | Message ID input. Accepts either an integer between 0 and 9007199254740991 or a decimal string representing the same safe integer range. |
reply_markup |
InlineKeyboardMarkup | EmptyInlineKeyboardMarkup | null | no | For bot-authored native text or Inline messages, omit, pass null, or pass an empty Inline Keyboard to remove buttons; a non-empty value uses the same InlineKeyboardMarkup as sendMessage. Form requests use a JSON string. |
200 Original message updated400 401 403 404 Message not found429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/editMessageReplyMarkup" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "12345",
"message_id": 678,
"reply_markup": {
"inline_keyboard": [
[
{
"text": "Refresh",
"callback_data": "menu:refresh"
}
]
]
}
}'
/bot{token}/editMessageText
editMessageText Edit message text
Edits a bot-authored native text message or a V1/V2 Inline message whose canonical `media` is `null`. `entities`, `link_preview_options`, and `reply_markup` use replacement semantics: omitted `entities` reruns raw-mention enhancement, an empty entity array clears entities, omitted preview options reset explicit preview settings, and omitted/null/empty markup removes buttons. Inline media, Business/inline messages, `parse_mode`, `rich_message`, and game messages are unsupported and return 400. MPChat supports only `chat_id + message_id`; success always returns `Message`, never Telegram's inline-message `True` branch.
MP edits bot-authored native text or V1/V2 Inline text whose canonical media is null via chat_id + message_id. JSON/form entities, link_preview_options, and reply_markup are supported. Compound edits use replacement semantics: omitted entities rerun enhancement, omitted preview options reset explicit settings, and omitted/null/empty markup removes buttons. Business, inline_message_id, parse_mode, rich_message, game, and Inline media return 400; success always returns Message. Ordinary Inline button url also supports HTTP/HTTPS/mppay://.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_id |
integer | string | yes | Message ID input. Accepts either an integer between 0 and 9007199254740991 or a decimal string representing the same safe integer range. |
text |
string | yes | |
entities |
array<MessageEntity> | no | When omitted, raw-mention enhancement runs again; an empty array clears entities and disables enhancement. Form requests use a JSON array string. |
link_preview_options |
LinkPreviewOptions | no | Fully replaces link-preview options; omission removes old explicit settings. Form requests use a JSON object string. |
reply_markup |
InlineKeyboardMarkup | EmptyInlineKeyboardMarkup | null | no | A non-empty Inline Keyboard replaces buttons; omission, null, or an empty keyboard removes buttons. Native text stores it in content.extra. Form requests use a JSON string. |
200 Edited successfully400 401 403 404 Message not found429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/editMessageText" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "12345",
"message_id": 678,
"text": "Order completed",
"reply_markup": {
"inline_keyboard": []
}
}'
/bot{token}/forwardMessage
forwardMessage Forward message
Forwards an existing message to the target conversation. The result includes `forward_from`. Returns 400 when the source message cannot be read, has been deleted, or the message type is not currently supported. If the user has blocked the bot in a private chat, sending returns HTTP `403`, `error_code: 403`, and `Forbidden: bot was blocked by the user`.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
from_chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_id |
integer | string | yes | Message ID input. Accepts either an integer between 0 and 9007199254740991 or a decimal string representing the same safe integer range. |
disable_notification |
boolean | no | Whether to deliver silently. When omitted, the Bot default policy applies and defaults to audible delivery. |
200 Forwarded successfully400 401 403 404 The source message does not exist or is not accessible to the current bot500 Internal service error
curl -X POST "https://call.mp.net/bot/bot<bot-token>/forwardMessage" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/forwardMessages
forwardMessages Forward messages in batch
Forwards the specified messages one by one using `forwardMessage` semantics. Returns 400 when any source message does not exist, is not accessible, or the message type is not currently supported for forwarding. No partial success is returned. If the user has blocked the bot in a private chat, sending returns HTTP `403`, `error_code: 403`, and `Forbidden: bot was blocked by the user`. If the user blocks the bot during a batch, subsequent sends stop; messages already sent remain and are not rolled back.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
from_chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_ids |
array<MessageIdInput> | yes | |
disable_notification |
boolean | no | Whether to deliver silently. When omitted, the Bot default policy applies and defaults to audible delivery. |
200 Batch forward succeeded400 401 403 404 The source message does not exist or is not accessible to the current bot500 Internal service error
curl -X POST "https://call.mp.net/bot/bot<bot-token>/forwardMessages" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/pinChatMessage
pinChatMessage Pin message
Pins a message in a group chat. Currently supported for group conversations only. Returns 404 when the message does not exist and 403 when the bot lacks permission.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_id |
integer | string | yes | Message ID input. Accepts either an integer between 0 and 9007199254740991 or a decimal string representing the same safe integer range. |
disable_notification |
boolean | no | Whether to pin silently. When omitted, the Bot default policy applies and defaults to audible delivery. |
200 Pinned successfully400 401 403 404 Message not found500 Pin action failed
curl -X POST "https://call.mp.net/bot/bot<bot-token>/pinChatMessage" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/recallMessage
recallMessage Recall message
Recalls a message sent by the current bot or received by the current bot in a private chat. Every recallable message requires a trusted sent time and can be recalled only within 48 hours of that time; missing, already-deleted, or expired messages return 400. In group chats, an administrator bot with the Recall messages permission can also recall messages sent by regular members. Messages sent by the group owner or administrators cannot be recalled by another administrator bot; administrator permission does not exempt the message from the 48-hour limit, and insufficient permission returns 403. This method is an MPChat Bot API extension for separating recall from compatible deletion. deleteMessage remains the compatible delete method.
MPChat extension method for recall; deleteMessage remains the compatible delete method. In group chats, administrator bots with the Recall messages permission can recall regular member messages, but not owner or administrator messages.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_id |
integer | string | yes | Message ID input. Accepts either an integer between 0 and 9007199254740991 or a decimal string representing the same safe integer range. |
200 Recalled successfully400 401 403 404 Message not found500 Recall action failed
curl -X POST "https://call.mp.net/bot/bot<bot-token>/recallMessage" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "12345",
"message_id": 678
}'
/bot{token}/recallMessages
recallMessages Recall messages in batch
Recalls multiple messages sent by the current bot or received by the current bot in a private chat. Every recallable message requires a trusted sent time and can be recalled only within 48 hours of that time; missing, already-deleted, or expired messages return 400. In group chats, an administrator bot with the Recall messages permission can also recall messages sent by regular members. Messages sent by the group owner or administrators cannot be recalled by another administrator bot; administrator permission does not exempt the message from the 48-hour limit. This method is an MPChat Bot API extension for separating recall from compatible batch deletion. deleteMessages remains the compatible delete method. Each request uses one chat_id and must contain 1 to 100 distinct message_ids after numeric-string normalization. Every message is checked for mapping, sender, sent time, and permission before any recall is sent. If preflight fails, no other message in the batch is recalled. After preflight, remote recall is sequential; an execution failure at item N returns an error while earlier completed recalls remain effective, with no cross-service rollback.
MPChat extension method for batch recall; deleteMessages remains the compatible batch delete method. If any message fails the recall precondition, the whole request fails without partial success.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_ids |
array<MessageIdInput> | yes | Must contain 1 to 100 distinct message IDs after numeric-string normalization. |
200 Batch recall succeeded400 401 403 404 Message not found500 Batch recall failed
curl -X POST "https://call.mp.net/bot/bot<bot-token>/recallMessages" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "12345",
"message_ids": [
678,
679
]
}'
/bot{token}/unpinChatMessage
unpinChatMessage Unpin message
Unpins a pinned message in a group chat. Currently supported for group conversations only. Returns 404 when the message does not exist and 403 when the bot lacks permission.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
message_id |
integer | string | yes | Message ID input. Accepts either an integer between 0 and 9007199254740991 or a decimal string representing the same safe integer range. |
200 Unpinned successfully400 401 403 404 Message not found500 Unpin action failed
curl -X POST "https://call.mp.net/bot/bot<bot-token>/unpinChatMessage" \
-H "Content-Type: application/json" \
-d '{}'
Group
Group
Read and manage MPChat group metadata and members.
/bot{token}/approveChatJoinRequest
approveChatJoinRequest Approve a chat join request
An authorized Bot can approve a user's pending chat join request using `chat_id` and `user_id`. A cancelled, expired, or already handled request returns 400.
Pre-release API. Requires chat_id and user_id, and the Bot must have permission to review join requests.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
user_id |
integer | string | yes | **BREAKING**: Bot API unique user ID input. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. For chat-member operations, use the global surrogate `user.id`; method-specific identity sources and permission prerequisites apply. |
200 Operation succeeded400 401 403 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/approveChatJoinRequest" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/banChatMember
banChatMember Restrict chat member
Current MPChat behavior restricts the member from speaking and does not remove the member from the chat. `until_date=0` or omission means the restriction remains until manually lifted. The bot must be in the target chat, and the target user must be a regular member.
Current MPChat behavior restricts the member from speaking and does not kick the user from the chat.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
user_id |
integer | string | yes | **BREAKING**: Bot API unique user ID input. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. For chat-member operations, use the global surrogate `user.id`; method-specific identity sources and permission prerequisites apply. |
until_date |
integer | no | Unix timestamp. Use 0 or omit the field for a permanent restriction. |
200 Operation succeeded400 401 403
curl -X POST "https://call.mp.net/bot/bot<bot-token>/banChatMember" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "12345",
"user_id": "2000000154",
"until_date": 0
}'
/bot{token}/declineChatJoinRequest
declineChatJoinRequest Decline a chat join request
An authorized Bot can decline a user's pending chat join request using `chat_id` and `user_id`. A cancelled, expired, or already handled request returns 400.
Pre-release API. Requires chat_id and user_id, and the Bot must have permission to review join requests.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
user_id |
integer | string | yes | **BREAKING**: Bot API unique user ID input. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. For chat-member operations, use the global surrogate `user.id`; method-specific identity sources and permission prerequisites apply. |
200 Operation succeeded400 401 403 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/declineChatJoinRequest" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/deleteChatPhoto
deleteChatPhoto Delete chat photo
Deletes the chat photo. The bot may always do this when it is the chat owner. Otherwise it must have the Edit group messages permission or the request returns 403.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
200 Operation succeeded400 401 403
curl -X POST "https://call.mp.net/bot/bot<bot-token>/deleteChatPhoto" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/getChat
getChat Get chat information
Returns a Telegram-compatible `ChatFullInfo` object. The system always provides `id` and `type`; private chats may also include `first_name`, `username`, and `photo` when profile data is available. Groups, supergroups, and channels may also include `title`, `description`, and `photo` when profile data is available. `photo` uses Telegram's `ChatPhoto` shape; MPChat currently may place a downloadable avatar link in the `file_id` / `file_unique_id` fields as the media identifier. Unsupported optional Telegram `ChatFullInfo` fields are omitted.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
200 Chat information400 401 403
curl -X POST "https://call.mp.net/bot/bot<bot-token>/getChat" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/getChatAdministrators
getChatAdministrators Get chat administrators
Returns the administrators of a chat. The response uses the `ChatMember[]` structure with Telegram-compatible fields only; raw MPChat permission strings are not returned. Owner entries follow Telegram `ChatMemberOwner`: they return `status="creator"` and the required `is_anonymous=false`, without administrator `can_*` fields. Active Bot administrators return `user.is_bot=true` and use the authoritative Bot profile. Human administrators return `user.is_bot=false` and use the chat member profile. Returned chat-member `user.id` values are global surrogate IDs. The current Bot's value equals `getMe.id`, and `getMe.id` can be used directly as `getChatMember.user_id` to query the current Bot. This method uses the same current `group` / `supergroup` permission projection as `getChatMember`. It does not invent fine-grained administrator rights for channels, creators, or members without an authoritative permission snapshot.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
200 Administrator list400 401 403
curl -X POST "https://call.mp.net/bot/bot<bot-token>/getChatAdministrators" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/getChatMember
getChatMember Get chat member
Returns the member status and role in the specified conversation. Muted members are returned as `restricted`; otherwise the result is `creator`, `administrator`, or `member`. Chat owners follow Telegram `ChatMemberOwner`: they return `status="creator"` and the required `is_anonymous=false`. MPChat does not currently support anonymous owners or custom owner titles, and a creator does not return administrator `can_*` fields. Members backed by an active Bot record return `user.is_bot=true` and use the authoritative Bot profile. Other members return `user.is_bot=false` and use the chat member profile. Chat-member `user.id` values are global surrogate IDs. The current Bot's `getMe.id` equals its chat-member `user.id`, and `getMe.id` can be used directly as `user_id` when querying the current Bot. For other members, use the `user.id` returned by an Update or chat-member API. For MPChat `group` and `supergroup` administrators, confirmed Telegram `can_*` fields project the current permission snapshot. Channels are outside this projection. When the internal authoritative permission snapshot is missing or invalid, unsupported fine-grained projections are omitted. Raw MPChat permission strings are not returned.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
user_id |
integer | string | yes | **BREAKING**: Bot API unique user ID input. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. For chat-member operations, use the global surrogate `user.id`; method-specific identity sources and permission prerequisites apply. |
200 Member information400 401 403 The bot is not in the chat404 The user is not in the chat
curl -X POST "https://call.mp.net/bot/bot<bot-token>/getChatMember" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/getChatMemberCount
getChatMemberCount Get chat member count
Returns the total number of members in the chat. The result reflects the count currently visible to the platform.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
200 Member count400 401 403
curl -X POST "https://call.mp.net/bot/bot<bot-token>/getChatMemberCount" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/leaveChat
leaveChat Bot leaves chat
Makes the bot leave the current conversation.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
200 Operation succeeded400 401 403
curl -X POST "https://call.mp.net/bot/bot<bot-token>/leaveChat" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/setChatDescription
setChatDescription Set chat description
Sets the chat description or announcement. The bot may always do this when it is the chat owner. Otherwise it must have the Edit group messages permission or the request returns 403.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
description |
string | yes | New group announcement or description. Use an empty string to clear the description. |
200 Operation succeeded400 401 403
curl -X POST "https://call.mp.net/bot/bot<bot-token>/setChatDescription" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/setChatPhoto
setChatPhoto Set chat photo
Sets the chat photo. The bot may always do this when it is the chat owner. Otherwise it must have the Edit group messages permission or the request returns 403. The `photo` field supports a public HTTP(S) image URL, an existing MPChat avatar object identifier, or a local multipart upload. A public URL must be reachable and point to a supported image within the size limit, otherwise the request returns 400.
MP supports URL and multipart avatar upload, but does not support existing file_id reuse.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
photo |
string | yes | Public HTTP(S) avatar image URL or an existing MPChat avatar object identifier. |
200 Operation succeeded400 401 403
curl -X POST "https://call.mp.net/bot/bot<bot-token>/setChatPhoto" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "12345",
"photo": "https://example.com/group.png"
}'
/bot{token}/setChatTitle
setChatTitle Set chat title
Sets the chat title. The bot may always do this when it is the chat owner. Otherwise it must have the Edit group messages permission or the request returns 403.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
title |
string | yes | New chat title. |
200 Operation succeeded400 401 403
curl -X POST "https://call.mp.net/bot/bot<bot-token>/setChatTitle" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/unbanChatMember
unbanChatMember Unrestrict chat member
Lifts the speaking restriction for a member. The bot must have the required group management permissions. When `only_if_banned=true`, the request succeeds immediately for members who are not currently restricted.
| Field | Type | Required | Description |
|---|---|---|---|
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
user_id |
integer | string | yes | **BREAKING**: Bot API unique user ID input. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. For chat-member operations, use the global surrogate `user.id`; method-specific identity sources and permission prerequisites apply. |
only_if_banned |
boolean | no |
200 Operation succeeded400 401
curl -X POST "https://call.mp.net/bot/bot<bot-token>/unbanChatMember" \
-H "Content-Type: application/json" \
-d '{}'
BotCommands
Bot Commands
Manage bot command menus.
/bot{token}/deleteMyCommands
deleteMyCommands Delete bot commands
No request body fields.
200 Cleared successfully401
curl -X POST "https://call.mp.net/bot/bot<bot-token>/deleteMyCommands" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/getMyCommands
getMyCommands Get bot commands
No request body fields.
200 Command list401
curl -X GET "https://call.mp.net/bot/bot<bot-token>/getMyCommands" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/getMyCommands
getMyCommands Get bot commands (POST)
No request body fields.
200 Command list401
curl -X POST "https://call.mp.net/bot/bot<bot-token>/getMyCommands" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/setMyCommands
setMyCommands Set bot commands
Validates each command against the format `^[a-z0-9_]{1,32}$` and replaces the current bot command list as a whole. Passing an empty array is equivalent to `deleteMyCommands`.
| Field | Type | Required | Description |
|---|---|---|---|
commands |
array<BotCommand> | string | yes |
200 Updated successfully400 401
curl -X POST "https://call.mp.net/bot/bot<bot-token>/setMyCommands" \
-H "Content-Type: application/json" \
-d '{}'
BotProfile
Bot Profile
Manage the bot description and short description.
/bot{token}/getMyDescription
getMyDescription Get bot description
Returns the default description for the current bot. When no value is configured, `result.description` is an empty string. Localized profiles are not supported in this release; a non-empty `language_code` returns 400.
MPChat currently returns only the default description. Omit language_code or pass an empty string; a non-empty language_code returns 400.
| Field | Type | Required | Description |
|---|---|---|---|
language_code |
string | no | Only an empty string is accepted and selects the default profile. |
200 Current default description400 401 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/getMyDescription" \
-H "Content-Type: application/json" \
-d '{
"language_code": ""
}'
/bot{token}/getMyShortDescription
getMyShortDescription Get bot short description
Returns the default short description for the current bot. When no value is configured, `result.short_description` is an empty string. Localized profiles are not supported in this release; a non-empty `language_code` returns 400.
MPChat currently returns only the default short description. Omit language_code or pass an empty string; a non-empty language_code returns 400.
| Field | Type | Required | Description |
|---|---|---|---|
language_code |
string | no | Only an empty string is accepted and selects the default profile. |
200 Current default short description400 401 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/getMyShortDescription" \
-H "Content-Type: application/json" \
-d '{
"language_code": ""
}'
/bot{token}/setMyDescription
setMyDescription Set bot description
Sets the default description for the current bot. `description` is limited to 512 characters. Omitting it or passing an empty string clears the default value. Localized profiles are not supported in this release: omit `language_code` or pass an empty string; any non-empty value returns 400.
MPChat currently manages only the default description. Omit language_code or pass an empty string; a non-empty language_code returns 400.
| Field | Type | Required | Description |
|---|---|---|---|
description |
string | no | New default description; omit it or pass an empty string to clear it. |
language_code |
string | no | Only an empty string is accepted and selects the default profile. |
200 Updated successfully400 401 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/setMyDescription" \
-H "Content-Type: application/json" \
-d '{
"description": "A helpful MPChat bot."
}'
/bot{token}/setMyShortDescription
setMyShortDescription Set bot short description
Sets the default short description for the current bot. `short_description` is limited to 120 characters. Omitting it or passing an empty string clears the default value. Localized profiles are not supported in this release: omit `language_code` or pass an empty string; any non-empty value returns 400.
MPChat currently manages only the default short description. Omit language_code or pass an empty string; a non-empty language_code returns 400.
| Field | Type | Required | Description |
|---|---|---|---|
short_description |
string | no | New default short description; omit it or pass an empty string to clear it. |
language_code |
string | no | Only an empty string is accepted and selects the default profile. |
200 Updated successfully400 401 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/setMyShortDescription" \
-H "Content-Type: application/json" \
-d '{
"short_description": "Helpful answers in MPChat."
}'
Webhook
Webhook
Configure webhook delivery and inspect webhook state.
/bot{token}/deleteWebhook
deleteWebhook Delete webhook
When `drop_pending_updates=true`, pending updates are discarded immediately.
| Field | Type | Required | Description |
|---|---|---|---|
drop_pending_updates |
boolean | no |
200 Deleted successfully401
curl -X POST "https://call.mp.net/bot/bot<bot-token>/deleteWebhook" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/getWebhookInfo
getWebhookInfo Get webhook information
Returns the current webhook configuration. `pending_update_count` only includes pending updates still within the 24-hour retention window.
No request body fields.
200 Webhook configuration401
curl -X GET "https://call.mp.net/bot/bot<bot-token>/getWebhookInfo" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/getWebhookInfo
getWebhookInfo Get webhook information (POST)
Same behavior as GET. `pending_update_count` only includes pending updates still within the 24-hour retention window.
No request body fields.
200 Webhook configuration401
curl -X POST "https://call.mp.net/bot/bot<bot-token>/getWebhookInfo" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/setWebhook
setWebhook Set webhook
The URL must use HTTPS. An empty string is treated the same as `deleteWebhook`. Before saving the webhook, the server sends an HTTPS POST reachability probe to the URL. The probe body may be an empty object. The webhook endpoint must return any 2xx status code; non-2xx responses cause `setWebhook` to return 400. The endpoint should not reject the probe only because it does not contain real Update fields. When `secret_token` is set, the reachability probe and subsequent real webhook delivery requests include the same value in the `X-MpChat-Bot-Api-Secret-Token` header. A non-empty `allowed_updates` stores and uses an explicit type set. Omission keeps the Bot's stored policy, using the default set only when none exists; an empty array resets to the default set. The default set excludes `chat_member`, `message_reaction`, and `message_reaction_count`. Filtered updates are not counted in `pending_update_count`.
Webhook and getUpdates share the same three-state `allowed_updates` policy and default set, and expose the same group-event field contract. Kafka-sourced group events remain pre-release; `approveChatJoinRequest` and `declineChatJoinRequest` remain unavailable.
| Field | Type | Required | Description |
|---|---|---|---|
url |
string:uri | yes | Webhook URL (must use HTTPS). An empty string deletes the webhook. |
secret_token |
string | no | |
max_connections |
integer | no | |
allowed_updates |
array<string> | no | Update types accepted for webhook delivery, such as `message` and `callback_query`. Omission keeps the stored policy; an empty array resets to the default set; a non-empty array stores an explicit set. |
200 Updated successfully400 401
curl -X POST "https://call.mp.net/bot/bot<bot-token>/setWebhook" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/mp-bot/webhook",
"secret_token": "<webhook-secret>"
}'
User
User
User-facing profile and interaction helpers.
/bot{token}/getUserProfilePhotos
getUserProfilePhotos Get user profile photos
Returns the `UserProfilePhotos` structure. When `user_id` equals the current Bot's `getMe.id`, the method reads the Bot's own profile photos and does not require a private-chat snapshot. Before reading another user's photos, the current Bot and target `user_id` must have a Bot-scoped private-chat snapshot whose type is `private`. A missing or non-private snapshot returns `403`. MPChat currently returns at most one profile photo group from the user profile avatar. When both avatar sizes are available, the original avatar is preferred. When no avatar is available, `total_count` is `0` and `photos` is empty.
| Field | Type | Required | Description |
|---|---|---|---|
user_id |
integer | string | yes | **BREAKING**: Bot API unique user ID input. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. For chat-member operations, use the global surrogate `user.id`; method-specific identity sources and permission prerequisites apply. |
200 User profile photo list400 401 403
curl -X POST "https://call.mp.net/bot/bot<bot-token>/getUserProfilePhotos" \
-H "Content-Type: application/json" \
-d '{}'
MediaUpload
MediaUpload
MPChat SDK upload protocol (extensions)
/bot{token}/abortMediaUpload
abortMediaUpload Cancel an unfinished media upload
Used internally by the SDK. Cancels this bot's upload before completing/ready and removes temporary objects. Repeated cancellation of an aborted upload returns its state. Never deletes ready media or recalls sent messages. Temporary cleanup failures retain the upload for background retry.
MPChat SDK upload protocol. Prefer SDK sendVideo/sendDocument for automatic upload and sending.
| Field | Type | Required | Description |
|---|---|---|---|
upload_id |
string:uuid | yes |
200 Success400 401 403 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/abortMediaUpload" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/completeMediaUpload
completeMediaUpload Validate and complete a media upload
Used internally by the SDK. Verifies all parts and freezes writes, then completes in OSS and validates actual size and MP4 video content. Documents are delivered as binary attachments. Publishes a controlled URL only after validation; repeated completion recovers the original result and temporary storage failures are retryable. Does not send a message; the SDK subsequently calls the existing send method.
MPChat SDK upload protocol. Prefer SDK sendVideo/sendDocument for automatic upload and sending.
| Field | Type | Required | Description |
|---|---|---|---|
upload_id |
string:uuid | yes |
200 Success400 401 403 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/completeMediaUpload" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/createMediaUpload
createMediaUpload Create an SDK media upload
MPChat extension for the server-side SDK; developers should use SDK sendVideo/sendDocument. Supports MP4 videos or documents up to 1 GiB. Uploads expire after one hour; at most four unfinished uploads per bot. The same request_id and arguments return the existing upload; changed arguments return 400. No OSS credentials are exposed.
MPChat SDK upload protocol. Prefer SDK sendVideo/sendDocument for automatic upload and sending.
| Field | Type | Required | Description |
|---|---|---|---|
request_id |
string:uuid | yes | SDK-generated idempotency key; reuse only with identical arguments. |
chat_id |
string | integer | yes | **BREAKING**: Bot API unique chat ID input. It may refer to a user, group, or channel. Accepts either a JavaScript safe integer or a decimal string representing the same safe integer range. |
media_type |
enum(video | document) | yes | |
file_name |
string | yes | |
file_size |
integer | yes |
200 Success400 401 403 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/createMediaUpload" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/getMediaUpload
getMediaUpload Get upload progress
Used internally by the SDK. Returns this bot's upload state and confirmed parts for recovery. Only ready uploads expose a platform-controlled URL. Querying does not extend expiry; ready media remains available beyond the upload's one-hour lifetime.
MPChat SDK upload protocol. Prefer SDK sendVideo/sendDocument for automatic upload and sending.
| Field | Type | Required | Description |
|---|---|---|---|
upload_id |
string:uuid | yes |
200 Success400 401 403 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/getMediaUpload" \
-H "Content-Type: application/json" \
-d '{}'
/bot{token}/uploadMediaPart
uploadMediaPart Upload one media part
Used internally by the SDK. Send sequential, independent 8 MiB raw binary requests, with only the final part shorter. Compressed Content-Encoding is unsupported. Retries of a part must contain identical bytes. Concurrent operations on the same upload may return 429; the SDK retries within a bound. Authentication, ownership and chat access are checked before reading file bytes.
MPChat SDK upload protocol. Prefer SDK sendVideo/sendDocument for automatic upload and sending.
No request body fields.
200 Success400 401 403 429 500
curl -X POST "https://call.mp.net/bot/bot<bot-token>/uploadMediaPart" \
-H "Content-Type: application/json" \
-d '{}'
Notes
Compatibility and product differences
The main method list is generated from openapi.yaml and shows the MPChat Bot API surface that is currently available.
Common Bot API methods not currently exposed by MP (119)
addStickerToSet answerInlineQuery answerPreCheckoutQuery answerShippingQuery answerWebAppQuery approveSuggestedPost banChatSenderChat close closeForumTopic closeGeneralForumTopic convertGiftToStars createChatInviteLink createChatSubscriptionInviteLink createForumTopic createInvoiceLink createNewStickerSet declineSuggestedPost deleteBusinessMessages deleteChatStickerSet deleteForumTopic deleteStickerFromSet deleteStickerSet deleteStory editChatInviteLink editChatSubscriptionInviteLink editForumTopic editGeneralForumTopic editMessageChecklist editMessageLiveLocation editStory editUserStarSubscription exportChatInviteLink getAvailableGifts getBusinessAccountGifts getBusinessAccountStarBalance getBusinessConnection getChatGifts getCustomEmojiStickers getFile getForumTopicIconStickers getGameHighScores getManagedBotToken getMyDefaultAdministratorRights getMyName getMyStarBalance getStarTransactions getStickerSet getUserChatBoosts getUserGifts getUserProfileAudios giftPremiumSubscription hideGeneralForumTopic postStory promoteChatMember readBusinessMessage refundStarPayment removeBusinessAccountProfilePhoto removeChatVerification removeMyProfilePhoto removeUserVerification