# Email a sign-in code

> Page: https://docs.plotwork.dev/api/post-auth-code. Index of every page: https://docs.plotwork.dev/llms.txt

Sends a six-digit code to the address.

`POST /auth/code`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Email a sign-in code. |
| What does it take? | A JSON body of type [`RequestCodeBody`](https://docs.plotwork.dev/api/schemas.md#requestcodebody). |
| What does it return? | Status 202 with a body of type [`Accepted`](https://docs.plotwork.dev/api/schemas.md#accepted). |
| What can go wrong? | `400` the address is not valid; `403` the request came from an origin that may not sign in; `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.

## Request body

The body has the type [`RequestCodeBody`](https://docs.plotwork.dev/api/schemas.md#requestcodebody).

| Field | Type | Required | Description |
|---|---|---|---|
| `email` | `string` | yes | at least 3 characters; at most 254 characters. |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 202 | Accepted. | [`Accepted`](https://docs.plotwork.dev/api/schemas.md#accepted) |
| 400 | The address is not valid. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 403 | The request came from an origin that may not sign in. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 429 | Too many requests. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 502 | The email could not be sent. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |

## Response body

A 202 answer has the type [`Accepted`](https://docs.plotwork.dev/api/schemas.md#accepted).

| Field | Type | Required | Description |
|---|---|---|---|
| `accepted` | `true` | yes |  |

## See also

| Doc | Why |
|---|---|
| [API reference](https://docs.plotwork.dev/api/reference.md) | Every endpoint, and the error envelope |
| [Schemas](https://docs.plotwork.dev/api/schemas.md) | Every request and response type |
| [Tool reference](https://docs.plotwork.dev/mcp/tools.md) | The operations as callable tools |
