The Platform API is the provisioning API for AuthKit for Platforms. Platforms whose users build and deploy their own apps use it to create a WorkOS team for each user, then add environments, environment API keys, and team invitations inside that team. Each team belongs to the user it was created for, and every request is scoped to teams the calling platform created.
See the AuthKit for Platforms guide for how these fit together and how the Platform API compares to projects and environments in your own WorkOS team.
All Platform API endpoints are under https://api.workos.com/platform.
Platform endpoints take a bearer token obtained through the OAuth 2.0 client credentials grant, using the credentials WorkOS issues to your platform when it’s onboarded to AuthKit for Platforms.
| curl --request POST \ | |
| --url "https://signin.workos.com/oauth2/token" \ | |
| -d "client_id=$PLATFORM_CLIENT_ID" \ | |
| -d "client_secret=$PLATFORM_CLIENT_SECRET" \ | |
| -d "grant_type=client_credentials" |
| { | |
| "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6InNzb19vaWRjX2tleV9wYWlyXzAxSlBaWlk3UVA3MTJKMUsyMkI0WlpIMUIzIn0...", | |
| "expires_in": 3600, | |
| "token_type": "bearer" | |
| } |
POST/oauth2 /token
Parameters
Returns object
Tokens last one hour. Requesting a new token doesn’t invalidate existing ones, so a rolling refresh needs no coordination between workers.
The token must carry the platform scope, which WorkOS attaches to platform credentials. Requests with a token lacking that scope are rejected with 401.
Send the token as a bearer credential on every Platform API request:
Platform API errors return a code to branch on and a message written for people reading logs. Messages can change; codes don’t.
A 404 from any endpoint means the resource doesn’t exist or the platform’s access to it has been revoked. Both are terminal, so surface them rather than retrying.