# Retry delivery to one recipient

```http
PUT https://secure.yoprint.com/v2/api/store/{team_slug}/messages/{hash_id}/recipients/{id}/retry
```

- API version: v2
- Operation ID: `v2_public_messages_recipients_retry`
- Section: Messages and activity › [Messages](https://developer.yoprint.com/reference/messages.md)
- Web page: https://developer.yoprint.com/reference/messages/v2-messages-recipients-retry/
- Authentication: `Authorization: Bearer YOUR_API_KEY`

Sends the message again to one recipient whose delivery failed. The resend is queued: the response is empty, and the recipient's status updates as delivery happens.

## Permission

Any member can read purchase order messages. For sales order and quote messages you need permission to message all orders, or only the orders you created or are assigned to. The team owner sees everything.

## Business rules

- The recipient's delivery must have failed (`dispatch_failed` or `delivery_failed`). While a retry is in progress its status is `pending`, and a second retry is refused.
- Emails can be retried only while YoPrint still keeps the original send, normally 7 days. A text needs the phone number it was sent to.
- It works on a recipient of a message that otherwise can't be retried as a whole.

## Side effects

- Sends the email, or the text through your team's Twilio account, to the same address or number as before.
- When an email sent through YoPrint's tracked email delivery fails again, the creator of the order or purchase order gets another delivery failure email.

## Path parameters

- `team_slug` (string, required): Your team slug, shown as Team ID next to your API key in Profile. Example `your-team`.
- `hash_id` (string, required): The message's `id`, from the message list. A hash id; unique keys and document numbers are refused with 404. Example `u7HKhdhT6tkEUy`.
- `id` (string, required): The recipient's `id`, from the recipient list, not the participant id. A hash id; unique keys and document numbers are refused with 404. Example `XWwTVKIZSuUOcX`.

## Request body

Content type `application/json`, optional.

Fields:

- `external_integration_id` (string, optional): Optional. A texting integration id of your team. It does not change which account sends today: texts go through the message's own or your team's active Twilio integration.

### Example request

```bash
curl -X PUT 'https://secure.yoprint.com/v2/api/store/your-team/messages/u7HKhdhT6tkEUy/recipients/XWwTVKIZSuUOcX/retry' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Accept: application/json' \
  -H 'X-Yoprint-Decimal-Format: exact-v1' \
  -H 'Content-Type: application/json' \
  -d '{}'
```

## Response

`200` Successful response.

Fields:

- `data` (null, required)
- `status` (integer, required)
- `success` (boolean, required)

Example response:

```json
{
  "data": null,
  "status": 200,
  "success": true
}
```

## Errors

- `401` The API key is missing or wrong (`unauthenticated`).
- `403` You are not allowed to do this. `api_access_not_in_plan`: your team's plan doesn't include API access (Pro and above, with an active subscription or trial), so every request answers this until the team upgrades. When your role lacks the permission the operation needs, the body is only `{"message": "Insufficient Permission"}`. Other refusals use the error envelope, with `unauthorized` or `user_is_not_authorized`.
  - When: The message is on a sales order or quote you can't message (`user_is_not_authorized`). Fix: Ask a team admin for permission to message that order.
- `404` Not found. `page_not_found`: the team slug is unknown, you are not a member of the team, or an id in the path is not one of this team's. `code: null`, with a message that starts "No query results for": there is no record with that id.
  - When: The message or the recipient does not exist on this team, or `external_integration_id` matches no integration of your team. Fix: Use a recipient `id` from the recipient list.
- `422` The request was refused and changed nothing. `validation_failed` lists what to fix in `error.fields`; other codes name a business rule, explained in `error.message`. A few checks answer with only `{"message": "..."}`. An operation that calls another service (a payment provider, a carrier, an accounting app) can answer `connect_timeout` ("Please retry again") when that service does not answer in time: the change may or may not have happened there, so read the record back before you retry.
  - When: `external_integration_id` is not a valid id (`validation_failed`; `error.fields` names the field). Checked first. Fix: Leave it out.
  - When: This recipient can't be retried: it did not fail, a retry is in progress, the email is past the 7 days, or YoPrint no longer keeps the original (`message_not_retryable`, "Message is not retryable"). Fix: Send a new message instead.
- `500` A business rule refused the request (see the operation's errors), or something failed inside YoPrint. Refusals use the error envelope with a code such as `action_not_allowed`; an unexpected failure answers `{"message": "Server Error"}`. Repeating a refusal gets the same answer; after an unexpected failure, read the record back before you retry a change.
  - When: It is a text message and your team has no active Twilio integration: a server error, not a 422. Nothing is queued. Fix: Connect Twilio again in the web app, then retry.

## Notes

- A `200` means the resend was queued, not that it was delivered. Read the recipient again to see the outcome.
- If YoPrint can no longer read its stored copy of the message, the call still answers `200`, but nothing is sent and the recipients stay failed. Instead, `latest_error_reason` changes on every failed recipient (on the one-recipient retry, on that recipient only): to `postmark_retry_mailable_unavailable` for an email sent through YoPrint's tracked email delivery (a message of version 3 or with a dispatch id, or, on the one-recipient retry, a recipient with a tracked send attempt), otherwise to `mailable_serialization_failed`, for example for older emails and for texts. Read the recipients after a retry.

## Related

- [Retry a message's failed deliveries](https://developer.yoprint.com/reference/messages/v2-messages-retry.md): `PUT /v2/api/store/{team_slug}/messages/{hash_id}/retry`
- [Get one recipient of a message](https://developer.yoprint.com/reference/messages/v2-messages-recipients-show.md): `GET /v2/api/store/{team_slug}/messages/{hash_id}/recipients/{id}`
