The WorkOS API gives you everything you need to make your app enterprise-ready. Authenticate users, sync directories, enforce access controls, stream audit logs, and more – all through a single integration.
The API is organized around REST. It accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
Sign in to see code examples customized with your API keys and data.
https://api_workos_com
Not a developer? You can explore most of WorkOS without writing any code. The WorkOS Dashboard lets you configure SSO connections, manage directories, set up audit log streams, and more – all from a visual interface.
Generate a short-lived, session-bound token for the Client GraphQL API, scoped to an organization and user.
curl --request POST \ --url "https://api.workos.com/client/token" \ --header "Authorization: Bearer sk_example_123456789" \ --header "Content-Type: application/json" \ -d @- <<'BODY' { "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5" } BODY
{ "token": "eyJhbGciOiJSUzI1NiIsImtpZCI6InNlc3Npb24..." }
| curl --request POST \ | |
| --url "https://api.workos.com/client/token" \ | |
| --header "Authorization: Bearer sk_example_123456789" \ | |
| --header "Content-Type: application/json" \ | |
| -d @- <<'BODY' | |
| { | |
| "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5" | |
| } | |
| BODY |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.client.create_token( | |
| organization_id: "org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| user_id: "user_01E4ZCR3C56J083X43JQXF3JK5" | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.client.create_token( | |
| organization_id="org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| user_id="user_01E4ZCR3C56J083X43JQXF3JK5", | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v9" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.Client().CreateToken(context.Background(), &workos.ClientCreateTokenParams{ | |
| OrganizationID: "org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| UserID: "user_01E4ZCR3C56J083X43JQXF3JK5", | |
| }) | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->client() | |
| ->createToken( | |
| organizationId: "org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| userId: "user_01E4ZCR3C56J083X43JQXF3JK5", | |
| ); |
| import com.workos.WorkOS; | |
| import com.workos.client.ClientApi.CreateTokenOptions; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| CreateTokenOptions options = CreateTokenOptions.builder() | |
| .organizationId("org_01EHZNVPK3SFK441A1RGBFSHRT") | |
| .userId("user_01E4ZCR3C56J083X43JQXF3JK5") | |
| .build(); | |
| workos.client.createToken(options); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.Client.CreateTokenAsync(new ClientCreateTokenOptions { | |
| OrganizationId = "org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| UserId = "user_01E4ZCR3C56J083X43JQXF3JK5", | |
| }); |
| use workos::Client; | |
| use workos::client::CreateTokenParams; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::builder() | |
| .api_key("sk_example_123456789") | |
| .client_id("client_123456789") | |
| .build(); | |
| let _result = client | |
| .client() | |
| .create_token( | |
| CreateTokenParams { | |
| organization_id: "org_01EHZNVPK3SFK441A1RGBFSHRT".into(), | |
| user_id: "user_01E4ZCR3C56J083X43JQXF3JK5".into(), | |
| ..Default::default() | |
| } | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "token": "eyJhbGciOiJSUzI1NiIsImtpZCI6InNlc3Npb24..." | |
| } |
POST/client /tokenReturns