Skip to main content

Create API key

To obtain an API key for your TGmembership bot, navigate to the /settings menu, then select "Developers" and then "API". Click on "Create new" to generate a key for making API requests.

TGmembership Bot - Create API Endpoint
Create a new API key for your TGmembership bot

Once you have created an endpoint, the "Create new" button will be replaced with "Delete" and "Refresh". You can use these options to delete your endpoint if you no longer need the API or to update the API key if it has been compromised.

warning

Please keep your API key secure and do not share it with anyone. If you believe your key has been compromised, you can generate a new one by clicking on the "Refresh" button. If you no longer need the API, you can delete the API key by clicking on the "Delete" button.

TGmembership API Endpoint Settings
The 'Delete' and 'Refresh' buttons can be used to delete your endpoint or update your API request link

In this example, we have created an API key with the following details:

ParameterValue
Bot ID8047883872
API Key5mve17op098yxwqbph3jwjl8h7p1ifclbgdn54fb
note

The API key is a unique identifier that allows you to make requests to the TGmembership API. You will need to include this key in the headers of your HTTP requests to authenticate your bot. Your API key will be different from the one shown in this example.

To use the API key in your requests, you will need to include it in the headers of your HTTP requests. Here is an example of how you can include the API key in your requests using the Authorization header:

Request

GET /v1/bot:8047883872/5mve17op098yxwqbph3jwjl8h7p1ifclbgdn54fb/bot HTTP/1.1

Response

{
"ok": true,
"request_id": "qwfxtfq02n",
"method": "GET",
"path": "/bot",
"code": 200,
"result": {
"bot_id": 8047883872,
"api_key": "5mve17op098yxwqbph3jwjl8h7p1ifclbgdn54fb"
}
}

You can now use this API key to make requests to the TGmembership API and interact with your bot programmatically.

For more information on how to use the TGmembership API, refer to the API reference.