Login (JWT)
POST /v1/auth/login
Autentica um usuario originador e retorna um token JWT.
Request
{
"email": "usuario@empresa.com",
"password": "sua_senha_segura"
}
| Campo | Tipo | Obrigatorio | Validacao |
|---|---|---|---|
email | string | Sim | 5-254 caracteres |
password | string | Sim | 8-256 caracteres |
Exemplos
- cURL
- Python
- Node.js
curl -X POST https://receivables-api.zemocapital.com/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "dev.admin@zemocapital.com", "password": "sua_senha"}'
import requests
response = requests.post(
"https://receivables-api.zemocapital.com/v1/auth/login",
json={"email": "dev.admin@zemocapital.com", "password": "sua_senha"}
)
token = response.json()["access_token"]
const response = await fetch(
"https://receivables-api.zemocapital.com/v1/auth/login",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email: "dev.admin@zemocapital.com", password: "sua_senha" })
}
);
const { access_token } = await response.json();
Response 200
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "bearer",
"user": {
"id": "01970dc6-61cb-721a-9f4b-1bde936a0503",
"originator_id": "01970dc5-a1b2-7123-8abc-def012345678",
"email": "dev.admin@zemocapital.com",
"full_name": "Admin Dev",
"role": "OWNER"
}
}
Response 401
{"detail": "invalid_credentials"}
Response 423
{"detail": "user_locked"}
Token de curta duracao
O JWT expira em 15 minutos. Faca login novamente quando receber 401 token_expired.
Verificar sessao
GET /v1/auth/me
Retorna os dados do usuario autenticado.
curl https://receivables-api.zemocapital.com/v1/auth/me \
-H "Authorization: Bearer $TOKEN"