Skip to content

Authentication

The API supports three authentication methods depending on your use case.

Section titled “API Key (recommended for programmatic access)”

API keys are the simplest way to authenticate for data consumption. Available to Sharp-tier subscribers.

Terminal window
curl -H "X-API-Key: $NBAV3_DATA_TOKEN" \
https://nbaproplab.com/api/v1/data/picks/today
Terminal window
# Requires a JWT Bearer token (see below)
curl -X POST https://nbaproplab.com/api/v1/me/api-keys \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "my-notebook"}'

The response includes rawKey — save it immediately, it’s only shown once.

ActionEndpoint
List keysGET /api/v1/me/api-keys
Create keyPOST /api/v1/me/api-keys
Revoke keyDELETE /api/v1/me/api-keys/{id}

Used by the web dashboard and for creating API keys. Short-lived (15 minutes) with a rotating refresh token.

Terminal window
# 1. Login to get tokens
curl -X POST https://nbaproplab.com/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "password": "your-password"}'
# Response includes accessToken (15 min) + HttpOnly refresh cookie (30 days)
Terminal window
# 2. Use the access token
curl -H "Authorization: Bearer $ACCESS_TOKEN" \
https://nbaproplab.com/api/v1/data/picks/today
Terminal window
# 3. Refresh when expired (automatic in SDKs)
curl -X POST https://nbaproplab.com/api/v1/auth/refresh \
--cookie "refreshToken=..."

Operations tokens authenticate against the /api/v1/ops endpoints for infrastructure monitoring and pipeline control.

Terminal window
curl -H "Authorization: Bearer $NBAV3_OPS_TOKEN" \
https://nbaproplab.com/api/v1/ops/health

Ops tokens are created by admins:

Terminal window
curl -X POST https://nbaproplab.com/api/v1/ops/tokens \
-H "Authorization: Bearer $ADMIN_JWT" \
-H "Content-Type: application/json" \
-d '{"name": "monitoring", "scopes": ["ops:read"]}'
ScopeAccess
ops:readHealth, services, jobs, pipeline runs, errors, freshness
ops:commandsQueue and cancel operations (score-day, settle, ingest)
ops:configRead and write app configuration
ops:tokensManage ops tokens

Not all endpoints are available to all users:

TierData APIOps APILimits
FreeNo accessNo access
ProNo accessNo access
SharpFull accessNo accessRate-limited
AdminFull accessFull accessNo limits

Authentication failures return RFC 9457 problem details:

{
"type": "https://nbaproplab.com/errors/unauthorized",
"title": "Authentication required",
"status": 401,
"detail": "No valid authentication token provided"
}
StatusMeaning
401Missing or invalid token/key
403Valid auth but insufficient tier or scope
429Rate limit exceeded