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

# Brand kits

> Build a brand kit from your documents, a website or your social profiles, edit it, and generate images that follow it with Magnific One.

A brand kit stores your brand once: colours, imagery style, tone of voice, typography, logos and content templates. Through the API you can build a kit, feed it, edit it, test it with validation rounds and generate images that follow it.

> [!NOTE]
>
> A brand kit is used when you **generate images with Magnific One** (`POST /v2/images/generate/magnific-one`). The other models do not take one: sending `brand_kit_id` to them answers `422`.

## Build a kit, step by step

### 1. Create the kit

```bash theme={null}
curl -X POST https://api.magnific.com/v2/brand-kits \
  -H "x-magnific-api-key: $MAGNIFIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Acme Shoes", "description": "Running shoes for city runners" }'
```

The answer is `201` with the new kit's `id`: a private draft of yours. To start from an official or shared kit instead, copy it with `POST /v2/brand-kits/{brand_kit_id}/duplicate`. Both count against the number of kits you may own (`422` when it is reached).

### 2. Feed it

Use any of these sources, as many times as you need:

| Source | Call | What happens |
| - | - | - |
| Your documents | `POST /v2/brand-kits/{brand_kit_id}/documents` | Registers source documents of the kit, up to the per-request limit, each on its own: a bad entry is listed under `rejected` and the rest are kept. Two ways in, below. |
| A website | `POST /v2/brand-kits/{brand_kit_id}/scrape` | Captures a public website (`url`) and extracts its brand. Internal, reserved and loopback hosts are refused. Answers `202` before it is done. |
| Your social profiles | `POST /v2/brand-kits/{brand_kit_id}/social-analysis` | Reads the brand style of the public posts of the social profiles confirmed on the kit; a profile that is only a candidate is never captured. `networks` narrows it (e.g. `instagram`, `linkedin`). Answers `202` with a `run_id`. |

```bash theme={null}
curl -X POST https://api.magnific.com/v2/brand-kits/bk_3Xa9/scrape \
  -H "x-magnific-api-key: $MAGNIFIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://www.example.com" }'
```

**From your own image creations.** Send each one's `creation_id` with its `type` (`image`). Upload a file first with [Uploads](https://docs.magnific.com/api-reference/v2/uploads/overview.md) to get its `creation_id`. Images are analysed on their own: the answer carries a `run_id` to wait for.

```bash theme={null}
curl -X POST https://api.magnific.com/v2/brand-kits/bk_3Xa9/documents \
  -H "x-magnific-api-key: $MAGNIFIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "documents": [{ "filename": "lookbook.png", "type": "image", "creation_id": "<creation_id>" }] }'
```

**PDF, markdown or text files** (`.pdf`, `.md`, `.txt`). Attaching them needs a paid plan.

1. Ask for one signed target per file:

   ```bash theme={null}
   curl -X POST https://api.magnific.com/v2/brand-kits/bk_3Xa9/documents/uploads \
     -H "x-magnific-api-key: $MAGNIFIC_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{ "files": [{ "filename": "brand-guidelines.pdf" }] }'
   ```

   Each target has its `upload_url`, `upload_path`, `mime_type` and the `type` to register it with: `pdf`, or `design_md` for markdown and text. Targets count against your daily upload quota.

2. `PUT` each file's raw bytes to its `upload_url`, with the `Content-Type` of its `mime_type`. No JSON and no API key: the signature in the URL is the authorization.

   ```bash theme={null}
   curl -X PUT "<upload_url>" \
     -H "Content-Type: <mime_type>" \
     --data-binary @brand-guidelines.pdf
   ```

3. Register it with its `upload_path` and that `type`, instead of a `creation_id`:

   ```bash theme={null}
   curl -X POST https://api.magnific.com/v2/brand-kits/bk_3Xa9/documents \
     -H "x-magnific-api-key: $MAGNIFIC_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{ "documents": [{ "filename": "brand-guidelines.pdf", "type": "pdf", "upload_path": "<upload_path>" }] }'
   ```

   A target lasts an hour and is good for one document of this kit: request a new one if the `PUT` fails or it expires.

