Skip to main content
POST
/
auth
/
login
Login
curl --request POST \
  --url https://api.example.com/auth/login \
  --header 'Content-Type: application/json' \
  --data '
{
  "email": "<string>",
  "password": "<string>",
  "remember_me": true
}
'
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "bearer",
  "expires_in": 3600,
  "user": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "email": "[email protected]",
    "nome": "João Silva",
    "telefone": "+5511999999999",
    "created_at": "2024-01-15T10:30:00Z"
  }
}

Login

Autentica um usuário usando email e senha, retornando tokens JWT para acesso à API.
email
string
required
Email do usuário cadastrado
password
string
required
Senha do usuário
remember_me
boolean
default:false
Se true, o refresh_token terá duração estendida (30 dias)

Request

curl -X POST https://api.indiqai.com/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "senha123"
  }'

Response

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "bearer",
  "expires_in": 3600,
  "user": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "email": "[email protected]",
    "nome": "João Silva",
    "telefone": "+5511999999999",
    "created_at": "2024-01-15T10:30:00Z"
  }
}

Campos da Resposta

access_token
string
JWT para autenticar requisições. Válido por 1 hora.
refresh_token
string
Token para renovar o access_token. Válido por 7 dias (ou 30 se remember_me=true).
token_type
string
Sempre “bearer”
expires_in
integer
Segundos até o access_token expirar
user
object
Dados do usuário autenticado

Uso do Token

Após login bem-sucedido, inclua o access_token em todas as requisições:
curl -X GET https://api.indiqai.com/api/v1/users/me \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Rate Limiting

Este endpoint tem limite de 10 requisições por minuto por IP. Após exceder, retorna 429 por 60 segundos.

Erros Comuns

CódigoCausaSolução
400Campos faltandoEnviar email e password
401Credenciais incorretasVerificar email/senha
429Rate limitAguardar tempo indicado
500Erro internoContatar suporte