In this guide, you will learn how to create a security token. Security tokens are used as an alternative log in method. A token may be used instead of the regular username and password in requests. These tokens can be deleted at any time to revoke access.
I. Create Token
In this section, we will create a security token through the portal.
To set up a security token, log into your CarrierX account. On the left-side menu, locate and click the Account menu. Click Security Tokens.
Click Add New Token.
Enter a name for the new token. This is a friendly name that is used for internal reference.
Click Create Token.
Click the newly created token to obtain the Access Token.
Scroll down to find the token details. Click reveal to show the Access Token. This is what you will use in your requests instead of a username and password.
The token details also include the date, time, and IP address of the last token usage.
In the following section, we will make a request using a security token.
II. Making a Request
In this section, we will make a request using a security token instead of a username and password.
Any type of request to the Core API can be made using a security token. In our example, we are forming a
GET request to return containers using the Core API. The security token is added to the header.
curl -X GET \ 'https://api.carrierx.com/core/v2/storage/containers' \ -H 'Authorization: Bearer 5ebc03d6-8b2b-44ad-bf65-72d4f1491dda'
A successful request will return a
200 status code along with a response, just like would be returned when making a request with a username and password.
III. Revoke Token
In this section, we will learn how to delete a security token using the portal. You may choose to do this to protect your applications in case of security breaches or to revoke access for a specific login.
Log into your CarrierX account. On the left-side menu, locate and click the Account menu. Click Security Tokens.
Click the token that you wish to revoke.
IV. Next Steps
You have just created a token! Now you can manage your logins more securely and easily. For a compehensive guide to the CarrierX Core API, refer to the Core API Reference.