Skip to content
These docs describe Tradr v0.17.0. Running an older release? Check the release notes for what changed.

Sign in and start a session.

POST
/api/auth/login
curl --request POST \
--url https://api.tradr.cloud/api/auth/login \
--header 'Content-Type: application/json' \
--data '{ "email": "hello@example.com", "password": "example" }'

Public. On a password-only account a correct sign-in sets the session cookie; every authenticated endpoint reads it. When two-factor is enabled the correct password instead returns 202 with a single-use challenge and NO cookie — the caller answers that challenge with the current code to finish signing in. Rate limited to 10 requests per 15 minutes per client, tightening to 5 while the shared rate-limit store is unavailable. A wrong email and a wrong password are answered identically, so the response does not reveal whether an address is registered. After too many failed sign-ins the address is temporarily locked and every attempt — even with the correct password — is refused 429 ACCOUNT_LOCKED with Retry-After, whether or not an account exists for it. A user may hold 5 concurrent sessions; signing in a sixth time ends the oldest one.

Media typeapplication/json
object
email
required
string format: email
password
required
string
>= 8 characters <= 72 characters
Examplegenerated
{
"email": "hello@example.com",
"password": "example"
}

The signed-in user. The session cookie is set.

Media typeapplication/json
object
user
object
email
string format: email
emailVerified
boolean
id
string format: uuid
isAdmin
boolean
Examplegenerated
{
"user": {
"email": "hello@example.com",
"emailVerified": true,
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"isAdmin": true
}
}

Two-factor is enabled on the account. No session is started and no cookie is set; the body carries a single-use challenge to answer with the current two-factor code.

Media typeapplication/json
object
challenge
string
twoFactorRequired
boolean
Examplegenerated
{
"challenge": "example",
"twoFactorRequired": true
}

Validation error.

Invalid email or password.

Rate limit exceeded, or the address is temporarily locked after too many failed sign-ins (ACCOUNT_LOCKED).