4. Process it with the document's `id` from that answer: `POST /v2/brand-kits/{brand_kit_id}/documents/{document_id}/process`. It answers `processing` with a `run_id`, `completed` if it was read before, or `deferred` when the daily extraction limit is reached: it is then read on its own after `retry_after`, so do not send it again.

5. Wait for the run, as in the next step.

A source you no longer want goes with `DELETE /v2/brand-kits/{brand_kit_id}/documents/{document_id}` (`website` as the `document_id` for the site the kit was read from). What was already extracted from it stays in the kit.

### 3. Wait for the run

```bash theme={null}
curl https://api.magnific.com/v2/brand-kits/runs/run_8Hk2 \
  -H "x-magnific-api-key: $MAGNIFIC_API_KEY"
```

While the run is `processing`, ask again after `poll_after_seconds`. Once it ends it is `completed`, with the palette, typography, brand and voice it found and the `gaps` that say why anything is missing, or `failed` for a template that did not get made. Then read the whole kit with `GET /v2/brand-kits/{brand_kit_id}` (`?view=full` for the raw kit, to edit it).

### 4. Edit it

| What | Call |
| - | - |
| Name, description, status, design tokens or atoms | `PATCH /v2/brand-kits/{brand_kit_id}`. Only the fields you send change. Set `status` to `ready` once you are happy with the kit. A section someone curated by hand is kept unless you send `user_requested_overwrite`. |
| The section tree | `PUT /v2/brand-kits/{brand_kit_id}/sections`: the whole tree in one write. Nothing is stored when it is refused. |
| Rules | `GET` and `POST /v2/brand-kits/{brand_kit_id}/rules`: a term banned from every generation with the kit, or with one template. `GET /v2/brand-kits/{brand_kit_id}/creations` lists what you made with the kit, to check before adding one. |
| Templates | `POST /v2/brand-kits/{brand_kit_id}/templates` from your example images (`creation_ids`), a `brief` or one of your saved presets (`preset_id`, from `GET /v2/brand-kits/presets/user`). If it answers `processing`, the template shows up in the kit later: do not send it again. `DELETE /v2/brand-kits/{brand_kit_id}/templates/{slug}` removes one. Add a template's example images with `POST /v2/brand-kits/{brand_kit_id}/templates/{slug}/images` and remove one with `DELETE /v2/brand-kits/{brand_kit_id}/templates/{slug}/images/{creation_id}`. |
| Design templates | `GET /v2/brand-kits/{brand_kit_id}/design-templates` lists the Designer pages saved into the kit; `DELETE …/design-templates/{design_template_id}` removes one. |
| Vectors and components | `POST /v2/brand-kits/{brand_kit_id}/assets`: an SVG or a self-contained HTML component, kept editable. |
| Fonts | Two steps, below. |

**Fonts** (`.ttf`, `.otf`, `.woff`, `.woff2`):

1. Ask for one signed target per file:

   ```bash theme={null}
   curl -X POST https://api.magnific.com/v2/brand-kits/bk_3Xa9/fonts/uploads \
     -H "x-magnific-api-key: $MAGNIFIC_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{ "files": [{ "filename": "Acme-Bold.woff2" }] }'
   ```

2. `PUT` each file's raw bytes to its `upload_url`, with the `Content-Type` of its `mime_type` (`application/octet-stream`). No JSON and no API key: the signature in the URL is the authorization.

   ```bash theme={null}
   curl -X PUT "<upload_url>" \
     -H "Content-Type: application/octet-stream" \
     --data-binary @Acme-Bold.woff2
   ```

3. Register it with its `upload_path`, optionally in a typography `role`:

   ```bash theme={null}
   curl -X POST https://api.magnific.com/v2/brand-kits/bk_3Xa9/fonts \
     -H "x-magnific-api-key: $MAGNIFIC_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{ "upload_path": "<upload_path>" }'
   ```

