Every request to a protected SphereScout endpoint must include anDocumentation Index
Fetch the complete documentation index at: https://docs.spherescout.io/llms.txt
Use this file to discover all available pages before exploring further.
Authorization header. The API supports two authentication methods: API keys for server-to-server integrations and JWT bearer tokens for user-session-based applications. Both use the same header format — only the credential type differs.
Choose an authentication method
| API keys | JWT tokens | |
|---|---|---|
| Best for | Server integrations, scripts, automation | User-facing apps, per-user sessions |
| Lifetime | No expiry by default (or set a custom expiry) | Short-lived; must be refreshed |
| Setup | Generate once in the Dashboard | Login endpoint → access + refresh tokens |
| Complexity | Low | Higher (requires token-refresh logic) |
API key authentication
API keys are long-lived credentials that you generate in the Dashboard or via the API. Include your API key directly as the Bearer token in every request.JWT token authentication
JWT authentication involves three steps: logging in to obtain tokens, using the access token in requests, and refreshing the access token before it expires.Step 1 — Obtain tokens
Send a POST request to/api/auth/login with your account credentials. The response contains an access token and a refresh token.
Request
Your account email address. The field is named
username in the request body.Your account password.
Short-lived JWT access token. Use this as your Bearer token in subsequent requests.
Long-lived refresh token. Use this to obtain a new access token when the current one expires. Store this token securely — treat it like a password.
Account information returned at login.
Step 2 — Use the access token
Include the access token as a Bearer token in theAuthorization header of every request:
Step 3 — Refresh the access token
Access tokens expire after a short period. When a request returns401 Unauthorized, exchange your refresh token for a new access token by calling POST /api/token/refresh.
Request
The refresh token you received when you logged in.
A new short-lived access token. Replace the expired token in your application with this value.
A new refresh token, if token rotation is enabled. Update your stored refresh token if this field is present in the response.
Error responses
401 Unauthorized
A401 response means your credential is missing, invalid, or expired.
- API key: Verify the key is correctly copied and has not been revoked in the Dashboard.
- JWT access token: The token has expired. Call
POST /api/token/refreshwith your refresh token to get a new access token. - JWT refresh token: If the refresh call also returns
401, the refresh token has expired or been invalidated. Re-authenticate by callingPOST /api/auth/loginagain.
Full JWT refresh pattern
The following Python example shows a complete pattern for handling token expiry automatically:Python
Summary
For server-to-server integrations, use an API key — it requires no token management and works with a single header on every request. Reserve JWT tokens for applications where individual users log in with their own SphereScout credentials.