# API to Generate Token using private client id

{% tabs %}
{% tab title="Production" %}
<https://accounts.payu.in/oauth/token>
{% endtab %}

{% tab title="Testing" %}
&#x20;<https://uat-accounts.payu.in/oauth/token>
{% endtab %}
{% endtabs %}

## **Request Params**

| **Key**        | **Description**                                                               | **Data type** | **Mandatory** | **Possible values**          |
| -------------- | ----------------------------------------------------------------------------- | ------------- | ------------- | ---------------------------- |
| client\_id     | Login to the Payouts Dashboard and fetch the client ID after OTP verification | String        | yes           |                              |
| grant\_type    | Constant value “client\_credentials “                                         | String        | yes           | client\_credentials          |
| client\_secret | Login to the Payouts Dashboard and fetch the client ID after OTP verification | String        | yes           |                              |
| scope          | Constant value                                                                | String        | yes           | create\_payout\_transactions |

## &#x20;**Example**

**Test Environment Request:**

```
curl -X POST \
 https://uat-accounts.payu.in/oauth/token \
 -H 'cache-control: no-cache' \
 -H 'content-type: application/x-www-form-urlencoded' \
 -d 'grant_type=client_credentials&client_id=cf608fdsfe84fd52f94fbc2702e4bb431641c40339991787568773411df368&client_secret=26ec3cc4bc7caaasdf90b006b655582b92ed0116554597942a884c6cb626e3f&scope=create_payout_transactions'
```

{% hint style="success" %}
Remember to have the Content-Type set as x-www-form-urlencoded to avoid “invalid request” errors
{% endhint %}

**Response:**

```
{
 "access_token": "994as40fd3bee9a0e830b5a5743a93d4f5c32c84f637510b128a7c69586ab8d",
 "token_type": "Bearer",
 "expires_in": 6351,
 "scope": "create_payout_transactions",
 "created_at": 1585215909
}
```

## **Response Params**

| **Key**       | **Description**                                                  |
| ------------- | ---------------------------------------------------------------- |
| access\_token | This is a security token. This will be used further in api calls |
| token\_type   | Type of token                                                    |
| expire\_in    | Access token will get expired in return seconds.                 |
| scope         | allowed scopes in generated security token                       |
| created\_at   | Time of creation in milliseconds                                 |


---

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

```
GET https://payu-docs.gitbook.io/payouts-integration/1.-authentication/generate-token-using-private-client-id.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.
