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

# Generate more creatives

> Add creatives to a campaign in its existing direction.

[← Ad campaigns](/ad-campaigns/overview)

**Endpoint:** `POST https://makelocalads.com/api/v1/campaigns/{campaign_id}/creatives`
**Permission:** `campaigns:generate`

This is the campaign page's "Generate more". The new creatives follow the
campaign's existing direction: its recipe or ad types, audience, angles and
brief. Only the count is chosen.

## Usage notes

* `creative_count` can be `3`, `5`, `10`, `15`, `20`, `25`, or `30`. The
  default is `10`.
* Each creative costs 2 credits. `max_credits` refuses the request with `422`
  before anything is charged if the batch would cost more.
* Send an `Idempotency-Key` so a retry after a network failure never starts
  and charges for a second batch.

## Quick start

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl --request POST \
    --url https://makelocalads.com/api/v1/campaigns/84b92447-425f-4d2a-9ba1-7d67bf802332/creatives \
    --header "Authorization: Bearer $LOCALADS_API_KEY" \
    --header "Content-Type: application/json" \
    --header "Idempotency-Key: campaign-more-551" \
    --data '{ "creative_count": 5 }'
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await fetch(
    "https://makelocalads.com/api/v1/campaigns/84b92447-425f-4d2a-9ba1-7d67bf802332/creatives",
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.LOCALADS_API_KEY}`,
        "Content-Type": "application/json",
        "Idempotency-Key": "campaign-more-551",
      },
      body: JSON.stringify({ creative_count: 5 }),
    },
  );

  const campaign = await response.json();
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import os
  import requests

  response = requests.post(
      "https://makelocalads.com/api/v1/campaigns/84b92447-425f-4d2a-9ba1-7d67bf802332/creatives",
      headers={
          "Authorization": f"Bearer {os.environ['LOCALADS_API_KEY']}",
          "Content-Type": "application/json",
          "Idempotency-Key": "campaign-more-551",
      },
      json={"creative_count": 5},
  )

  campaign = response.json()
  ```
</CodeGroup>

## Input fields

<ParamField body="creative_count" type="integer">
  How many creatives to add: `3`, `5`, `10`, `15`, `20`, `25`, or `30`.
  Defaults to `10`.
</ParamField>

<ParamField body="max_credits" type="integer">
  Refuse the request with `422 credit_limit_exceeded`, before anything is
  charged, if the batch would cost more than this many credits.
</ParamField>

<Accordion title="Complete JSON schema">
  ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "creative_count": {
        "type": "integer",
        "enum": [3, 5, 10, 15, 20, 25, 30],
        "default": 10
      },
      "max_credits": { "type": "integer", "minimum": 1 }
    }
  }
  ```
</Accordion>

## Response

`202 Accepted`, with a `Location` header and the campaign. The new creatives
appear in `creatives` as `queued`. The response shape is the campaign from
[Create a campaign](/ad-campaigns/create-a-campaign).

Poll `GET /campaigns/{campaign_id}` with backoff until `status` is
`completed`, `failed`, or `canceled`. See [Polling](/concepts/polling).

## Errors

| Status | Code | Meaning |
| - | - | - |
| `404` | `campaign_not_found` | The campaign is not available to you |
| `422` | `insufficient_credits` | Not enough credits for every creative. Nothing was charged |
| `422` | `credit_limit_exceeded` | The batch would cost more than `max_credits` |
| `422` | `key_budget_exceeded` | This API key has used its monthly budget |

See [Errors and retries](/concepts/errors) for the error format.
