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

# 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.

![](https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-c0016ebd81b43741292c19d578ac943ededff5d4%2FProfile%20menu%20-%20generate%20oauth%20credentials.png?alt=media)

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

![](https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-c83937f7a2d3c9eab8457b7c76ea1ff856eb656e%2FAccount%20settings%20-%20OAuth%20credentials%20-%20regenerated.png?alt=media)

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


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.datasaur.ai/api/credentials.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
