Skip to content

Refresh Token

To request a new access token once the current one expires, send a POST request to the token endpoint with the refresh token and necessary credentials. In response, the server will issue a new access token, allowing continued API access without requiring the user to repeatedly authenticate.

Request

Endpoint: POST /oauth/token

bash
$ curl --location --request POST 'https://api.youcanpay.com/oauth/token' \
  --form 'client_id="9b2efcdf-4493..."' \
  --form 'client_secret="AGZaZrlI28D..."' \
  --form 'grant_type="refresh_token"' \
  --form 'refresh_token="def50200fb4a514810b8d8fc32..."' \
  --form 'scope=""' \
  --header 'Accept: application/json'

Response

The response object

json
{
  "token_type": "Bearer",
  "expires_in": 31622400,
  "access_token": "eyJ0eXAiOiJKV1QiL...",
  "refresh_token": "def50200fb4a514810b8d8fc32..."
}