# 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.sendping.co/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 { SendPing } from 'sendping';

const mb = new SendPing('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 "sendping"

SendPing.api_key = "mb_xxxxxxxxx"

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

**PHP**

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

use SendPing\SendPing;

$sendping = SendPing::client('mb_xxxxxxxxx');

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

**Python**

```python
import sendping

sendping.api_key = "mb_xxxxxxxxx"

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

**Go**

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

client := sendping.NewClient("mb_xxxxxxxxx")

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

**Rust**

```rust
use sendping::SendPing;

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

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

**Java**

```java
import co.sendping.SendPing;
import co.sendping.SendPingResponse;

SendPing sendping = new SendPing("mb_xxxxxxxxx");

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

**.NET**

```csharp
using SendPing;

ISendPing sendping = SendPingClient.Create("mb_xxxxxxxxx");

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

**cURL**

```bash
curl -X PATCH 'https://www.sendping.co/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
sendping 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.sendping.co/docs/api/errors).
