Accessing Endpoints
Last updated
Last updated
Kubecost Cloud has select endpoints available for API access. The default API access endpoint will be api.app.kubecost.com
. Obtaining access involves generating an API key value, which is then used to generate a personal access token. The token, together with your team ID, will then allow you to make queries.
To get started, visit Settings in the Kubecost Cloud UI, then under 'My API Key', select Generate Key. A key value will generate in a text box with a lifespan of one month. Save this value, as it will not be retrievable later. Only one key can exist at any given time for a given user. Remove the existing key to generate a new one.
With your generated API key value, run the following command to generate a personal access token:
The generated token is short-lived and expires after ten minutes. This token can be used in token authentication for API requests to all available Kubecost endpoints.
You will also need to retrieve your team ID value. This is a value associated with your Kubecost Cloud team. You can find this ID at the bottom of Settings, in the 'Team Info' section.
To verify your token is working, authenticate to the Kubecost Cloud API access route using the personal access token generated in step 2 and the team ID retrieved in Step 3. For example:
Keep in mind that the TOKEN_VALUE
must be generated every ten minutes while using the API.
For a complete list of Kubecost Cloud APIs, see our API Directory.