# forwarding.confirmDestination

Confirm a forwarding destination.

Spends the code mailed to the destination. Five wrong codes end the ceremony. Confirming invalidates every disable link previously mailed for it.

```ts
openemail.forwarding.confirmDestination(
  mailboxId: string,
  destId: string,
  body: ForwardingConfirmDestinationBody,
  options?: CallOptions,
): ApiPromise<ForwardingDestinationVerified>
```

It calls `POST /mailboxes/{mailboxId}/forwarding/destinations/{destId}/verify`: [Confirm a forwarding destination](/docs/api/filtering/post_ForwardingDestinationVerify) in the API reference.

## Example

```ts
const forwardingDestinationVerified = await openemail.forwarding.confirmDestination(mailboxId, destId, { code: '…' })
```

## Arguments

| Argument | Type | Description |
| --- | --- | --- |
| `mailboxId` | `string` | Mailbox ULID identifier. The path's `{mailboxId}`. |
| `destId` | `string` | Forwarding destination ULID. The path's `{destId}`. |
| `body` | [`ForwardingConfirmDestinationBody`](#forwardingconfirmdestinationbody) | 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, [`ForwardingDestinationVerified`](/docs/sdks/typescript/types/forwarding-destination-verified). 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; or no_pending_code, meaning nothing is awaiting confirmation or the code expired |
| `401` | unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a `WWW-Authenticate: Bearer` challenge |
| `403` | invalid_code, with attemptsLeft; or confirmation_cleared, meaning that was the fifth wrong code. Add the address again for a fresh one |
| `404` | Mailbox or destination not found, or not accessible to this principal |
| `413` | too_large: JSON request body exceeds 1 MiB or 500,000 values (object keys included), checked before parsing |
| `503` | 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

### ForwardingConfirmDestinationBody

```ts
/** The body of `forwarding.confirmDestination`. */
type ForwardingConfirmDestinationBody = {
  /** The eight-character code mailed to the destination */
  code: string
}
```

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