> For the complete documentation index, see [llms.txt](https://docs.loomai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.loomai.com/api/authentication/client-credentials-flow.md).

# Client Credentials Flow

Use for

* Internal / Backend Services & Scripts

{% hint style="warning" %}
Do not use this flow for applications that are not able to securely store your application's client secret.
{% endhint %}

{% hint style="info" %}
Client Credentials Flow is a premium feature. Please [contact us](https://loomai.com/contact) for access or use [Resource Owner Flow](/api/authentication/resource-owner-flow.md) alternatively.
{% endhint %}

Following process describes how to authenticate and obtain authorization for the Loom AI API using the [OAuth2 Client Credentials Flow](https://oauth.net/2/grant-types/client-credentials/).

#### Request

```bash
curl --request POST \
  --url 'https://auth.loomai.com/oauth/token' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data grant_type=client_credentials \
  --data audience=https://api.loomai.com/ \
  --data client_id={CLIENT_ID} \
  --data client_secret={CLIENT_SECRET}
```

| Parameter       | Description                                                     |
| --------------- | --------------------------------------------------------------- |
| `grant_type`    | Set to `client_credentials`.                                    |
| `audience`      | Set to `https://api.loomai.com/`.                               |
| `client_id`     | Your application's [Client ID](/guides/api-credentials.md).     |
| `client_secret` | Your application's [Client Secret](/guides/api-credentials.md). |

#### Response

```javascript
{
  "access_token": "eyJz93a...k4laUWw",
  "token_type": "Bearer",
  "expiry": 3600
}
```
