# Send campaign

> POST /campaigns/:id/send — send a draft now or schedule it.

`POST /campaigns/:id/send`

Sends a draft campaign. With no body it begins sending immediately (status → `sending`). Pass a future `scheduled_at` to schedule it (status → `scheduled`). The campaign must be a draft with a `from`, a `subject`, a body, and a verified from-domain.

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The campaign ID. |

**Body parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `scheduled_at` | string | No | Optional. Schedule the send for later. Accepts an ISO 8601 timestamp (e.g. `2026-07-01T09:00:00Z`) or natural language (e.g. `in 1 min`, `in 1 hour`). If in the future, the campaign is scheduled rather than sent now. |

**Node.js**

```js
import { MailBlastr } from 'mailblastr';

const mb = new MailBlastr('mb_xxxxxxxxx');

const { data, error } = await mb.campaigns.send('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90', { "scheduled_at": "2026-07-01T09:00:00Z" });
console.log({ data, error });
```

**Ruby**

```ruby
require "mailblastr"

Mailblastr.api_key = "mb_xxxxxxxxx"

Mailblastr::Campaigns.send("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", {
  "scheduled_at": "2026-07-01T09:00:00Z"
})
```

**PHP**

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

$mailblastr->campaigns->send('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90', [
  'scheduled_at' => "2026-07-01T09:00:00Z"
]);
```

**Python**

```python
import mailblastr

mailblastr.api_key = "mb_xxxxxxxxx"

mailblastr.Campaigns.send("8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90", {
  "scheduled_at": "2026-07-01T09:00:00Z"
})
```

**Go**

```go
package main

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

func main() {
    req, _ := http.NewRequest("POST", "https://api.mailblastr.com/campaigns/8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90/send", strings.NewReader(`{ "scheduled_at": "2026-07-01T09: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()
        .post("https://api.mailblastr.com/campaigns/8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90/send")
        .header("Authorization", "Bearer mb_xxxxxxxxx")
        .header("Content-Type", "application/json")
        .body(r#"{ "scheduled_at": "2026-07-01T09: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/campaigns/8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90/send"))
    .header("Authorization", "Bearer mb_xxxxxxxxx")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("""
{ "scheduled_at": "2026-07-01T09: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.Post, "https://api.mailblastr.com/campaigns/8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90/send");
request.Headers.Add("Authorization", "Bearer mb_xxxxxxxxx");
request.Content = new StringContent(@"{ ""scheduled_at"": ""2026-07-01T09:00:00Z"" }", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

**cURL**

```bash
curl -X POST 'https://api.mailblastr.com/campaigns/8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90/send' \
  -H 'Authorization: Bearer mb_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{ "scheduled_at": "2026-07-01T09:00:00Z" }'
```

**CLI**

```bash
mailblastr campaigns send 8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90 \
  --scheduled-at '2026-07-01T09:00:00Z'
```

### Response

```json
{
  "id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90"
}
```

> **Note:** Errors: `not_found` if the campaign is not yours; `validation_error` if it is already sending/scheduled/sent, is missing a `from`/`subject`/body, has an unverified from-domain, or `scheduled_at` is not a valid timestamp.
