# verifiedRecipients.add

Add a verified recipient.

Names an outside address and mails it a link to a page whose Confirm button makes it a verified recipient of this account; the link works for seven days, and opening it changes nothing on its own. Posting a pending address again mails a fresh link, at most once a minute. Posting a verified address answers 200 with `sent: false` and mails nothing. A refusal of the mail that concerns the address itself (its server refused it, or it is suppressed) is answered exactly as a sent link is. Reachable by the account's own key or a system key.

```ts
openemail.verifiedRecipients.add(
  accountId: string,
  body: VerifiedRecipientsAddBody,
  options?: CallOptions,
): ApiPromise<VerifiedRecipientAdded>
```

It calls `POST /accounts/{accountId}/verified-recipients`: [Add a verified recipient](/docs/api/accounts/post_VerifiedRecipientAdd) in the API reference.

## Example

```ts
const verifiedRecipientAdded = await openemail.verifiedRecipients.add(accountId, { address: 'ada@example.com' })
```

## Arguments

| Argument | Type | Description |
| --- | --- | --- |
| `accountId` | `string` | Account ULID identifier. The path's `{accountId}`. |
| `body` | [`VerifiedRecipientsAddBody`](#verifiedrecipientsaddbody) | The request's body. |

## Options

It takes no options of its own. Every call also takes `signal`, `timeout`, `retry` and `headers`, which say how that one call is sent ([call options](/docs/sdks/typescript/calling-methods#call-options)).

## Answer

Awaited, it is the API's JSON, [`VerifiedRecipientAdded`](/docs/sdks/typescript/types/verified-recipient-added). It is an [`ApiPromise`](/docs/sdks/typescript/responses): `.withResponse()` gives the same with the `Response` it came in, for its headers.

## Errors

| Status | What it means |
| --- | --- |
| `400` | validation_failed, when the address is not one; or always_verified, carrying `domain`, when the address is on one of this account's own domains, which are always verified recipients and are never stored |
| `401` | unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a `WWW-Authenticate: Bearer` challenge |
| `404` | not_found: the account does not exist or is not accessible to this principal |
| `409` | recipient_limit_reached, carrying `limit`: the account holds 100 addresses, pending and verified together, so remove one first; or pending_limit_reached, carrying `limit`: 10 addresses are awaiting their owners' answer, so wait for one, or remove one. A pending address whose newest link has expired no longer counts |
| `413` | too_large: JSON request body exceeds 1 MiB or 500,000 values (object keys included), checked before parsing |
| `429` | resend_cooldown, with Retry-After and `retryAfterSeconds`: a link was mailed to this address less than a minute ago; or confirmation_limit_reached, with Retry-After, `retryAfterSeconds` and `limit`: the account has mailed its 20 confirmation links for this UTC day; or rate_limited, with Retry-After: too many links from this account, or to this address, in the last minute. The last is deliberately one answer for both, since the budget per address is shared across the deployment |
| `503` | recipient_verification_unavailable, with Retry-After: domain ownership is being removed and has not settled, so retry; or recipient_mail_unavailable: the link could not be mailed for a reason on the platform's side (the mail binding or the link key is unconfigured, the platform's hourly cap on its own mail is spent, or the sending service refused the message), so nothing is stored and the request may be retried. Or temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description) |

A failed call rejects with a [`RequestError`](/docs/sdks/typescript/errors): its `status`, and its `code`, the API's `error`. Decide on the code: one status covers several.

## Types

### VerifiedRecipientsAddBody

```ts
/** The body of `verifiedRecipients.add`. */
type VerifiedRecipientsAddBody = {
  /** The outside address to verify */
  address: string
}
```

It names these types of the API, each on a page of its own: [`VerifiedRecipientAdded`](/docs/sdks/typescript/types/verified-recipient-added).
