Skip to Content
Quickstart

Make your first authenticated request

Create an API key, save it once, and list the workspaces available to its owner.

Getting started
01

Create and store the key

Open Supervisor Settings, choose Integrations, then create a Developer API key. Production keys begin with ck_live_ and development keys begin with ck_test_.

Supervisor shows the complete secret once. Store it in a secret manager and expose it to server code through SUPERVISOR_API_KEY. Never place it in browser JavaScript or commit it to the repository.

  1. 01

    Choose the environment

    Create a production or development credential

  2. 02

    Set access

    Choose read or read and write access

  3. 03

    Limit the workspace

    Optionally restrict the key to one workspace

  4. 04

    Copy the secret

    Save the complete value before closing the dialog

import json
import os
import urllib.request
url = "https://api.trysupervisor.com/workspaces/user/me"
request = urllib.request.Request(url, method="GET")
request.add_header("Authorization", f"Bearer {os.environ['SUPERVISOR_API_KEY']}")
request.add_header("Content-Type", "application/json")
with urllib.request.urlopen(request) as response:
result = json.load(response)
print(json.dumps(result, indent=2))
02

Send the bearer credential

Add the key to the Authorization header with the Bearer scheme. The example below returns only workspaces where the owner still has active membership.

A revoked, expired, or malformed key returns 401. A valid key without access to the requested workspace returns 403 or 404, depending on the route.