Refresh Token
Obtain a new access token using your refresh token.
POST
/api/v1/refresh-tokenDescription
When your access token expires (after 4 hours), use the refresh token endpoint to obtain a new token without re-entering credentials.
Request
Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| refresh_token | string | Yes | The refresh token obtained during login |
Response
Response Fields
| Field | Type | Description |
|---|---|---|
| message | string | Status message indicating successful token refresh |
| token | string | New JWT token valid for 4 hours |
Error Responses
Common error responses you may encounter when using this endpoint.
Notes
- Tokens expire after 4 hours for security.
- Use the refresh token endpoint to renew tokens before expiry.
- Ensure secure storage of tokens on the client-side to prevent unauthorized access.
Related Endpoints
Did this page help you?
Request Example
curl -X POST https://dev-api.unduit.com/api/v1/refresh-token \
-H "Content-Type: application/json" \
-d '{
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}'Success Response (200)
{
"message": "Token has been refreshed successfully.",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiZW1haWwiOiJmYWlyd2F5aW5kZXBlbmRlbnRtb3J0Z2FnZWNvcnBvcmF0aW9uQHVuZHVpdC5jb20iLCJjb21wYW55X2lkIjozMTcsImlhdCI6MTczMzM5Mzk5NSwiZXhwIjoxNzMzMzk3NTk1fQ.qvWAgXO-AUr5-JurBC_cBMJ1y-SWJmkcTlihS-n5gjw"
}Error Responses
401 Unauthorized
{
"message": "Invalid or expired refresh token"
}400 Bad Request
{
"message": "Missing required field: refresh_token"
}403 Forbidden
{
"message": "Refresh token has been revoked"
}