---
title: "Create an AI-generated campaign"
method: POST
path: "/campaigns"
---

# Create an AI-generated campaign

`POST /campaigns`

Queues generation for a multi-post AI campaign and returns immediately with `GENERATING` status. Campaign posts are generated asynchronously in the background.

## Query parameters

- `workspaceId` string, required

## Request body

- object
  - `prompt` string, required — Campaign prompt or brief.
  - `goal` 'awareness' | 'leads' | 'launch' | 'offer' | 'education' | 'event' — Campaign objective.
  - `audience` 'business_owners' | 'founders_executives' | 'marketing_teams' | 'buyers_customers' | 'local_community' | 'investors' | 'first_time_buyers' | 'existing_customers' — Primary campaign audience.
  - `duration` integer — Campaign duration in days, from 1 to 30. Defaults to 7.
  - `count` integer — Number of posts to generate, from 3 to 30. Defaults to 5.
  - `postLength` 'short' | 'medium' | 'long' | 'extra_long' — Target caption length for each generated campaign post.
  - `tone` 'professional' | 'friendly' | 'educational' | 'bold' | 'founder_led' — Caption tone for campaign posts.
  - `brandId` string — Brand kit ID used for brand context. When campaign media is generated, brand kit logos and icons are treated as protected reference assets. Get IDs from `GET /brand-kits`.
  - `hashtagLibraryId` string — Hashtag library ID used for hashtag context. Get IDs from `GET /hashtag-libraries`.
  - `socialProfileIds` string[] — Connected social profile IDs to attach when generated campaign posts are saved. Get IDs from `GET /social-profiles`.
  - `generateMedia` boolean — Whether to generate images for campaign posts.
  - `imageCount` integer — Number of images to generate for each campaign post, from 1 to 5. Values above 1 create carousel-style post creatives. Defaults to 1.
  - `referenceUrls` string[] — Optional image URLs to use as visual references when `generateMedia` is `true`. Maximum 3.
  - `referenceDesignIds` string[] — Optional Studio design IDs to use as visual references when `generateMedia` is `true`. Get IDs from `GET /studio-templates`. Maximum 3.

## Response `202`

Campaign generation queued

- object
  - `campaignId` string
  - `status` string
  - `queued` boolean
  - `generation` object — Campaign generation progress metadata.

## Other responses

- `400` — Invalid request
- `500` — Unknown error

---

[API](https://skmtc.net/ocoya/apis/ocoya-api.md) · [All operations](https://skmtc.net/ocoya/apis/ocoya-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/ocoya/ocoya-api/versions/80ba891a0523/schema)
