Refresh Access Token

Refresh the access token to ensure that your application and the YCM are connected via the API interface.

Note: Refresh the API token in each 30 minutes, or the old access token will be invalid and you application and the YCM will be disconnected.

Request URL

POST {base_url}/dm/open_api/oauth/token

Request parameters

Body
Table 1.
Parameter Required Type Description
grant_type Yes String Authorization grant type, the value is refresh_token.
refresh_token Yes String The latest refresh_token value.

Response parameters

Table 2.
Parameter Type Description
access_token String The new access token.
refresh_token String The new refresh token.
token_type String Identify the type of token returned.

For YCM API, this field always has the value bearer.

expires_in Integer The expiration time of access token.

Time unit: second.

Examples

Request example

POST /dm/open_api/oauth/token HTTP/1.1
Host: ycm.yeastar.com
Content-Type: application/x-www-form-urlencoded

grant_type=refresh_token&refresh_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21Kd3RQYXlsb2FkSW5mbyI6eyJncmFudFR5cGUiOiJjbGllbnRfY3JlZGVudGlhbHMiLCJ5c0lkIjoxNzg5NjM2MDM5MDg1MDI1NzM0OSwidmVyc2lvbiI6MTYzODk1OTkwOSwicmVmcmVzaFZlcnNpb24iOjE2Mzg5NjA0MzN9LCJzY29wZSI6WyJhbGwiXSwiYXRpIjoiMWQ5OTE4ZWUtNDg5MC00M2M2LTljOGYtMjYzMjFlMDU1ZjY5IiwiZXhwIjoxNjQwMjU2NDMzLCJhdXRob3JpdGllcyI6WyJST0xFX0NMSUVOVCJdLCJqdGkiOiI3OGY4NDc4YS1iZGJmLTRjYzAtODVjMC0zMzQ3ZDU4YWU3NDIiLCJjbGllbnRfaWQiOiJrcDl5eW50bXVlc3VrNWpvV3ZNa1RiQ0J4cU82TEtSaCJ9.mShzSqjjixXgAZ3Cd5DiA4C1OVRzYrAqjfypE0A5mAg
Figure 1. Request example in Postman

Response example

HTTP/1.1 200 OK
{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21Kd3RQYXlsb2FkSW5mbyI6eyJncmFudFR5cGUiOiJjbGllbnRfY3Jl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