> ## Documentation Index
> Fetch the complete documentation index at: https://usegately.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# List Campaigns

> Retrieve all email campaigns for a project, newest first

## Headers

<ParamField header="Authorization" type="string" required>
  `Bearer YOUR_API_KEY`
</ParamField>

<ParamField header="X-Project-ID" type="string">
  Your project UUID. Not required if the API key already encodes the project.
</ParamField>

## Response

Returns an array of campaign objects ordered by `created_at` descending.

<ResponseField name="id" type="string">
  Unique campaign identifier (UUID)
</ResponseField>

<ResponseField name="project_id" type="string">
  Project this campaign belongs to
</ResponseField>

<ResponseField name="name" type="string">
  Display name of the campaign
</ResponseField>

<ResponseField name="subject" type="string">
  Email subject line
</ResponseField>

<ResponseField name="content" type="string">
  Original HTML body content
</ResponseField>

<ResponseField name="html_content" type="string">
  Processed HTML with tracking injected
</ResponseField>

<ResponseField name="status" type="string">
  One of: `sending` · `scheduled` · `sent` · `partially_sent` · `failed`
</ResponseField>

<ResponseField name="total_recipients" type="number">
  Number of addresses targeted
</ResponseField>

<ResponseField name="delivered_count" type="number">
  Emails successfully sent
</ResponseField>

<ResponseField name="recipient_filter" type="object">
  Snapshot of the recipient sources used when the campaign was sent
</ResponseField>

<ResponseField name="scheduled_at" type="string">
  ISO 8601 scheduled send time, or `null`
</ResponseField>

<ResponseField name="sent_at" type="string">
  ISO 8601 actual send time, or `null`
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 creation timestamp
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.usegately.com/api/v1/campaigns" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "X-Project-ID: YOUR_PROJECT_ID"
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('https://api.usegately.com/api/v1/campaigns', {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'X-Project-ID': 'YOUR_PROJECT_ID',
    }
  })
  const campaigns = await res.json()
  ```

  ```typescript SDK theme={null}
  import { GatelyCampaigns } from '@gately/sdk'

  const campaigns = new GatelyCampaigns({ projectId: 'YOUR_PROJECT_ID' })
  const list = await campaigns.list()
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  [
    {
      "id": "a1b2c3d4-e5f6-4789-abcd-ef1234567890",
      "project_id": "proj-uuid-here",
      "name": "Product Launch",
      "subject": "Introducing our new feature!",
      "status": "sent",
      "total_recipients": 842,
      "delivered_count": 835,
      "recipient_filter": {
        "type": "mixed",
        "emails": [],
        "list_ids": ["list-uuid"],
        "segment_ids": [],
        "all_contacts": false
      },
      "scheduled_at": null,
      "sent_at": "2025-06-01T10:00:00.000Z",
      "created_at": "2025-05-30T14:22:00.000Z",
      "updated_at": "2025-06-01T10:04:11.000Z"
    }
  ]
  ```

  ```json Unauthorized theme={null}
  {
    "error": "Authentication required"
  }
  ```
</ResponseExample>
