# PostEverywhere Campaigns Guide

> Group related posts under named campaigns ('Q3 Launch', 'Holiday 2026'). Filter and report on them as a unit.

**Source:** https://posteverywhere.ai/docs/campaigns
**Section:** Core concepts
**API reference:** https://posteverywhere.ai/docs/api/reference

---

Campaigns let you **group related posts** under a name + color so you can filter, list, and report on them as a unit. Useful for marketing pushes ("Q3 Launch"), recurring series ("Tip Tuesday"), or seasonal content ("Holiday 2026").

## The campaign endpoints at a glance
**Related:** [paging the campaigns list](/docs/pagination) · [campaign-level analytics](/docs/analytics-summary) · [bulk-creating campaign posts](/docs/bulk-operations) · [post events for campaign posts](/docs/webhooks)

Full reference: [List](/docs/api/list-campaigns) · [Create](/docs/api/create-campaign) · [Get](/docs/api/get-campaign) · [Update](/docs/api/update-campaign) · [Delete](/docs/api/delete-campaign).

```
GET    /v1/campaigns          list campaigns
POST   /v1/campaigns          create
GET    /v1/campaigns/:id      fetch one (includes post_count)
PATCH  /v1/campaigns/:id      update name/description/color/status
DELETE /v1/campaigns/:id      delete (posts survive, campaign_id set NULL)
```

## Create a campaign
```bash
curl -X POST https://app.posteverywhere.ai/api/v1/campaigns \
  -H "Authorization: Bearer $POSTEVERYWHERE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name":        "Q3 Product Launch",
    "description": "Cross-platform rollout for the August launch",
    "color":       "#3b82f6",
    "status":      "active"
  }'
```

Response:

```json
{
  "data": {
    "id":          42,
    "name":        "Q3 Product Launch",
    "description": "Cross-platform rollout for the August launch",
    "color":       "#3b82f6",
    "status":      "active",
    "post_count":  0,
    "created_at":  "2026-06-11T...",
    "updated_at":  "2026-06-11T..."
  },
  "error": null,
  "meta": { "request_id": "a1b2c3d4", "timestamp": "2026-06-11T09:55:12.341Z" }
}
```

## Attach posts to a campaign
Pass `campaign_id` when creating a post:

```bash
curl -X POST https://app.posteverywhere.ai/api/v1/posts \
  -H "Authorization: Bearer $POSTEVERYWHERE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content":      "Big news today...",
    "account_ids":  [123, 456],
    "scheduled_for": "2026-08-01T10:00:00Z",
    "campaign_id":  42
  }'
```

A `campaign_id` that is not in the key's workspace returns `400 campaign_not_found` and no post is created.

`GET /v1/campaigns` takes `limit` (default 50, max 100) and `offset`, and returns `campaigns` plus a `pagination` block (`limit`, `offset`, `total`, `has_more`).

## Retrieve every post in a campaign
```bash
curl "https://app.posteverywhere.ai/api/v1/posts?campaign_id=42" \
  -H "Authorization: Bearer $POSTEVERYWHERE_API_KEY"
```

## Validation rules campaigns enforce
| Field | Type | Constraint |
|-------|------|------------|
| `name` | string | 1-100 chars, required |
| `description` | string | max 500 chars |
| `color` | string | hex `#RRGGBB` (e.g. `#3b82f6`); defaults to `#3b82f6` |
| `status` | string | `active` or `archived`; defaults to `active`. On create any other value is stored as `active`; on `PATCH` any other value returns `400 validation_error` |

## Campaign limits and edge cases
- **Workspace-scoped.** Campaigns belong to a workspace, not a user: visible to all workspace members.
- **Deleting doesn't delete posts.** When you delete a campaign, posts that referenced it have their `campaign_id` set to `NULL`. The posts themselves are untouched.
- **`status='archived'`** is a soft-hide. Archived campaigns still exist for posts that reference them but you can hide them: `GET /v1/campaigns` with no `status` returns both active and archived campaigns; pass `?status=active` to hide archived ones, or `?status=archived` to list only those.