> For the complete documentation index, see [llms.txt](https://docs.adjutor.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.adjutor.io/adjutor-api-endpoints/transactions-and-balances-with-kolo/initializing-authorization.md).

# Initializing Authorization

In order to gain access to the customer's data using Kolo's API, you need to initialize the authorization process. This involves exchanging an authorization code for an access token, which will allow you to interact with the other API endpoints securely and with consent.

## **Step 1: Obtain Authorization Code**

In order to obtain an authorization code, you need to redirect users to the Kolo authorization URL so they can grant you consent to access their data. Here’s the format of the authorization URL:

```
GET https://app.kolo.finance/data-share?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}&scope={SCOPE}
```

| Parameter      | Description                                                                         |
| -------------- | ----------------------------------------------------------------------------------- |
| response\_type | Set this to `code` to receive an authorization code.                                |
| client\_id     | Your Adjutor application's client ID. You get this when creating an app on Adjutor. |
| redirect\_uri  | The URI to redirect to after authorization.                                         |
| scope          | The scope of the access request (e.g., `transaction:list`).                         |

**Example Request:**

```
GET https://app.kolo.finance/data-share?response_type=code&client_id=your_client_id&redirect_uri=https://app.adjutor.io&scope=transaction:list
```

## **Step 2: Exchange Authorization Code for Access Token**

Once the user authorizes your application and grants you access, they will be redirected back to your specified `redirect_uri` with an authorization code. You need to exchange this code for an access token. Using this access token, you can then call the other endpoints. The format for this can be found below:

```
POST https://adjutor.lendsqr.com/v2/kolo/auth
```

**Request Body:**

```
code=authorization_code&grant_type=authorization_code&redirect_uri=https://app.adjutor.io
```

| Parameter     | Description                                              |
| ------------- | -------------------------------------------------------- |
| code          | The authorization code received from the previous step.  |
| grant\_type   | Set this to `authorization_code`.                        |
| redirect\_uri | The same redirect URI used in the authorization request. |

**Example Request:**

```bash
curl --location 'https://adjutor.lendsqr.com/v2/kolo/auth' \
--data '{
    "redirect_uri": "https://app.adjutor.io",
    "grant_type": "authorization_code",
    "code": "kEhA1fQsT86ZxCqh"
}'
```

## **Step 3: Receive the Access Token**

If the request is successful, you will receive a response containing the access token and other related information.

**Example Response:**

```json
{
    "access_token": "your_access_token",
    "refresh_token": "your_refresh_token",
    "username": "username",
    "scope": "transaction:list",
    "token_type": "Bearer"
}
```

| Parameter      | Description                                     |
| -------------- | ----------------------------------------------- |
| access\_token  | The token to be used for authenticated requests |
| token\_type    | Type of token, typically "Bearer".              |
| username       | The name of the user                            |
| refresh\_token | Token used to refresh the access token.         |
| scope          | Scopes granted by the access token              |

By following these steps, you can successfully initialize the authorization process and start using the Kolo API to access customer financial data securely.


---

# 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://docs.adjutor.io/adjutor-api-endpoints/transactions-and-balances-with-kolo/initializing-authorization.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.
