> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Token

> Request an access token using the Client Credentials Flow for machine-to-machine authentication.

## Endpoint

`POST /oauth/token`

This is the OAuth 2.0 grant that server processes use to access an API. Use this endpoint to directly request an access token by using the application's credentials (a Client ID and a Client Secret).

### Responses

#### 200

A successful response will return an access token.

```json theme={null}
{
  "access_token":"eyJz93a...k4laUWw",
  "token_type":"Bearer",
  "expires_in":86400
}
```

### Learn More

* [Client Credentials Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow)
* [Call API using the Client Credentials Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow/call-your-api-using-the-client-credentials-flow)
* [Setting up a Client Grant using the Management Dashboard](https://auth0.com/docs/get-started/applications/update-grant-types)
* [Asking for Access Tokens for a Client Credentials Grant](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow/call-your-api-using-the-client-credentials-flow)

## Headers

**DPoP** `string`

A DPoP proof for the request. This is optional and only required if your application uses Demonstrating Proof-of-Possession.

## Body Parameters

The request body is in `application/x-www-form-urlencoded` format.

**grant\_type** `string` *required*

Denotes the flow you are using. For Client Credentials use `client_credentials`.

Allowed values: `client_credentials`

**client\_id** `string` *required*

Your application's Client ID.

**client\_secret** `string` *required*

Your application's Client Secret.

**audience** `string` *required*

The unique identifier of the target API you want to access.

**resource** `string`

The identifier of the target API (resource server) you want to access. Must match an API Identifier registered in your Auth0 tenant. Used as an alternative to `audience` when the tenant's [Resource Parameter Compatibility Profile](https://auth0.com/docs/get-started/tenant-settings#settings-advanced) is set to `compatibility`.

**organization** `string`

\[Recommended]The organization or identifier with which you want the request to be associated. To learn more, read [Machine-to-Machine Access for Organizations](https://auth0.com/docs/manage-users/organizations/organizations-for-m2m-applications).

## Response Schema

\{}

application/json

**access\_token** `string`

The access token.

**token\_type** `string`

The type of token. Usually `Bearer`.

**expires\_in** `integer`

The access token lifetime in seconds.

## Agent access tokens

> [!WARNING]
>
> **The Agent as Principal feature is in [Early Access](/docs/docs/troubleshoot/product-lifecycle/product-release-stages).**
>
> To participate, contact Auth0 Support.
>
> By using this feature, you agree to the applicable Free Trial terms in Okta's [Master Subscription Agreement](https://www.okta.com/legal).

When the requesting application is linked to an agent and agent subject claims are enabled for the target API, the issued access token identifies the agent as the subject:

* The `sub` claim is the agent identifier (for example, `agt_72jbvv7LfRKYp59gtRLtkn`) instead of the application Client ID.
* The token includes `sub_profile: "ai_agent"` and `client_profile: "service ai_agent"`.

For a non-agent Machine-to-Machine (M2M) application calling an API with agent subject claims enabled, the `sub` claim is the application Client ID without the `@clients` suffix. The response object schema (`access_token`, `token_type`, `expires_in`) is unchanged; these are claims inside the issued JWT. To learn more, read [Access Token Profiles](/docs/docs/secure/tokens/access-tokens/access-token-profiles#claims).

## Response Messages

| Status | Description |
| - | - |
| 200 | Successful response |
