Head over to our API Docs

Step 1 - Head to our admin console, click on "Create New Key" to generate an API key ; save the "Client ID" and "Client Secret" for API usage.

Note: You will need to create a new API key if you did not grab them. We can not get it for you after your API key is created.

Step 2 - Open a new jupyter notebook  to use with Python 3 

Step 3 - Replace "client_id": xxxx and "client_secret": xxxx with your generated Client ID and Client Secret from Step 1

def get_bearer_token():
""" Gets an authorization token for use with the Verdigris API. Expires in 10 hours. """
    url = 'https://auth.verdigris.co/oauth/token'
    header = {'Content-Type': 'application/json'}
    body = {
    "client_id": xxxx,
    "client_secret": xxxx,
    "grant_type": "client_credentials",
    "audience": "https://api.verdigris.co/"
        resp = requests.post(url, json.dumps(body), headers=header).json()
        return resp["access_token"]
        return resp

### Get Authorization Token ###
bearer_token_response = get_bearer_token()
if type(bearer_token_response) == str:
    header_auth = {'Authorization': f'Bearer {bearer_token_response}'}
    print(f"Authentication Request Failed:\n{bearer_token_response}")

Example for calls that require no parameters (using Core API)

GET /circuits/

import requests

url = "https://api.verdigris.co/core/v1/circuits/"
response = requests.get(url, headers=header_auth)

Example for calls that require parameters (using Data API)

GET /power/circuits/

import requests

url = 'https://api.verdigris.co/data/v4/power/circuits'
payload = {
    'ids':'12345, 23456',
response = requests.get(url, params = payload, headers = header_auth)


Did this answer your question?