# Refresh tokens

> Use the refresh token to obtain a new access token.

Source: https://docs.mycrmsim.com/docs/authentication/refresh-token

```http
POST https://backend.mysmsgateway.app/api/v1/third_party_integrations/oauth/token
```

- Category: Authorization / OAuth 2.0
- Auth: OAuth client credentials

When you get a 401 from the API ("Invalid or expired access token"), call this endpoint with your stored refresh_token to get a fresh pair. Replace both stored tokens with the new values. Access tokens expire after 24 hours (`expires_in`); refresh tokens after 1 year. Every refresh returns a new refresh token, but tokens are stateless signed JWTs: the previous refresh token is NOT invalidated by rotation and stays usable until its own expiry or until the installation is suspended. Keep only the newest pair. Because the old token stays valid, a refresh that times out or returns a 5xx is safe to retry with exponential backoff (for example 1 s, 2 s, 4 s). The token endpoints are not covered by the per-installation API rate limits and do not return 429.

## Request body

```json
{
  "grant_type": "refresh_token",
  "refresh_token": "<YOUR_REFRESH_TOKEN>",
  "client_id": "<YOUR CLIENT_ID>",
  "client_secret": "<YOUR CLIENT_SECRET>"
}
```

## Response 200

Fresh tokens issued

```json
{
  "success": true,
  "data": {
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "token_type": "Bearer",
    "expires_in": 86400,
    "scopes": [
      "contacts.read",
      "contacts.write"
    ]
  }
}
```

## Response 401

Refresh token invalid or revoked

```json
{
  "success": false,
  "message": "Invalid or expired refresh_token"
}
```
