Skip to content

Ask AI

Powered by Blaze

Answers come from E2E Cloud documentation. AI can make mistakes.

Use a token in API calls

View as Markdown

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.

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> is api_key from the token’s config file; see Copy a token or download its 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.

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 os
token = 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.

  • A token and its API key stop working 365 days after you create the token.
  • Deleting the token stops them; see Delete a token.

Was this page helpful?