# List campaigns

> GET /campaigns — list your campaigns, newest first.

`GET /campaigns`

Returns your campaigns ordered by creation time (newest first), wrapped in a list object. The `limit` parameter is optional — if you omit it, all campaigns are returned in a single response.

**Query parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | number | No | Number of campaigns to retrieve. Minimum `1`, maximum `100`. |
| `after` | string | No | The ID after which to retrieve more campaigns (pagination). The ID itself is excluded. Cannot be combined with `before`. |
| `before` | string | No | The ID before which to retrieve more campaigns (pagination). The ID itself is excluded. Cannot be combined with `after`. |

**Node.js**

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

const mb = new MailBlastr('mb_xxxxxxxxx');

const { data, error } = await mb.campaigns.list();
console.log({ data, error });
```

**Ruby**

```ruby
require "mailblastr"

Mailblastr.api_key = "mb_xxxxxxxxx"

Mailblastr::Campaigns.list
```

**PHP**

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

$mailblastr->campaigns->list();
```

**Python**

```python
import mailblastr

mailblastr.api_key = "mb_xxxxxxxxx"

mailblastr.Campaigns.list()
```

**Go**

```go
package main

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

func main() {
    req, _ := http.NewRequest("GET", "https://api.mailblastr.com/campaigns", nil)
    req.Header.Set("Authorization", "Bearer mb_xxxxxxxxx")
    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()
        .get("https://api.mailblastr.com/campaigns")
        .header("Authorization", "Bearer mb_xxxxxxxxx")
        .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"))
    .header("Authorization", "Bearer mb_xxxxxxxxx")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .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.Get, "https://api.mailblastr.com/campaigns");
request.Headers.Add("Authorization", "Bearer mb_xxxxxxxxx");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

**cURL**

```bash
curl -X GET 'https://api.mailblastr.com/campaigns' \
  -H 'Authorization: Bearer mb_xxxxxxxxx'
```

**CLI**

```bash
mailblastr campaigns list
```

### Response

Returns a list object. `has_more` indicates whether further pages exist beyond the returned set.

```json
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90",
      "name": "June newsletter",
      "audience_id": "aud_3b1c...",
      "segment_id": null,
      "status": "sent",
      "ab_test": { "enabled": false },
      "scheduled_at": null,
      "sent_at": "2026-06-23T10:20:00.000Z",
      "created_at": "2026-06-23T10:00:00.000Z"
    }
  ]
}
```
