API tokens are the access tokens for authentication. Instead of using username and password, it can be used for programmatic access to API. It allows users to generate API tokens with the desired access. Only super admin users can generate API tokens and see the generated tokens.
To generate API tokens, go to
Global Configurations -> Authorization -> API tokensand click
Generate New Token.
- Enter a name for the token.
- Add Description.
- Select an expiration date for the token (7 days, 30 days, 60 days, 90 days, custom and no expiration).
- To select a custom expiration date, select
Customfrom the drop-down list. In the adjacent field, you can select your custom expiration date for the API token.
- You can assign permission to the token either with:
- Super admin permission: To generate a token with super admin permission, select
Super admin permission.
- Specific permissions: Selecting
Specific permissionsoption allows you to generate a token with a specific role for:
A pop-up window will appear on the screen from where you can copy the API token.
Once Devtron API token has been generated, you can use this token to request Devtron APIs using any API testing tool like Jmeter, Postman, Citrus. Using Postman here as an example.
Open Postman. Enter the request URL with
POSTmethod and under HEADERS, enter the API token as shown in the image below.
Bodysection, provide the API payload as shown below and click
As soon as you click
Send, the created application API will be triggered and a new Devtron app will be created as provided in the payload.
To set a new expiration date or to make changes in permissions assigned to the token, we need to update the API token in Devtron. To update the API token, click the token name or click on the edit icon.
To set a new expiration date, you can regenerate the API token. Any scripts or applications using this token must be updated. To regenerate a token, click
A pop-up window will appear on the screen from where you can select a new expiration date.
Select a new expiration date and click
This will generate a new token with a new expiration date.
To update API token permissions, give the permissions as you want to and click
To delete an API token, click
deleteicon. Any applications or scripts using this token will no longer be able to access the Devtron API.