The WorkOS API enables adding Enterprise Ready features to your application. This REST API provides programmatic access and management of SSO, Magic Link, Directory Sync, and Audit Trail resources.
Sign in to see code examples customized with your API keys and data.
WorkOS offers native SDKs in several popular programming languages. Choose one language below to see our API Reference in your application’s language.
WorkOS authenticates your API requests using your account's API keys. API requests made without authentication or using an incorrect key will return a 401 error. Requests using a valid key but with insufficient permissions will return a 403 error. All API requests must be made over HTTPS – requests over plain HTTP will fail.
You can view and manage your API keys in the WorkOS Dashboard.
API keys can perform any API request to WorkOS. They should be kept secure and private! Be sure to prevent API keys from being made publicly accessible, such as in client-side code, GitHub, unsecured S3 buckets, and so forth. API keys are prefixed with sk\_.
Your Staging Environment comes with an API key already generated for you. Staging API Keys may be viewed as often as they are needed and will appear inline throughout our documentation in code examples if you are logged in to your WorkOS account. API requests will be scoped to the provided key's Environment.
Once you unlock Production access you will need to generate an API Key for it. Production API Keys may only be viewed once and will need to be saved in a secure location upon creation of them.
All API requests must be made over HTTPS. Any requests made over plain HTTP will fail.
WorkOS uses standard HTTP response codes to indicate the success or failure of your API requests.
2xx – Indicates success.
4xx – Indicates an error, normally due to error caused by incorrect or missing request information (e.g. providing an incorrect API key).
5xx – Indicates a WorkOS server error.
Many top-level resources have support for bulk fetches via "list" API methods. For instance, you can list connections, list directory users, and list directory groups. These list API methods share a common structure, taking at least these four parameters: limit, order, after, and before.
WorkOS utilizes pagination via the after and before parameters. Both parameters take an existing object ID value (see below) and return objects in either descending or ascending order by created_at timestamp.