createChatInviteLink
Create a chat invite link.
Request
POST /:token/createchatinvitelink
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| chat_id | Integer/String | Yes | Unique identifier for the target chat or username |
| name | String | No | Link name, up to 32 characters |
| expire_date | Integer | No | Expiration time of the link, Unix timestamp |
| member_limit | Integer | No | Maximum number of members that can join through this link, 1-99999 |
| creates_join_request | Boolean | No | Whether administrator approval is required to join |
Response
Returns the created ChatInviteLink object on success.
json
{
"ok": true,
"result": {
"invite_link": "https://t.me/+abc123def456",
"creator": {
"id": 123456789,
"is_bot": true,
"first_name": "MyBot",
"username": "my_bot"
},
"creates_join_request": false,
"is_primary": false,
"is_revoked": false,
"name": "Promo Link",
"expire_date": 1700000000,
"member_limit": 100,
"pending_join_request_count": 0
}
}Response Fields
| Field | Type | Description |
|---|---|---|
| invite_link | String | The invite link URL |
| creator | User | The user object of the link creator |
| creates_join_request | Boolean | Whether administrator approval is required |
| is_primary | Boolean | Whether this is the primary invite link |
| is_revoked | Boolean | Whether the link has been revoked |
| name | String | Link name |
| expire_date | Integer | Expiration time, Unix timestamp |
| member_limit | Integer | Maximum member limit |
| pending_join_request_count | Integer | Number of pending join requests |
Error Codes
| Code | Description |
|---|---|
| 400 | Bad request parameters, e.g. member_limit out of range |
| 401 | Invalid or expired token |
| 403 | Bot does not have permission to create invite links in this chat |
| 404 | Chat not found |
| 500 | Internal server error |
