# Ceremonies and recipient authentication

A **ceremony** is the session in which one recipient reviews and signs. You configure it with the
recipient's `ceremony` object when you create the envelope. If you leave it out, a recipient with
`delivery_type: email` gets an email with a link, and following the link is the authentication.

```json
"ceremony": {
  "authentication": [{ "type": "email_link" }, { "type": "email_code" }],
  "redirect_url": "https://app.example.com/signed",
  "redirect_delay": 3
}
```

## Authentication methods

| `type` | How the recipient proves who they are |
|---|---|
| `email_link` | They follow the link in the invitation we email them. `subject_override` and `message_override` change that email's subject and message. |
| `email_code` | They enter a 9-digit code we email when they open the ceremony. |
| `custom` | You have already signed them in. Your `provider` name and `data` (a map of labels to values) are written to the audit log. |
| `identity_verification` | They complete an identity check with a verification provider. |

### Combining methods

`authentication` is a list of up to 5 methods, completed in order. The rules:

- `email_link` and `custom` can only be first, and never appear together.
- `email_code` appears at most once.
- `identity_verification` cannot be first and appears at most once.

`custom` followed by `email_code` is a common choice for embedded signing: your app vouches for
the person, and the code confirms they control the address on the envelope.

### Email codes

A code is valid for one hour. Asking for it again within that hour resends the same code, with
the wait between requests doubling from 30 seconds. Five wrong entries lock the step until the
code expires.

### Identity verification

`method` is `document_selfie`, `eid`, `video_ident` or `reuse_credential`, and `provider` is
`stub` for now: a test page where whoever is testing approves or rejects the check. Identity
verification is enabled per account; ask support. Five rejected checks lock the step. Each check
emits `recipient.identity_verification_started`, then `recipient.identity_verified` or
`recipient.identity_rejected`.

## The ceremony URL

`recipients[].ceremony.url` is `null` until the recipient is released, and for recipients whose
ceremony starts with `email_link` (the link only goes out by email). For other ceremonies, read
the URL from the envelope or create a fresh one with
[Create a ceremony](https://docs.signapi.dev/api/CreateRecipientCeremony). Creating a ceremony revokes the previous one:
its URL stops working.

`url_variant: "short"` gives a shorter URL, handy in text messages.

The URL works for anyone who has it, after the authentication steps you chose. Treat it like a
password: don't log it or put it in analytics.

## After signing

| Setting | Effect |
|---|---|
| `redirect_url` | An `https` URL the recipient is sent to when they finish. |
| `redirect_delay` | Seconds the result page shows first, 0 to 20 (default 3). |
| `embeddable_in` | Up to 10 origins allowed to show the ceremony in a frame. |

For iframes, WebViews and the events a ceremony sends to your page, see
[Embedded signing](https://docs.signapi.dev/embedded-signing).

## Languages

The ceremony and its emails follow the envelope's `language`. Besides SignatureAPI's nine
languages (`en es fr it pt de zh hu nl`, where `pt` is Brazilian Portuguese), Sign API accepts 45
more, such as `ja`, `ko`, `pl`, `pt-PT`, `es-419`, `ar` and `he`; the
[OpenAPI document](https://api.signapi.lumin.example/v1/openapi.yaml) lists them all.
