Skip to main content
import { createClient } from "@mailsai/sdk";

const client = createClient(); // reads MAILS_API_KEY

const result = await client.messages.reschedule(
  "msg_01JZX8K3M9Q4P7VN2YB6RTDC0E",
  "2026-06-25T14:00:00.000Z",
);
console.log(result);
{
  "id": "msg_01JZX8K3M9Q4P7VN2YB6RTDC0E",
  "scheduled_at": "2026-10-04T12:00:00.000Z",
  "status": "scheduled"
}

Reschedule a scheduled message

Moves a scheduled send to a new future scheduled_at, and raises message.scheduled again with the new scheduled_at and the previous_scheduled_at it replaced.
PATCH/v1/messages/{id}scope · manage
import { createClient } from "@mailsai/sdk";

const client = createClient(); // reads MAILS_API_KEY

const result = await client.messages.reschedule(
  "msg_01JZX8K3M9Q4P7VN2YB6RTDC0E",
  "2026-06-25T14:00:00.000Z",
);
console.log(result);
{
  "id": "msg_01JZX8K3M9Q4P7VN2YB6RTDC0E",
  "scheduled_at": "2026-10-04T12:00:00.000Z",
  "status": "scheduled"
}

Path Parameters

idstringrequired

Sent message id with status scheduled, or rejected because its agent was paused or archived.

Body Parameters

scheduled_atstring

The new send time: an ISO 8601 UTC time ending in Z, which must be in the future (400 invalid_field otherwise). Left out, the schedule stays as it is.

It needs the send scope as well as manage, and a live key for a live message (403 live_mode_required); the key that scheduled the send keeps answering for it. A send that failed only because its agent was paused or archived when it came due (status: rejected, metadata.rejected_reason starting agent_paused: or agent_archived:) is scheduled again by the same call once a paused agent is resumed: that needs a scheduled_at, and answers 422 agent_paused while the agent is still paused. Archiving cannot be undone, so one whose agent was archived answers 404 agent_archived. A message that changed while it was being rescheduled (it started sending, or was canceled or scheduled again) answers 409 duplicate_resource.

Response

idstring

Id of the rescheduled message (msg_…): the id in the path.

scheduled_atstring

When the message will go out, as GET /v1/messages/{id} returns it: the new time in UTC with milliseconds, however the request wrote it, or the current one when the request left scheduled_at out.

statusstring

Always scheduled: only a scheduled message can be rescheduled.

One of: scheduled

Was this page helpful?