Protobox

Refresh Access Token

Refresh an expired access token using a valid refresh token.

Use this endpoint when your access token has expired (after 1 hour) to get a new access token without requiring the user to re-authenticate.

Request
curl -X POST "https://platform.protobox.ai/api/v1/auth/refresh" \
  -H "Content-Type: application/json" \
  -d '{
    "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
  }'
const response = await fetch('https://platform.protobox.ai/api/v1/auth/refresh', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    refresh_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
  })
});

const { data } = await response.json();
localStorage.setItem('access_token', data.access_token);
import requests

response = requests.post(
    'https://platform.protobox.ai/api/v1/auth/refresh',
    json={
        'refresh_token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
    }
)

data = response.json()['data']
new_access_token = data['access_token']
Response
{
  "success": true,
  "data": {
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "expires_in": 3600,
    "token_type": "Bearer"
  }
}
{
  "success": false,
  "error": {
    "code": "INVALID_REFRESH_TOKEN",
    "message": "Refresh token is invalid or expired"
  }
}