# Correct the recipient's e-mail or phone

`PATCH https://api.parasend.com/v1/deliveries/{id}/contact`

Source: https://parasend.com/docs/api/deliveries/correct-contact

Authentication: `Authorization: Bearer <API key>` (a `ps_test_` key in test mode, `ps_live_` in live mode).

Corrects a mistyped e-mail address or phone number on a delivery you have sent, until the recipient confirms receipt (409 `contact_change_state_invalid` after that, or once the delivery has ended: a bounced delivery is sent again as a new one). Only a detail the delivery has can be corrected (422 `contact_not_on_delivery`); a channel is never added. Where the invitation already went out on the corrected channel, it is sent again, with the same link, to the new address (`invitation_resent`); one that has not gone yet simply goes to the new address. An SMS is billed like any SMS and passes the same checks as an SMS reminder (`unverified_sender_email_only`, `sms_destination_not_available`, `free_sms_destination_not_covered`). An address on the block list is refused (422 `contact_change_suppressed`), since the invitation would not reach it. Each change writes `delivery.contact_changed` to the delivery's events, naming what changed but never the addresses, and each invitation sent again writes `delivery.invitation_resent` once it has gone; the evidence record seals it as a notice of its own, to the corrected address. At most 3 changes per delivery a day (429 `contact_change_rate_limited`). Sending the same details again changes nothing and sends nothing, so a retry is safe. In test mode nothing is sent, as always.

## Path parameters

- `id` (string, required): The delivery's ID, starting `dlv_`.

## Body (application/json)

- `email` (string · email, optional): The corrected e-mail address. The delivery must already have one.
- `phone` (string, optional): The corrected mobile number in E.164 format, e.g. `+3546661234`. The delivery must already have one.

## Example: Correct a mistyped e-mail address

```bash
curl -X PATCH "https://api.parasend.com/v1/deliveries/dlv_01M6R27T05512SCV3852TPM2XY/contact" \
  -H "Authorization: Bearer $PARASEND_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "anna.jonsdottir@example.com"
  }'
```

```js
const res = await fetch('https://api.parasend.com/v1/deliveries/dlv_01M6R27T05512SCV3852TPM2XY/contact', {
  method: 'PATCH',
  headers: {
    Authorization: `Bearer ${process.env.PARASEND_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    email: 'anna.jonsdottir@example.com',
  }),
});
const data = await res.json();
```

## Response 200

The details are corrected, and the invitation sent again where it already went out.

```json
{
  "object": "contact_change",
  "delivery_id": "dlv_01M757JZZ8XGR4NAEZQZFS991N",
  "changed": [
    "email"
  ],
  "invitation_resent": [
    "email"
  ],
  "changes_remaining_today": 2
}
```

Errors: one shape, `{"error": {type, code, message, param, request_id}}`; every code is listed at https://parasend.com/docs/errors.
