# Sign in with a code

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

Checks the code from the email.

`POST /auth/verify`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Sign in with a code. |
| What does it take? | A JSON body of type [`VerifyCodeBody`](https://docs.plotwork.dev/api/schemas.md#verifycodebody). |
| What does it return? | Status 200 with a body of type [`SignInResponse`](https://docs.plotwork.dev/api/schemas.md#signinresponse). |
| What can go wrong? | `400` the body is not valid; `401` the code is wrong, expired, or used; `403` the request came from an origin that may not sign in, or the account is suspended; `429` too many requests. Every failure uses the one error envelope. |

## What it does

Checks the code from the email. On success it makes the account if there is none, opens a session, and sets the session cookie, which is HTTP-only and shared by every Plotwork subdomain, and a plain marker cookie, `plotwork_signed_in`, that tells the site and the docs a session exists. An account the operator suspended gets no session. A code dies after five wrong guesses or ten minutes.

## Request body

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

| Field | Type | Required | Description |
|---|---|---|---|
| `email` | `string` | yes | at least 3 characters; at most 254 characters. |
| `code` | `string` | yes | pattern `^\d{6}$`. |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 200 | Signed in. | [`SignInResponse`](https://docs.plotwork.dev/api/schemas.md#signinresponse) |
| 400 | The body is not valid. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 401 | The code is wrong, expired, or used. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 403 | The request came from an origin that may not sign in, or the account is suspended. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 429 | Too many requests. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |

## Response body

A 200 answer has the type [`SignInResponse`](https://docs.plotwork.dev/api/schemas.md#signinresponse).

| Field | Type | Required | Description |
|---|---|---|---|
| `user` | `Account` | yes |  |
| `user.id` | `string` | yes |  |
| `user.email` | `string` | 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 |
