Access Tokens

Get and use access tokens to make API calls

Step 1 - Generate an API key

Follow the steps here to create an API key.

The API key will include a clientId and clientSecret.

Step 2 - Get an access token

Make the API call shown below and update the following variables:

  • CLIENT_ID: the clientId from the previous step

  • CLIENT_SECRET: the clientSecret from the previous step

  • API_AUDIENCE: the endpoint that will be used for making API calls (i.e.

  • ENVIRONMENT: your ion instance environment

  • DOMAIN: your domain used in ion

$ curl -X POST \
--data-urlencode "grant_type=client_credentials" \
-d "client_id=CLIENT_ID" \
-d "client_secret=CLIENT_SECRET" \
-d "audience=API_AUDIENCE" \

Step 3 - Use the API

We have a public repository published for some API queries via python scripts.

The below also shows a very basic python script to query runs from ion.

To use, replace the following:

  • ACCESS_TOKEN: the access token from the previous step

  • API_ENDPOINT: the API audience from the previous step

import requests
from urllib.parse import urljoin
access_token = <ACCESS_TOKEN>
api_endpoint = <API_ENDPOINT>
headers = {
'Authorization': f'{access_token}',
'Content-Type': 'application/json'
GET_RUNS = '''
runs(first: 10) {
edges {
node { id title
steps {
query = {
'query': GET_RUNS
res =, 'graphql'), headers=headers, json=query)