Skip to content

Campaigns

A campaign is a labelled bundle of posts. Use it for product launches, content series, weekly digests, or paid-media moments where you want a single rollup instead of per-post stats.

Endpoints

All under /api/v1/post-campaigns:

  • GET /post-campaigns — list with search, status, page, perPage query params (default page=1, perPage=25).
  • POST /post-campaigns — create with { name, desc?, color?, status? }.
  • PUT /post-campaigns/:id — update fields.
  • PATCH /post-campaigns/:id/status — toggle active state.
  • DELETE /post-campaigns/:id — remove.

Campaign model

typescript
{
  user: ObjectId,
  team_id: ObjectId,
  name: string,
  desc: string,
  color: string,        // hex or named
  status: number,       // default 1
  postSucceed: number,  // counter
  postFailed: number,   // counter
}

postSucceed and postFailed are explicit counters incremented when child posts publish or fail, not aggregations computed at read time.

Attaching posts

Posts reference a campaign via the campaign ObjectId field. Attach a post by including campaign in the body of POST /api/v1/posts (or PUT /api/v1/posts/:id to change a draft's campaign). To list posts inside a campaign:

GET /api/v1/posts?campaign=<id>

Per-campaign analytics

There is no dedicated campaign-analytics endpoint today. Roll-up metrics are available indirectly:

  • postSucceed / postFailed counters give a quick health check.
  • Filter /api/v1/analytics/posts-by-channel?campaign=<id> (where supported) for impression and engagement rollups — see Campaign Performance for the per-endpoint matrix.