# User token flow

App user tokens authorize requests to [SendPulse Service REST API](https://sendpulse.com/integrations/api), allowing specific actions on user account data based on [scopes](https://sendpulse.com/knowledge-base/app-directory/developers/overview).

The token is valid for a limited time. To authorize a request later, you need to renew your token. Still, try to avoid making frequent requests so as not to overload SendPulse and get blocked.

Take a look at what the app user token flow looks like:

To get an app user token, send a POST request to:

|     |
| --- |
| **https://api.sendpulse.com/oauth/access_token/market** |

Request parameters:

|     |     |     |
| --- | --- | --- |
| `client_id` | _string_ | App user key* |
| `client_secret` | _string_ | App user key* |
| `grant_type` | _string_ | Equal to `client_credentials` |

*App user keys (`client_id` and `client_secret`) are different from the keys that the user can find in their account settings. App user keys can only be obtained through the [authorization flow](https://sendpulse.com/knowledge-base/app-directory/developers/login-flow).

Request example:

```
{
  "client_id": "b2bfd8a8441294fa0171c195ada8cf56",
  "client_secret": "f7064fb0bbecd392d7b3ea2e2bd77758",
  "grant_type": "client_credentials"
}
```

Response example if the request is successful:

```
{
  "token_type": "Bearer",
  "expires_in": 7200,
  "access_token": "eyJ0eXAiOiJKV1Q...Bv1L"
}
```

Response parameters:

|     |     |     |
| --- | --- | --- |
| `token_type` | _string_ | Token type. |
| `expires_in` | _int_ | Token lifetime. The default lifetime is 60 minutes. |
| `access_token` | _string_ | App user token. |

If your request is unsuccessful, you will receive an error `401 Unauthorized`.

Response example if the request is not successful:

```
{
"error": "invalid_client",
"error_description": "Client authentication failed",
"message": "Client authentication failed"
}
```

If you received an error, check the data you used, and send the request again.

Last Updated: 16.05.2025
