API reference

Authentication

How the Spark API authenticates requests and how to send your key.

API keys

Every machine request needs an API key. Create keys in the control plane or with the API keys resource. A key belongs to one workspace. Its role is viewer, editor, or admin. The role cannot exceed the owner's role. A key secret is shown once. Store it in a secret manager.

Send the key

Send the full bearer token in the authorization header. The token looks like gsk_ plus the access-key id, a period, and the secret.

Header

Authorization: Bearer <SPARK_API_KEY>

Workspace scope

A key only works on its own workspace. Paths start with /v1/workspaces/{workspaceId}.

Keep keys out of source

  • Read the key from the SPARK_API_KEY environment variable.
  • Never paste a key into code, a commit, or a screenshot.
  • Rotate a key by creating a new one and revoking the old one.

cURL

curl \
  --url "https://api.spark.graphon.ai/v1/workspaces/$SPARK_WORKSPACE_ID/members" \
  --header "Authorization: Bearer $SPARK_API_KEY"
Was this page helpful?