A target is valid until its `expires_at`: request a new one if the `PUT` fails or it expires.

### 5. Generate with it

Go on with [Generate on brand](#generate-on-brand-step-by-step), using the kit once its `status` is `ready`.

## Validation rounds

A validation round tests a `ready` kit you own: it plans a few scenarios (one per template, or the standard set), you generate one image for each, the user says which look on brand and which do not, and that feedback becomes a patch for the kit. Nothing in the kit changes until the patch is applied.

### 1. Start a round

```bash theme={null}
curl -X POST https://api.magnific.com/v2/brand-kits/bk_3Xa9/validation/runs \
  -H "x-magnific-api-key: $MAGNIFIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

The answer is `201` with the round's `id` and its `recommended_scenarios`, each with its `key`. Omit `scenario_keys` for the standard round, or send up to 4 of them to test only those (`template:<slug>` for one of the kit's templates). Rounds per kit and day are capped.

### 2. Generate each scenario's sample

```bash theme={null}
curl -X POST https://api.magnific.com/v2/brand-kits/bk_3Xa9/validation/runs/vr_5Tq1/samples \
  -H "x-magnific-api-key: $MAGNIFIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "scenario_key": "template:social-banner" }'
```

One call per entry of `recommended_scenarios`. The prompt, model, ratio and template come from the round's plan, whatever else is sent. Each sample is billed as an image generation (`402` with `required_credits` when the balance is short), so agree the cost with the user first: `?dry_run=true` prices it. It answers `202` before rendering, like `POST /v2/images/generate/{model}`: follow it with `GET /v2/creations/{creation_id}` or a `webhook_url`, and `folder_reference` picks where it lands. A scenario holds one image: asking again answers the one it has, without charging.

### 3. Record the samples

Once every scenario's image is generated, `POST /v2/brand-kits/{brand_kit_id}/validation/runs/{run_id}/record` records them as the round's samples, in scenario order, and the round becomes `samples_recorded`.

### 4. Ask the user

Show the user each sample and ask which look on brand and which do not, and why.

### 5. Analyze the feedback

```bash theme={null}
curl -X POST https://api.magnific.com/v2/brand-kits/bk_3Xa9/validation/runs/vr_5Tq1/analysis \
  -H "x-magnific-api-key: $MAGNIFIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "response_language": "English",
    "sample_feedback": [
      { "creation_id": "cr_8Lm4", "label": "more_on_brand" },
      { "creation_id": "cr_2Wd9", "label": "less_on_brand", "notes": "The orange is too dark" }
    ]
  }'
```

Each sample the user judged goes in `sample_feedback` with its `label` (`more_on_brand`, `less_on_brand` or `neutral`) and their own words in `notes`. The answer is `201` with a proposed patch (`status`: `proposed`) and its `id`: additive rules, things to avoid, prompt fragments, logo rules and template examples. A structural change (palette, logo, typography) is only named in `proposed_patch.needs_confirmation`, for the user to confirm and apply apart with `PATCH /v2/brand-kits/{brand_kit_id}`. If the user rejects the proposal, analyze again with `revision_patch_id` and their correction in `user_notes`. Analysis is a model run on the user's daily budget (`429` over it).

### 6. Read the patch

`GET /v2/brand-kits/{brand_kit_id}/validation/patches/{patch_id}` returns the proposal, to show the user before they decide.

### 7. Apply it

```bash theme={null}
curl -X POST https://api.magnific.com/v2/brand-kits/bk_3Xa9/validation/patches/vp_6Hn3/apply \
  -H "x-magnific-api-key: $MAGNIFIC_API_KEY"
