# Retry a message's failed deliveries

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

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

Sends an outbound message again to the recipients it **failed** to reach. Recipients who already got it are not sent it again. The resend is queued: the response is empty, and each recipient's status updates as delivery happens.

Check `delivery_summary.retryable` (or `retryable`) first. To retry one recipient only, use the recipient retry operation.

## 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

- Only outbound messages whose delivery failed or partly failed can be retried.
- Emails can be retried only while YoPrint still keeps the original send, normally 7 days.
- On texts, and on emails sent by YoPrint's current email sending, every failed recipient must still be retryable: if one is not (for example its email is past the 7 days), the whole call answers 422. Retry the others one at a time with the recipient retry operation.
- Each recipient is sent to the same address or number as the first time, even if the contact changed since.

## Side effects

- **Spends money.** Sends the email again (through YoPrint's email provider) or the text again, through your team's Twilio account, which Twilio charges you for.
- 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.
- People with the message open see the delivery status update live.

## 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`.

## 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/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: No message of this team has this id, or `external_integration_id` matches no integration of your team. Fix: Use ids from the API.
- `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: The message can't be retried: it is inbound, nothing failed, a failed email is past the 7 days, YoPrint no longer keeps the original, or a failed recipient can't be retried (`message_not_retryable`, "Message is not retryable"). Same answer as `delivery_summary.retryable` `false`. Fix: Retry single recipients, or send a new message.
- `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 message or its recipients 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 delivery to one recipient](https://developer.yoprint.com/reference/messages/v2-messages-recipients-retry.md): `PUT /v2/api/store/{team_slug}/messages/{hash_id}/recipients/{id}/retry`
- [Get a message](https://developer.yoprint.com/reference/messages/v2-messages-show.md): `GET /v2/api/store/{team_slug}/messages/{hash_id}`
