Skip to main content

Endpoint

curl -X POST http://localhost:8000/api/v1/auth/factus/refresh \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d '{
    "refresh_token": "def502004a8b9c..."
  }'
POST /api/v1/auth/factus/refresh Refresh an expired Factus OAuth2 access token using a valid refresh token.

Authentication

Required: Bearer token from local login. You must be authenticated with a local access token (from /api/v1/auth/login) before calling this endpoint.

Request Body

refresh_token
string
required
The refresh token obtained from the Factus login endpoint

Request Example

{
  "refresh_token": "def502004a8b9c..."
}

Response

The response is wrapped in a standard ApiResponse envelope:
success
boolean
Indicates if the operation was successful (always true on success)
message
string
Success message: “Token refrescado exitosamente”
data
object
Contains the refreshed authentication token information:
access_token
string
New OAuth2 access token for Factus API requests
token_type
string
Token type (typically “bearer”)
expires_in
integer
Token expiration time in seconds
refresh_token
string
New OAuth2 refresh token (if rotation is enabled)
errors
any
Error details (null on success)

Success Response Example

{
  "success": true,
  "message": "Token refrescado exitosamente",
  "data": {
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "token_type": "bearer",
    "expires_in": 3600,
    "refresh_token": "def502004a8b9c..."
  },
  "errors": null
}

Error Responses

400 Bad Request

Returned when the refresh token is invalid or expired.
{
  "detail": "No se pudo refrescar el token de Factus: [error message]"
}

401 Unauthorized

Returned when the local bearer token is missing or invalid.
{
  "detail": "Not authenticated"
}

Build docs developers (and LLMs) love