```

Applying the patch is the approval: call it only once the user agrees. It writes the patch's additive changes into the kit, once: applying it again writes nothing and answers `replayed: true`. A kit edited since the proposal is refused: analyze again.

### 8. Refine (optional)

Start a new round with `previous_run_id` set to the round you just patched. Its scenarios are cloned so before and after compare; `scenario_keys`, if sent, must be the previous round's. Refinements per chain are capped.

## Who may do what

* **Reads** (`GET`) work on every kit you may read: your own, the ones shared with you and the official ones. With an API key, only the kits of the key's organization are reachable.
* **Writes** work only on a kit you own. Duplicate a shared or official kit to edit your own copy.
* A kit you cannot reach answers `404`, whether it does not exist or is not yours to see or edit.
* A personal token needs `api:read` to read, `api:write` to create and edit, and `api:destructive` to delete a document or a template.

## Limits

* **Model runs** (processing a document, capturing a website, creating a template, analysing social profiles and analysing a validation round's feedback) have a per-user minute and daily budget. Over it, the call answers `429`: wait the `Retry-After` header, in seconds.
* **Font and document uploads** count against your daily upload quota: over it, `POST /v2/brand-kits/{brand_kit_id}/fonts/uploads` and `POST /v2/brand-kits/{brand_kit_id}/documents/uploads` answer `429` with `upload_quota_exceeded`.

## Generate on brand, step by step

### 1. Find the kit

```bash theme={null}
curl https://api.magnific.com/v2/brand-kits \
  -H "x-magnific-api-key: $MAGNIFIC_API_KEY"
```

```json theme={null}
{
  "data": [
    {
      "id": "bk_3Xa9",
      "name": "Acme Shoes",
      "status": "ready",
      "is_owner": true,
      "is_official": false,
      "templates_count": 2,
      "palette_hexes": ["#0F172A", "#F97316", "#FACC15"],
      "templates": [
        { "slug": "social-banner", "name": "Social banner" },
        { "slug": "product-hero", "name": "Product hero" }
      ]
    }
  ],
  "meta": { "pagination": { "has_more": false } }
}
```

Use a kit whose `status` is `ready`: one still being built is refused.

### 2. Pick a template and a logo (optional)

```bash theme={null}
curl https://api.magnific.com/v2/brand-kits/bk_3Xa9 \
  -H "x-magnific-api-key: $MAGNIFIC_API_KEY"
```

The kit's templates are in `data.content.templates` (each with its `slug`) and the logos generation can place are in `data.content.logo_marks` (each with its `sqid`).

### 3. Generate with it

```bash theme={null}
curl -X POST https://api.magnific.com/v2/images/generate/magnific-one \
  -H "x-magnific-api-key: $MAGNIFIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Summer sale banner with our new sneakers",
    "aspect_ratio": "16:9",
    "brand_kit_id": "bk_3Xa9",
    "brand_kit_template_slug": "social-banner",
    "brand_kit_logo": "lg_7Qp2"
  }'
```

| Field | What it does |
| - | - |
| `brand_kit_id` | The kit the images follow. Required to generate on brand. |
| `brand_kit_template_slug` | Optional. One of the kit's templates: the layout and imagery the images follow. |
| `brand_kit_logo` | Optional. Which of the kit's `logo_marks` goes in the images. Default: the kit's main mark. |
| `brand_kit_variant_ids` | Optional. Up to three of the kit's `content.variants` (`GET /v2/brand-kits/{brand_kit_id}`), such as a market or a campaign, at most one per `kind`. |

The answer is the same as any image generation: `202` with the images under `data[]`, each with its `creation_id`.

## What is refused, before charging

Each of these answers `422` naming the field, and nothing is charged:

* A model other than Magnific One, `auto` included.
* A kit you cannot read, or one whose `status` is not `ready`.
* A template or a logo the kit does not have.
* References that Magnific One does not take next to a kit.

With an API key, only the kits of the key's organization are reachable.

## In a flow

A flow input of type brand kit takes `{ "brand_kit_id": "bk_3Xa9", "brand_kit_template_slug": "social-banner" }` in `POST /v2/flows/{flow_id}/run`, with the same checks.

> [!TIP]
>
> A brand kit guides the images; it does not guarantee exact fonts, exact colour values or pixel-identical logo placement.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.