# Update an email

> PATCH /emails/:id — reschedule a scheduled email.

`PATCH /emails/:id`

Reschedule a still-`scheduled` email by setting a new `scheduled_at`. Only emails in the `scheduled` state can be updated — once an email has been sent, its delivery time is fixed. See [Schedule email](https://www.senddart.com/docs/emails/schedule).

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The id of the scheduled email to reschedule. |

## Body parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `scheduled_at` | string | Yes | New ISO 8601 datetime to send the email. |

## Request

**Node.js**

```js
import { SendDart } from 'senddart';

const mb = new SendDart('mb_xxxxxxxxx');

const { data, error } = await mb.emails.update('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', { "scheduled_at": "2026-06-25T09:00:00Z" });
console.log({ data, error });
```

**Ruby**

```ruby
require "senddart"

SendDart.api_key = "mb_xxxxxxxxx"

SendDart::Emails.update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", {
  "scheduled_at": "2026-06-25T09:00:00Z"
})
```

**PHP**

```php
<?php
require 'vendor/autoload.php';

use SendDart\SendDart;

$senddart = SendDart::client('mb_xxxxxxxxx');

$senddart->emails->update('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', [
  'scheduled_at' => "2026-06-25T09:00:00Z"
]);
```

**Python**

```python
import senddart

senddart.api_key = "mb_xxxxxxxxx"

senddart.Emails.update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", {
  "scheduled_at": "2026-06-25T09:00:00Z"
})
```

**Go**

```go
import "github.com/shekhu10/senddart-sdks/senddart-go"

client := senddart.NewClient("mb_xxxxxxxxx")

updated, err := client.Emails.Update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", &senddart.UpdateEmailRequest{
    ScheduledAt: "2026-06-25T09:00:00Z",
})
```

**Rust**

```rust
use senddart::SendDart;

let mb = SendDart::new("mb_xxxxxxxxx");

let _updated = mb.emails.update("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", "2026-06-25T09:00:00Z").await?;
```

**Java**

```java
import com.senddart.SendDart;
import com.senddart.SendDartResponse;

SendDart senddart = new SendDart("mb_xxxxxxxxx");

SendDartResponse response = senddart.emails().update(
        "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794",
        "2026-06-25T09:00:00Z");
```

**.NET**

```csharp
using SendDart;

ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx");

var resp = await senddart.EmailUpdateAsync(
    "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794",
    "2026-06-25T09:00:00Z");
```

**cURL**

```bash
curl -X PATCH 'https://www.senddart.com/api/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794' \
  -H 'Authorization: Bearer mb_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{ "scheduled_at": "2026-06-25T09:00:00Z" }'
```

**CLI**

```bash
senddart emails update 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 \
  --scheduled-at '2026-06-25T09:00:00Z'
```

## Response

```json
{
  "object": "email",
  "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"
}
```

## Errors

Returns `not_found` (404) if the email does not exist for your account; `validation_error` if the email is not in the `scheduled` state, or if `scheduled_at` is missing or not a valid ISO timestamp. See the [error reference](https://www.senddart.com/docs/api/errors).
