# 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.mailblastr.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 { MailBlastr } from 'mailblastr';

const mb = new MailBlastr('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 "mailblastr"

Mailblastr.api_key = "mb_xxxxxxxxx"

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

**PHP**

```php
$mailblastr = Mailblastr::client('mb_xxxxxxxxx');

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

**Python**

```python
import mailblastr

mailblastr.api_key = "mb_xxxxxxxxx"

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

**Go**

```go
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    req, _ := http.NewRequest("PATCH", "https://api.mailblastr.com/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", strings.NewReader(`{ "scheduled_at": "2026-06-25T09:00:00Z" }`))
    req.Header.Set("Authorization", "Bearer mb_xxxxxxxxx")
    req.Header.Set("Content-Type", "application/json")
    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    out, _ := io.ReadAll(res.Body)
    fmt.Println(string(out))
}
```

**Rust**

```rust
use reqwest::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let res = Client::new()
        .patch("https://api.mailblastr.com/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794")
        .header("Authorization", "Bearer mb_xxxxxxxxx")
        .header("Content-Type", "application/json")
        .body(r#"{ "scheduled_at": "2026-06-25T09:00:00Z" }"#)
        .send()
        .await?;
    println!("{}", res.text().await?);
    Ok(())
}
```

**Java**

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mailblastr.com/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"))
    .header("Authorization", "Bearer mb_xxxxxxxxx")
    .header("Content-Type", "application/json")
    .method("PATCH", HttpRequest.BodyPublishers.ofString("""
{ "scheduled_at": "2026-06-25T09:00:00Z" }
"""))
    .build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

**.NET**

```csharp
using System.Net.Http;
using System.Text;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Patch, "https://api.mailblastr.com/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794");
request.Headers.Add("Authorization", "Bearer mb_xxxxxxxxx");
request.Content = new StringContent(@"{ ""scheduled_at"": ""2026-06-25T09:00:00Z"" }", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

**cURL**

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