Skip to main content

Endpoint

curl -X POST http://localhost:8000/api/v1/auth/factus/login \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d '{
    "email": "[email protected]",
    "password": "your_password"
  }'
POST /api/v1/auth/factus/login Authenticate with the Factus API using email and password to receive OAuth2 access and refresh tokens.

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

email
string
required
Email address for Factus authentication (must be a valid email format)
password
string
required
Password for Factus authentication

Request Example

{
  "email": "[email protected]",
  "password": "your_password"
}

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: “Autenticación exitosa”
data
object
Contains the authentication token information:
access_token
string
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
OAuth2 refresh token for obtaining new access tokens
errors
any
Error details (null on success)

Success Response Example

{
  "success": true,
  "message": "Autenticación exitosa",
  "data": {
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "token_type": "bearer",
    "expires_in": 3600,
    "refresh_token": "def502004a8b9c..."
  },
  "errors": null
}

Error Responses

400 Bad Request

Returned when authentication with Factus fails.
{
  "detail": "No se pudo obtener 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