Create an access token
POSThttps://api.botsubscription.com/v1/bot:bot_id/:api_key/members/accessToken
Create a new access token for a member to activate memberships without payment. For more information on access tokens, please check out our help article.
Request
Responses
- 201
- 400
- 401
- 404
The access token has been successfully created.
The affiliate_id provided is invalid. It must start with a letter, be at least 3 characters long, no more than 12, consisting of letters and numbers only, and be unique (not used by anyone else).
You haven't installed a payment method in your bot, or it is in test mode. You can install one by opening Telegram, open your bot, type /settings -> Test mode and switch it off. Then, go to /settings -> Payment Methods and install a payment method. Another reason, applicable if you're on the Pay As You Go 7% billing plan, could be a [violation of our Acceptable Use Policy](https://docs.botsubscription.com/troubleshooting/access-token-abuse).
The member_id provided is invalid, or belongs to someone who hasn't previously interacted with the bot, or the person has blocked the bot.
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.botsubscription.com");
request.Headers.Add("Accept", "application/json");
var content = new StringContent(string.Empty);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear