# Reschedule an email

> Move a scheduled email to a new send time, up to 30 days after it was created.

`PATCH https://api-connect.nxiom.com/api/v1/emails/messages/{messageId}`

## Authorization

Requires `email.send`. A key restricted to one sending domain can reschedule only emails sent from that domain.

## Path parameters

| Field | Type | Description |
| --- | --- | --- |
| `messageId` | string · required | The `messageId` returned when you scheduled the send. |

## Body parameters

| Field | Type | Description |
| --- | --- | --- |
| `scheduledAt` | string · required | The new send time, as an ISO 8601 timestamp with a timezone offset. Must be in the future and at most 30 days after the email was first scheduled. |

## Request

### cURL

```shell
curl -X PATCH "https://api-connect.nxiom.com/api/v1/emails/messages/YOUR_MESSAGE_ID" \
  -H "Authorization: Bearer $NEXIOM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "scheduledAt": "2026-10-06T09:00:00+01:00"
}'
```

### Node.js

```typescript
import { NexiomConnect } from '@nexiom/connect';

const apiKey = process.env.NEXIOM_API_KEY;
if (!apiKey) throw new Error('Set NEXIOM_API_KEY');

const nexiom = new NexiomConnect({ apiKey });

const { data, error } = await nexiom.emails.reschedule('YOUR_MESSAGE_ID', {
  scheduledAt: '2026-10-06T09:00:00+01:00',
});

if (error) throw new Error(`${error.code}: ${error.message}`);
console.log(data.status, data.scheduledAt);
```

### PHP

```php
<?php

use Nexiom\Connect\NexiomConnect;

$apiKey = getenv('NEXIOM_API_KEY');
if (!$apiKey) {
    throw new RuntimeException('Set NEXIOM_API_KEY');
}

$nexiom = new NexiomConnect($apiKey);

$result = $nexiom->emails->reschedule('YOUR_MESSAGE_ID', [
    'scheduledAt' => new DateTimeImmutable('+2 days'),
]);

echo $result['status'], ' ', $result['scheduledAt'];
```

## Response

HTTP `200`. Every scheduled delivery of the message moves to the new time, and [email.scheduled](/docs/webhooks/emails/scheduled) fires again with the new `scheduled_at`. Only the time changes; to change the content, [cancel the email](/docs/api/emails/cancel) and send a new one.

### 200 OK

Scheduled email rescheduled.

```json
{
  "message": "Scheduled email rescheduled",
  "data": {
    "messageId": "message_example",
    "status": "scheduled",
    "scheduledAt": "2026-10-06T08:00:00.000Z",
    "deliveryIds": [
      "delivery_example"
    ]
  }
}
```

### 400 Bad Request

The request is invalid. Correct it before retrying; `details` lists the failing fields.

```json
{
  "error": "invalid_argument",
  "message": "Request doesn't match the schema",
  "correlationId": "req_example",
  "details": {
    "context": "body",
    "issues": []
  }
}
```

### 401 Unauthorized

The API key is missing, malformed, revoked, or expired.

```json
{
  "error": "unauthorized",
  "message": "Invalid API key",
  "correlationId": "req_example"
}
```

### 403 Forbidden

The API key lacks a required permission, or its domain restriction does not allow this sender.

```json
{
  "error": "not_allowed",
  "message": "Missing required API key permissions: email.full_access",
  "correlationId": "req_example"
}
```

### 404 Not Found

No resource with this ID exists in the API key’s project.

```json
{
  "error": "not_found",
  "code": "resource_not_found",
  "message": "Resource not found",
  "correlationId": "req_example"
}
```

### 409 Conflict

The email is canceled, was sent immediately, or its send time has already arrived.

```json
{
  "error": "conflict",
  "message": "Only a scheduled email can be rescheduled",
  "correlationId": "req_example"
}
```

---

Source: https://connect.nxiom.com/docs/api/emails/reschedule
