> For the complete documentation index, see [llms.txt](https://developer.jylo.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.jylo.ai/authentication/oauth2.0-client-credentials-grant.md).

# OAuth2.0 - Client Credentials Grant

The client credentials grant flow is primarily used by applications to authenticate as themselves, rather than as a user. Here’s how you can achieve this:

1. **Register Your Application:** Before you can request an access token, ensure that you have registered your application, assigned the necessary permissions and obtained the necessary credentials such as a client ID and client secret.
2. **Request an Access Token:** To obtain an access token, send an HTTP POST request to the appropriate token endpoint for your region. Include the necessary credentials (client ID and secret) in your request. The audience value is `https://jga.jylo.ai/external/v2`.
3. **Handle the Access Token**: After a successful request, the token endpoint will return an access token. You should securely store this token and re-use it during it's lifetime (found in the `exp`claim) and use it to authenticate your application's requests to the API.

Token endpoints by region:

* UK: `https://login.uk.jylo.ai/oauth/token`
* EU: `https://login.eu.jylo.ai/oauth/token`
* US: `https://login.us.jylo.ai/oauth/token`

Ensure you follow security best practices, such as keeping client credentials secure and managing token expiration and renewal appropriately.

## Examples

#### cURL&#x20;

```
curl -X POST \
  https://YOUR_TOKEN_ENDPOINT \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&audience=https://jga.jylo.ai/external/v2'
```

In this example:

* Replace `YOUR_TOKEN_ENDPOINT` with one of the above appropiate endpoints for your region.
* Replace `YOUR_CLIENT_ID` with your application’s client ID.
* Replace `YOUR_CLIENT_SECRET` with your application’s client secret.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.jylo.ai/authentication/oauth2.0-client-credentials-grant.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
