Skip to main content

Authentication

The Wyzed API uses OAuth 2.0 with the Client Credentials grant: exchange your credentials for an access token, then send that token with every API request.

You'll need your Client ID, Client Secret and Tenant ID — see Create Credentials.

Use your Wyzed account domain as the base URL for all API requests. For example, if you sign in at acme.wyzed.com, your base URL is https://acme.wyzed.com.

1. Request an access token​

POST https://your-account.wyzed.com/_services/auth/token

Request body​

{
"grant_type": "client_credentials",
"tenant_id": 123,
"client_id": "your-client-id",
"client_secret": "your-client-secret"
}

Response​

{
"token_type": "bearer",
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": null
}

Python example​

import httpx

response = httpx.post(
"https://your-account.wyzed.com/_services/auth/token",
json={
"grant_type": "client_credentials",
"tenant_id": 123,
"client_id": "your-client-id",
"client_secret": "your-client-secret",
},
)
response.raise_for_status()
access_token = response.json()["access_token"]

2. Use the access token​

Include the token in the Authorization header using the Bearer scheme:

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Python example​

response = httpx.get(
f"https://your-account.wyzed.com/v3_user/tenants/{tenant_id}/users/",
headers={
"Authorization": f"Bearer {access_token}",
},
params={"limit": 10, "is_learner": True},
)
response.raise_for_status()
users = response.json()

Token expiry & errors​

  • Access tokens are valid for 15 minutes. The Client Credentials flow does not issue refresh tokens — when a token expires, request a new one the same way.

  • A 401 Unauthorized from the token endpoint means your Client ID, Client Secret, or Tenant ID are incorrect:

    {
    "error": "invalid_client",
    "error_description": "Client authentication failed"
    }
  • A 401 Unauthorized from an API call means your access token has expired — request a new one and retry.

Next steps​