Email a sign-in code
Sends a six-digit code to the address.
/auth/codeTL;DR
| Question | Answer |
|---|---|
| What does it do? | Email a sign-in code. |
| What does it take? | A JSON body of type RequestCodeBody. |
| What does it return? | Status 202 with a body of type Accepted. |
| What can go wrong? | 400 the address is not valid; 403 the request came from an origin that may not sign in, its Turnstile token was missing or refused (challenge.failed), or sign-in is for approved people only and the address is not approved (auth.not_approved); 429 too many requests; 502 the email could not be sent. Every failure uses the one error envelope. |
What it does
Sends a six-digit code to the address. There is no separate sign-up: the first successful sign-in makes the account. The answer is the same whether or not an email went out, so it reveals nothing about the address. When the server has a Cloudflare Turnstile secret, turnstileToken must be one Cloudflare accepts, or the answer is 403 challenge.failed and nothing is sent; only the secret and the token go to Cloudflare. While sign-in is for approved people only, an address that is not approved, by itself or by its domain, is refused with 403 auth.not_approved and no code is sent; the answer depends on the approved list alone, never on whether an account has the address.
Request body
The body has the type RequestCodeBody.
| Field | Type | Required | Description |
|---|---|---|---|
email | string | yes | at least 3 characters; at most 254 characters. |
turnstileToken | string | no | The token the Cloudflare Turnstile widget on the sign-in page gave. Required when the server has a Turnstile secret. at most 2048 characters. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 202 | Accepted. | Accepted |
| 400 | The address is not valid. | ErrorResponse |
| 403 | The request came from an origin that may not sign in, its Turnstile token was missing or refused (challenge.failed), or sign-in is for approved people only and the address is not approved (auth.not_approved). | ErrorResponse |
| 429 | Too many requests. | ErrorResponse |
| 502 | The email could not be sent. | ErrorResponse |
Response body
A 202 answer has the type Accepted.
| Field | Type | Required | Description |
|---|---|---|---|
accepted | true | yes |
See also
| Doc | Why |
|---|---|
| API reference | Every endpoint, and the error envelope |
| Schemas | Every request and response type |
| Tool reference | The operations as callable tools |