# API clients

Bunny has an extensive GraphQL API that enables you to do everything that can be done via the user interface. In order to access the API, you will need to create one or more API clients. We recommend creating different API clients for different purposes, such as marketing website, self-service, CRM integration etc.&#x20;

It's good practice to narrow down the [scope](/guide/tour/access-control/roles.md) as much as possible in order to limit your security exposure.

<figure><img src="/files/zuigq3SFAveo4ZSffWBZ" alt=""><figcaption><p>API client</p></figcaption></figure>

See Bunny's developer documentation for more details [on how to use the API](https://docs.bunny.com/developer/using-the-graphql-api/api) both directly and via Bunny's SDKs.

#### Rotating client secret

If you client secret has been compromised or needs to be changed you can select the **Renew client secret** action.&#x20;

<figure><img src="/files/TW657aJkl2hQBPVpoXMT" alt=""><figcaption></figcaption></figure>

This will immediately generate a new client secret and display it once on the screen. The previous client secret will be removed and no longer work.&#x20;

Any access tokens that were generated with the old client secret will continue to work until their token expiry date/time has passed.&#x20;

#### Generating an access token

You can use the OAuth2 client credentials grant to generate an access token with a refined set of scopes based on the scopes that were enabled on the api client.&#x20;

Alternately you can generate an access token via the admin UI by clicking the **Generate access token** button. This will generate an access token containing all of the scopes that have been enabled for the api client and will expire based on the expiration setting for that client.&#x20;

### Events

To aid with troubleshooting API issues, events are stored for seven days. You can browse them on the events tab and see the detailed payloads and responses.

<figure><img src="/files/s8qGj338wg9NqwXRyNt3" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: 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:

```
GET https://docs.bunny.com/guide/tour/access-control/api-clients.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
