---
title: "Generate keywords for a campaign across multiple channels with duplication avoidance"
method: POST
path: "/api/campaign/generate-keywords"
tags: ["Campaign", "Keywords"]
---

# Generate keywords for a campaign across multiple channels with duplication avoidance

`POST /api/campaign/generate-keywords`

## Request

- Base URL: `https://api.kolect.com`
- URL: `https://api.kolect.com/api/campaign/generate-keywords`
- Auth: HTTP bearer

Generate 5-20 relevant keywords for a campaign using AI. If existing keywords are found, generates variations to avoid duplications. If no existing keywords exist, uses original keyword generation process. Keywords are stored in the appropriate platform tables.

## Request body

- object
  - `campaign_id` string, uuid, required: UUID of the campaign to generate keywords for
  - `channels` string[], required: Array of social media platforms to generate keywords for
  - `prompt_version` 'v1' | 'v2': Version of the prompt to use for keyword generation (default is v1)

## Response `200`

Keywords generated and stored successfully

- object
  - `success` boolean
  - `campaign_id` string, uuid
  - `results` object[]
    - `channel` string
    - `terms_id` string[]: Array of generated keyword IDs
    - `keywords_generated` number
    - `strategy_used` 'original' | 'variation': Strategy used for keyword generation
    - `existing_keywords_count` number: Number of existing keywords found for this channel
    - `error` string: Error message if channel processing failed
  - `total_keywords_generated` number
  - `completed_channels` string[]
  - `failed_channels` string[]: Channels that failed to process (optional)

## Other responses

- `400`: Bad request due to invalid input
- `404`: Campaign not found
- `500`: Server error during keyword generation

---

[API](https://skmtc.dev/kolect/apis/kolect-api.md) · [All operations](https://skmtc.dev/kolect/apis/kolect-api/llms.txt) · [OpenAPI document](https://skmtc.dev/kolect/apis/kolect-api/revisions/fe54528e8f54?raw)
