Skip to main content

Message Replay

Replay failed notifications — individually or in bulk — to recover from delivery failures. Preview messages before replaying, modify content on-the-fly, and retry across email, push, and SMS channels.

Overview​

FeatureDescription
Individual ReplayRetry a single failed message
Preview Before ReplayInspect the message before resending
Content ModificationChange subject, body, or recipients on replay
Bulk ReplayRetry multiple failed messages at once
Failed Message QueriesFind messages eligible for replay

Quick Start​

Replay a Failed Email​

# 1. Preview the message
curl https://api.zyphr.dev/v1/replay/email/MSG_ID/preview \
-H "X-API-Key: zy_live_your_api_key"

# 2. Replay it
curl -X POST https://api.zyphr.dev/v1/replay/email/MSG_ID \
-H "X-API-Key: zy_live_your_api_key"
// Preview first
const preview = await zyphr.replay.preview('email', messageId);

// Then replay
await zyphr.replay.email(messageId);

Individual Replay​

Replay an Email​

Replay with the original content, or provide modifications:

curl -X POST https://api.zyphr.dev/v1/replay/email/MSG_ID \
-H "X-API-Key: zy_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"to": "corrected-email@example.com",
"subject": "Updated: Welcome to Zyphr"
}'
// Replay with original content
await zyphr.replay.email(messageId);

// Replay with modifications
await zyphr.replay.email(messageId, {
to: 'corrected-email@example.com',
subject: 'Updated: Welcome to Zyphr',
});

Replay a Push Notification​

curl -X POST https://api.zyphr.dev/v1/replay/push/MSG_ID \
-H "X-API-Key: zy_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated notification title"
}'

Replay an SMS​

curl -X POST https://api.zyphr.dev/v1/replay/sms/MSG_ID \
-H "X-API-Key: zy_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"body": "Updated message content"
}'

Replay Parameters​

All replay endpoints accept optional modification fields. Only provide fields you want to change — omitted fields retain the original values.

Email Modifications​

ParameterTypeDescription
tostringOverride recipient email
subjectstringOverride subject line
htmlstringOverride HTML body
textstringOverride plain text body

Push Modifications​

ParameterTypeDescription
titlestringOverride notification title
bodystringOverride notification body
dataobjectOverride custom data payload

SMS Modifications​

ParameterTypeDescription
tostringOverride recipient phone number
bodystringOverride message body

Preview Before Replay​

Inspect the message content before replaying:

curl https://api.zyphr.dev/v1/replay/email/MSG_ID/preview \
-H "X-API-Key: zy_live_your_api_key"
curl https://api.zyphr.dev/v1/replay/push/MSG_ID/preview \
-H "X-API-Key: zy_live_your_api_key"
curl https://api.zyphr.dev/v1/replay/sms/MSG_ID/preview \
-H "X-API-Key: zy_live_your_api_key"

The preview returns the full message content, recipient details, and the original failure reason.

Finding Failed Messages​

List Failed Messages​

Query for messages eligible for replay:

curl "https://api.zyphr.dev/v1/replay/failed?channel=email&start_date=2026-02-01&end_date=2026-02-28&limit=50" \
-H "X-API-Key: zy_live_your_api_key"

Query Parameters​

ParameterTypeRequiredDescription
channelstringYesChannel: email, push, sms
statusstringNoFilter by failure status
start_datestringNoStart of date range (ISO 8601)
end_datestringNoEnd of date range (ISO 8601)
limitnumberNoResults per page (default: 25)
skip_permanent_failuresbooleanNoExclude permanently failed messages

Count Failed Messages​

Get a count of failed messages by channel:

curl "https://api.zyphr.dev/v1/replay/failed/count?channel=email&start_date=2026-02-01&end_date=2026-02-28" \
-H "X-API-Key: zy_live_your_api_key"

Bulk Replay​

Retry multiple failed messages at once:

curl -X POST https://api.zyphr.dev/v1/replay/bulk \
-H "X-API-Key: zy_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"channel": "email",
"message_ids": ["msg_001", "msg_002", "msg_003"]
}'
await zyphr.replay.bulk({
channel: 'email',
messageIds: ['msg_001', 'msg_002', 'msg_003'],
});
warning

Bulk replay processes messages asynchronously. Large batches may take time to complete. Monitor delivery status through the message history endpoints or webhooks.

Bulk Replay by Date Range​

You can also replay all failed messages within a date range:

curl -X POST https://api.zyphr.dev/v1/replay/bulk \
-H "X-API-Key: zy_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"channel": "email",
"start_date": "2026-02-01T00:00:00Z",
"end_date": "2026-02-01T23:59:59Z",
"skip_permanent_failures": true
}'

Best Practices​

  • Preview before replaying - Always check the message content before resending
  • Skip permanent failures - Use skip_permanent_failures to exclude hard bounces, invalid numbers, etc.
  • Monitor after bulk replay - Watch delivery status via webhooks or the messages endpoint
  • Use date ranges - When dealing with outages, replay all failures within the affected window
  • Idempotency - Replayed messages are new deliveries with new message IDs

API Reference​

MethodEndpointDescription
POST/v1/replay/email/:idReplay an email
POST/v1/replay/push/:idReplay a push notification
POST/v1/replay/sms/:idReplay an SMS
GET/v1/replay/:channel/:id/previewPreview message for replay
GET/v1/replay/failedList failed messages
GET/v1/replay/failed/countCount failed messages
POST/v1/replay/bulkBulk replay failed messages

Next Steps​