Prerequisites
- An Astro account.
- An Organization API token with the Organization Owner role. Astronomer recommends that you create a new API token for this tutorial.
- An Astro Workspace.
- A method for making API requests. This tutorial assumes you’re using curl, but you can also use tools such as Postman.
Step 1: Make your first API request
To access most endpoints, you need to provide an Organization ID to the API as a path parameter. One of the few requests that doesn’t require an Organization ID is the List Organizations request, which means that you can programmatically retrieve an Organization ID. To retrieve the Organization ID through the API, run the following command:id from this response. This is your Organization ID.
While you could have retrieved this value manually from the Astro UI, using the API lets you script this workflow and execute it on a regular basis.
Step 2: Request Workspace details from the API
Using the Organization ID you copied, you can now find the ID for the Workspace where you want to create your API token. Run the following command to list all Workspaces in your Organization:id. This is your Workspace ID.
Step 3: Update your token description using the API
Now that you have both an Organization ID and a Workspace ID, you can create a Workspace API token using the Astro API.-
Run the following command to create a new Workspace API token:
If the request was successful, the API will return a response with your new token’s details.
- In the Astro UI, go to Workspace Settings > Access Management > API Tokens and find your Workspace API token. You should see your updated description under Description.