An API call to TIR carries two values from your token: the API key in the address and the token itself in
the Authorization header. Keep both out of your code.
Before you begin
Section titled “Before you begin”You need a token and its config file; see Copy a token or download its config file. The file holds the API key that the address needs.
Send a call
Section titled “Send a call”Add the API key to the address as apikey, and the token as a Bearer value in the Authorization
header. Most calls also take a location, Delhi or Chennai.
curl -H "Authorization: Bearer <your-token>" \ "https://api.e2enetworks.com/myaccount/api/v1/gpu/<path>?apikey=<your-api-key>&location=<Delhi or Chennai>"<your-token>is the token’s value from Auth Token.<your-api-key>isapi_keyfrom the config file.<path>is the call you are making; the TIR API reference lists each one.<Delhi or Chennai>is the location of the resource.
Keep the token out of your code
Section titled “Keep the token out of your code”Set the token as an environment variable so that it stays out of your code:
export TIR_API_TOKEN="<your-token>"Then read it in your script:
import ostoken = os.environ["TIR_API_TOKEN"]In a CI/CD pipeline, store the token and the API key as secrets of the pipeline instead of writing them in the pipeline file.
When the token stops working
Section titled “When the token stops working”- A token and its API key stop working 365 days after you create the token.
- Deleting the token stops them; see Delete a token.