# Verify a sign-in code

`POST /v1/otp/verify`

Exchange a valid email sign-in code for an API key.

## Request

`Content-Type: application/json`. Send `otp` as a four-character string, plus the same `email` used to request the code. The `x-email` header can supply the address instead of JSON `email`.

A valid code is single-use. Verification may create an account.

## Example

```bash
curl --fail-with-body https://ext.tiiny.host/v1/otp/verify \
  -H 'Content-Type: application/json' \
  -d '{"email":"you@example.com","otp":"1234"}'
```

## Success response

`200 OK` returns `{"success":true,"apiKey":"YOUR_API_KEY","existingAccount":true}` for an existing account. New accounts omit `existingAccount`. Store the key securely and send it as `x-api-key`. Redact the code and key from logs.

## Errors

`401` indicates an invalid, expired, or used code. Check the email and [request a fresh code](../request-sign-in-code/) when needed.
