Skip to content
  • SDKs and APIs
  • Kinde Management API

Call the Kinde Management API

Use the OAuth2 client credentials flow to get a machine-to-machine (M2M) access token and make authenticated requests to the Kinde Management API.

  • A Kinde M2M application with Management API access, appropriate scopes, and app keys — see the quickstart guide

1. Get an access token

Link to this section
  1. Get the app keys for your M2M application (Domain, Client ID, and Client Secret).

  2. Make a POST request to the https://<your_subdomain>.kinde.com/oauth2/token endpoint using your preferred programming language:

    Make sure to replace <your_subdomain>, <your_m2m_client_id> and <your_m2m_client_secret> with your own details.

Terminal window
curl --request POST \
--url 'https://<your_subdomain>.kinde.com/oauth2/token' \
--header 'content-type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data 'client_id=<your_m2m_client_id>' \
--data 'client_secret=<your_m2m_client_secret>' \
--data 'audience=https://<your_subdomain>.kinde.com/api'
  1. The response includes an access token:

    {
    "access_token": "<your_access_token>", // the JWT access token
    "expires_in": 86399,
    "scope": "", // any subset of the scopes you defined in the request
    "token_type": "Bearer",
    }

    The access_token field will contain a signed JWT for you to use in the API requests. Use the Kinde Online JWT decoder to decode the token.

    Here is the decoded M2M access token:

    {
    "aud": [
    "https://<your_subdomain>.kinde.com/api"
    ],
    "azp": "<your_m2m_client_id>",
    "exp": 1777887031,
    "gty": [
    "client_credentials"
    ],
    "iat": 1777800631,
    "iss": "https://<your_subdomain>.kinde.com",
    "jti": "61859f4b-75e1-4ac8-bda7-8a69a5f6660e",
    "scope": "create:users read:users",
    "scp": [],
    "v": "2"
    }

2. Use the access token

Link to this section
  1. Include the access token in the Authorization header of your request. For example, to retrieve all users:
Terminal window
curl --request GET \
--url 'https://<your_subdomain>.kinde.com/api/v1/users' \
--header 'authorization: Bearer <m2m_access_token>' \
--header 'content-type: application/json'
  1. The Management API returns the appropriate response.

The scope parameter

Link to this section

You can include an optional scope parameter in the request to the /oauth2/token endpoint to request a subset of scopes for the token.

For example, if you have enabled the following scopes for your M2M application:

  • create:users
  • read:users
  • update:users
  • delete:users

Using the scope parameter, you can request a subset of those scopes for the token — in this case, create:users and read:users.

Terminal window
curl --request POST \
--url 'https://<your_subdomain>.kinde.com/oauth2/token' \
--header 'content-type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data 'client_id=<your_m2m_client_id>' \
--data 'client_secret=<your_m2m_client_secret>' \
--data 'audience=https://<your_subdomain>.kinde.com/api' \
--data 'scope=create:users read:users'

The token will be scoped to only the permissions you requested, which reduces the attack surface and limits exposure if the token is compromised.

How M2M tokens are calculated in Kinde

Link to this section

An M2M token is generated each time you call the /oauth2/token Kinde API endpoint to retrieve an M2M access token.

Where an access token is re-used - say where the same token is used to make another API request, this does not count as a new token. Similarly, where a token is re-used to make calls to other Kinde-registered APIs, this is also not counted as another token.

Kinde’s free and Pro plans have a generous amount of M2M tokens included, before we start charging for them. For details, see our pricing page.

With a working access token, you can now call the Management API to automate account actions. See the Kinde Management API for all available endpoints.