# Credentials

{% hint style="info" %}
If you are looking to generate an API Key for using LLM Labs Sandbox, please refer to this [page](https://docs.datasaur.ai/llm-projects/deployment).
{% endhint %}

Before moving forward, you should have credentials to access Datasaur API. Datasaur API uses the [Oauth 2.0 protocol](https://tools.ietf.org/html/rfc6749) for authentication and authorization. Datasaur uses the [Client Credentials Grant](https://tools.ietf.org/html/rfc6749#section-4.4).

You can generate the credentials by logging in to your account and select Generate OAuth Credentials.

Base URL: [https://datasaur.ai/api/oauth/token](https://basedomain.ai/api/oauth/token)

## User Flow

1. Obtain OAuth 2.0 credentials by requesting them from us. We will provide the credentials (`client_id` and `client_secret`).
2. Obtain access tokens by using `client_id` and `client_secret` .

   ```javascript
   curl --location --request POST 'https://datasaur.ai/api/oauth/token' \
   --header 'Content-Type: application/x-www-form-urlencoded' \
   --data-urlencode 'client_id=client_id' \
   --data-urlencode 'client_secret=client_secret' \
   --data-urlencode 'grant_type=client_credentials'
   ```
3. Use the access token to access the Datasaur API.

### Response

```javascript
{
    "access_token": "618f4778263fdcf5e9345e5aeaad05ac54ef2818",
    "token_type": "bearer",
    "expires_in": 3600
}
```

Now that you have the access token, we'll provide an example of how to [create a new project via the API](/api/create-new-project.md).

## Generate OAuth Credentials Menu

You can generate OAuth credentials by your own! After logging in, you can go to profile menu at the upper right corner and select Generate OAuth credentials.

![](/files/npp52ROsps055rNL7kJq)

You can keep the Client ID and Client secret of each member. If you regenerate the OAuth Credentials, the old one will be invalidated.

![](/files/QAmpmh25n8q07RzJ5rhQ)

\_\_📌 *Note: this feature only applies on Growth and Enterprise. Please contact us to upgrade your account on <support@datasaur.ai>.*


---

# 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.datasaur.ai/api/credentials.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.
