Sign-in · requestMagicLink
Email a magic link
POST /api/auth/magic-link
Emails a one-time link (15 minutes) to sign in, create the account, or reset the password. The answer is the same whether or not the address has an account. Rate limited per IP and per email. When the server uses Cloudflare Turnstile the app sends its token in the Turnstile-Token header (403 forbidden without a valid one). For an address with no account, or with an unconfirmed email, a global daily cap applies (429 rate_limited, calm text, Retry-After to 00:00 UTC); an address that exists with a confirmed email is never capped.
- Who may call it
- Anyone (no credentials)
- Server
- https://api.logu.dev
Request body#
Content type application/json (required).
Who to email a magic link to, and why. Strict.
| Field | Type | Required | Notes |
|---|---|---|---|
email | string | required | 0–254 chars |
name | string | optional | |
intent | "sign-in" | "sign-up" | "reset" | optional | default "sign-in" |
locale | "en" | "pt-BR" | optional | default "en" |
{
"email": "ana@example.com",
"intent": "sign-in",
"locale": "en"
}
Example#
curl -s -X POST "https://api.logu.dev/api/auth/magic-link" \
-H "Content-Type: application/json" \
-d '{"email":"ana@example.com","intent":"sign-in","locale":"en"}'
Responses#
200
Sent (or would have been).
{
"ok": true
}
Response fields
| Field | Type | Required | Notes |
|---|---|---|---|
ok | true | required |
Errors#
Every error is {"error":{"code","message","hint","docUrl","requestId"}}: branch on code. See Errors.
| Status | Code | Meaning |
|---|---|---|
| 400 | unknown_field | The body has a field the endpoint doesn't know (often a typo or snake_case). |
| 400 | bad_request | The request is malformed or a field is invalid (see issues). |
| 403 | forbidden | The caller is authenticated but may not do this (wrong role, or an API key on a human-only endpoint). |
| 429 | rate_limited | This API key sent too many requests, or a human did too much too fast: sign-in attempts, workspaces created in a day, or a global daily cap on new accounts was reached. |
| 500 | internal_error | Something went wrong on Logu's side. |
| 503 | service_unavailable | A dependency is down or a feature isn't configured on this server. |