# auth/v1/token

Use the `auth/v1/token` endpoint to request an authorization token for the DT Offer Wall Reporting API. Authorization tokens expire after one hour.

| **Host URL** | `https://reporting.fyber.com/`   |
| ------------ | -------------------------------- |
| **Method**   | `POST`                           |
| **Endpoint** | `/auth/v1/token`                 |
| **Headers**  | `Content-Type: application/json` |
| **Params**   | `format csv`                     |

## Sample Authentication Request

```
https://reporting.fyber.com/auth/v1/token
```

{% code overflow="wrap" %}

```json
{
    "grant_type": "client_credentials",
    "client_id": "3ce66d885XXXXXXXXXXa3b752bb9058",
    "client_secret": "YtMvC7VYTQMQ7w9UCUaFXXXJnwVZnQqqN02XNyt8IIh2h8XFDuXXXXXXXXSS6XTrFWW4TkebCcMLJkrXSw5IurkearTJIDzUxsbiMXv8hb4T23MwN6eE7DDIthRFqDnhnuhiDlY2oPeaOjsMbzE8joZ5cs6tsySJz6uZXwJ-x3lcYaYbgXXXXXXXX3_hFeuXm-C7-me2V1MMs-ftJxTd5QbHoUhG3Q5anCWCW_pg8x3CL4yPGCbpWUDZfpdNPyyCT4rxCEb-VC0Bdqwe8N2GGn_VSFOwQYxa-yap2JuNSGJfl_ZURXXXXXXXXFe1GpHDn8pk7yYwQYIGAg"
}
```

{% endcode %}

| PARAMETER       | TYPE   | STATUS   | DESCRIPTION                                                                                                                                                                                          |
| --------------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `grant_type`    | string | Required | <p>Type of credentials you are sending. When sending API Report credentials, you must specify <code>client\_credentials</code>.<br>The credentials are sent according to the OAuth 2.0 protocol.</p> |
| `client_id`     | string | Required | Your Reporting API ID that DT sends via encrypted email.                                                                                                                                             |
| `client_secret` | string | Required | Your Reporting API password that DT sends via encrypted email.                                                                                                                                       |

## Sample Authentication Response

The Reporting API responds to both successful and unsuccessful authentication token requests.

### Successful Response

When an authentication request is successful, you receive the following response in JSON format:

{% code overflow="wrap" %}

```json
{
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXXXJ9.eyJpYXQiOjE1NzAwMTY5MDAsImV4cCI6MTU3MDAyMDUwMCwiYXVkIjoic3BlZWRiYWxsIiwic3ViIjoiMjEwMjYzIn0.hDo1waTytSys_oRhFNUPqZPom26bL05rxgtSt3XYHqI",
    "tokenType": "bearer",
    "expiresIn": 3600
}
```

{% endcode %}

| PARAMETER     | TYPE   | STATUS   | DESCRIPTION                                                                                                            |
| ------------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| `accessToken` | string | Required | Access token required for Reporting API requests.                                                                      |
| `tokenType`   | string | Required | Type of token issued.                                                                                                  |
| `expiresIn`   | number | Required | <p>Time, in seconds, for which the token is valid.<br>All tokens expire one hour after a successful token request.</p> |

### Unsuccessful Response

When a token request is unsuccessful, the Reporting API returns the following response:

{% code title="JSON" %}

```json
{
    "error": "internal_server_error"
}
```

{% endcode %}

The following table provides possible errors that result in an unsuccessful response.

| HTTP STATUS CODE | ERROR                    | CAUSE                                                                                                                                                                                                                                                                                      |
| ---------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 400              | unsupported\_grant\_type | Invalid `grant_type`. Always specify `client_credentials`.                                                                                                                                                                                                                                 |
| 400              | invalid\_request         | <p>This error occurs for the following reasons:</p><ul><li>Error while parsing JSON request body.</li><li>Missing <code>grant\_type</code> parameter in the request.</li><li>Missing or invalid <code>client\_id</code>.</li><li>Missing or invalid <code>client\_secret</code>.</li></ul> |
| 400              | invalid\_client          | <p>This error occurs for the following reasons:</p><ul><li>The requested credentials are not found.</li><li>The requested credentials are incorrect or cannot be recognized.</li><li>Your account is disabled.</li><li>Your credentials are revoked.</li></ul>                             |
| 500              | internal\_server\_error  | Unexpected error on DT end.                                                                                                                                                                                                                                                                |
