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

# OAuth Token

> Exchange client credentials for an access token

## Endpoint

`POST https://api.apifycloud.io/api/v1/oauth/token`

## Authentication

No bearer token required.

## Request body

* `grant_type` (string, required) must be `client_credentials`
* `client_id` (string, required)
* `client_secret` (string, required)

```json theme={null}
{
  "grant_type": "client_credentials",
  "client_id": "your_client_id",
  "client_secret": "your_client_secret"
}
```

## Response

```json theme={null}
{
  "data": {
    "access_token": "string",
    "token_type": "Bearer",
    "expires_in": 3600
  },
  "meta": {
    "timestamp": "2024-01-01T00:00:00.000Z"
  }
}
```

## Errors

* `400 invalid_request` invalid JSON body
* `400 unsupported_grant_type` only `client_credentials` supported
* `400 invalid_client` missing `client_id` or `client_secret`
* `401 invalid_client` client not found or invalid secret
* `500 server_error`

## Example

```bash theme={null}
curl -X POST "https://api.apifycloud.io/api/v1/oauth/token" \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "client_credentials",
    "client_id": "your_client_id",
    "client_secret": "your_client_secret"
  }'
```
