# Recipients and routing

Every envelope lists one or more `recipients`. Each one has a `type`, a `key` you choose
(`^[a-z][a-z0-9_]*$`, unique in the envelope) and, except for automatic signers, a `name` and an
`email`. Places refer to a recipient by its `key`; the API refers to it by the `id` it returns.

## Types

| `type` | What the person does | Signing places | Default `delivery_type` |
|---|---|---|---|
| `signer` | Reviews the documents, fills in their places and signs | Required: at least one `signature` or `initials` place | `email` |
| `approver` | Reviews and approves or rejects; fills in their own input places | Not allowed | `none` |
| `preparer` | Fills in places before the signers see the documents | Not allowed | `none` |
| `automatic_signer` | Nothing: Sign API signs for you with images you provide | Optional, with a preset image for each | (no email) |
| `qualified_signer` | Signs with a qualified certificate from your trust service provider | Exactly one `signature` place | `email` |

A signer who should never get an email, because you show the ceremony in your app, takes
`delivery_type: "none"`; see [Embedded signing](https://docs.signapi.dev/embedded-signing). Approvers and preparers default
to `none`, so give them `delivery_type: "email"` if they should get an invitation.

`signature_options` limits how a signer signs: `["typed"]`, `["drawn"]`, or both (the default).

### Automatic signers

An automatic signer applies your organization's signature without anyone opening a ceremony. It
needs a `mandate` (1 to 500 characters, shown in the audit log) and, for each `signature` or
`initials` place it owns, a preset image:

```json
{
  "type": "automatic_signer",
  "key": "company",
  "name": "Example Ltd",
  "mandate": "Countersigned on behalf of Example Ltd under board resolution 12.",
  "signature": { "type": "drawn", "url": "https://api.signapi.lumin.example/v1/v1/uploads/upl_…" }
}
```

The image is a PNG upload from your account, at most 4000 × 4000 pixels. Sign API copies it when
the envelope is created, so the upload may expire afterwards. A signing place without a matching
preset is refused with [`preset_symbol_missing`](https://docs.signapi.dev/errors/preset_symbol_missing).

When its turn comes, an automatic signer completes at once (`recipient.completed`) and the next
recipient is released. An envelope with only automatic signers completes as soon as it is
processed.

## Routing

`routing` decides who is asked when:

- **`sequential`** (the default): recipients act in array order. Everyone after the first starts
  as `awaiting` and is released when the one before completes.
- **`parallel`**: everyone is released when the envelope starts, and the envelope completes once
  all of them have.

Put preparers first in a sequential envelope so their values are in place before anyone signs.
Approvers and preparers see and fill in only their own places; what they enter is visible to
recipients after them.

## Recipient status

| Status | Meaning |
|---|---|
| `awaiting` | Sequential routing: waiting for earlier recipients. |
| `pending` | Released and next to act. |
| `sent` | The invitation was sent, or the ceremony was opened. |
| `completed` | Signed, approved or filled in. |
| `rejected` | Declined to sign, or rejected as an approver. |
| `soft_bounced` | The email could not be delivered for now. |
| `hard_bounced` | The email address does not accept mail. |
| `failed` | The recipient cannot continue, for example because the address is blocked. |
| `replaced` | You replaced this recipient with another person. |

Each change emits a `recipient.*` event; see [Webhooks](https://docs.signapi.dev/webhooks-guide) for the list.

A rejection does **not** end the envelope. It stays `in_progress` so you can
[replace](https://docs.signapi.dev/api/ReplaceRecipient) the recipient or [cancel](https://docs.signapi.dev/api/CancelEnvelope) the envelope.

## Resending an invitation

[Resend a request](https://docs.signapi.dev/api/ResendRequest) sends a reminder to a recipient in `sent` or
`soft_bounced` whose ceremony uses `email_link`, while the envelope is `in_progress`. To avoid
flooding people, resends are spaced out, counting the first invitation as email 1:

| After email | Wait before the next |
|---|---|
| 1 to 3 | 15 minutes |
| 4 to 6 | 1 hour |
| 7 to 9 | 24 hours |
| 10 | No more resends ([`too_many_attempts`](https://docs.signapi.dev/errors/too_many_attempts)) |

Each resend answers with `can_resend_at`, the earliest time for the next one; a resend before then
is refused with [`resend_too_early`](https://docs.signapi.dev/errors/resend_too_early). You can override the reminder's subject and
message with `subject_override` and `message_override`.

## Replacing a recipient

[Replace a recipient](https://docs.signapi.dev/api/ReplaceRecipient) hands a recipient's turn to someone else, with a
new name, email and ceremony. Use it after a hard bounce, a rejection, or when the wrong person
was named. Any recipient can be replaced except one that is `completed` or already `replaced`,
and except automatic signers. The old recipient becomes `replaced`, and the new one takes its
place in the routing order.

## Blocked addresses

An address that hard-bounced, marked our email as spam, or was refused by the email provider is
blocked. A recipient with a blocked address is refused with
[`recipient_email_blocked`](https://docs.signapi.dev/errors/recipient_email_blocked) when you create the envelope or
replace the recipient. Error details name the recipient by its position or ID, never by its
address. Contact support to unblock an address once the problem is fixed.
