Skip to Content
Language guide

Inspect the API with cURL

Test credentials and response shapes directly from a trusted terminal session.

Language guide
01

Set the environment variable

Export SUPERVISOR_API_KEY in the current shell or inject it through your secret manager. The example expands it only inside the Authorization header.

Shell history can retain commands. Referencing an environment variable is safer than pasting the complete key into the command.

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

Inspect the response

Add --include when you need response headers. Add --fail-with-body in scripts so cURL exits with a failure status while preserving the API error body.