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

# Generation API: Dispatch and Track AI Brand Generation Jobs

> Dispatch asynchronous AI brand generation jobs to Nomiq. Receive completed SVG assets and style tokens via webhook when the job finishes.

The Generation API is the core engine of Nomiq. Because building a complete brand identity — logo SVGs, color palettes, and typography — is computationally intensive, the endpoint operates **asynchronously**: you receive a `202 Accepted` response within milliseconds, and the final assets are delivered to your webhook endpoint once the AI Engine finishes, typically within 3–10 seconds. You must have a valid `project_id` from the Projects API before calling this endpoint.

## Generate a Brand

`POST https://api.nomiq.com/v1/brands/generate`

Validates your request, enqueues a generation job against the AI Engine, and immediately returns a `job` object in the `queued` state. The completed brand assets are never returned in this response — configure a webhook URL to receive them asynchronously.

### Request Body

<ParamField body="project_id" type="string" required>
  The unique identifier of an existing project (prefix `proj_`) where the generated assets will be stored. Obtain this from `POST /v1/projects`. Returns `404` if the project does not exist in your workspace.
</ParamField>

<ParamField body="prompt" type="string" required>
  A semantic, natural-language description of the brand you want to generate. The AI Engine uses this as the sole creative brief — be specific about industry, aesthetic, colors, and typography. Maximum 2,000 characters. See the [Prompt Engineering guide](/ai-engine/prompt-engineering) for best practices.
</ParamField>

<ParamField body="webhook_url" type="string">
  An HTTPS URL to receive the `generation.success` or `generation.failed` event for this specific job. When provided, this overrides the default webhook URL configured in Workspace Settings for this request only. Must be a valid, publicly reachable HTTPS endpoint.
</ParamField>

<ParamField body="memory_id" type="string">
  The ID of a Memory Node from a previous generation (prefix `mem_`). When supplied, the AI Engine loads the prior generation's style seed and applies your new prompt as an incremental refinement rather than a fresh generation. See the [Memory API](/api-reference/memory) for details.
</ParamField>

### Example Request

The following example dispatches a generation job for a Brooklyn cold brew coffee shop. Pass your real `project_id` in place of `proj_1A2b3C4d5E`.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.nomiq.com/v1/brands/generate" \
    -H "Authorization: Bearer sk_live_xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "project_id": "proj_1A2b3C4d5E",
      "prompt": "A modern coffee shop in Brooklyn that specializes in cold brew. The logo should feature a minimalistic cold brew glass icon, with a deep indigo and warm cream color palette. Typography should be a clean geometric sans-serif that feels approachable but premium.",
      "webhook_url": "https://yourapp.com/api/nomiq/webhook"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://api.nomiq.com/v1/brands/generate", {
    method: "POST",
    headers: {
      "Authorization": "Bearer sk_live_xxx",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      project_id: "proj_1A2b3C4d5E",
      prompt:
        "A modern coffee shop in Brooklyn that specializes in cold brew. " +
        "The logo should feature a minimalistic cold brew glass icon, with a deep " +
        "indigo and warm cream color palette. Typography should be a clean geometric " +
        "sans-serif that feels approachable but premium.",
      webhook_url: "https://yourapp.com/api/nomiq/webhook",
    }),
  });

  // 202 Accepted — job is now queued
  const job = await response.json();
  console.log(job.id);     // "job_9x8y7z6w"
  console.log(job.status); // "queued"
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.nomiq.com/v1/brands/generate",
      headers={
          "Authorization": "Bearer sk_live_xxx",
          "Content-Type": "application/json",
      },
      json={
          "project_id": "proj_1A2b3C4d5E",
          "prompt": (
              "A modern coffee shop in Brooklyn that specializes in cold brew. "
              "The logo should feature a minimalistic cold brew glass icon, with a deep "
              "indigo and warm cream color palette. Typography should be a clean geometric "
              "sans-serif that feels approachable but premium."
          ),
          "webhook_url": "https://yourapp.com/api/nomiq/webhook",
      },
  )

  # 202 Accepted — job is now queued
  job = response.json()
  print(job["id"])     # "job_9x8y7z6w"
  print(job["status"]) # "queued"
  ```
</CodeGroup>

### Response (202 Accepted)

The API responds immediately with `HTTP 202 Accepted`. The response body contains the `job` object in its initial `queued` state — the final assets are **not** present at this stage.

```json theme={null}
{
  "object": "job",
  "id": "job_9x8y7z6w",
  "project_id": "proj_1A2b3C4d5E",
  "status": "queued",
  "created_at": 1677649420
}
```

### Response Fields

<ResponseField name="object" type="string">
  Always `"job"`.
</ResponseField>

<ResponseField name="id" type="string">
  The unique identifier for this generation job (prefix `job_`). This ID is included in the webhook payload so you can correlate the async result with the original request.
</ResponseField>

<ResponseField name="project_id" type="string">
  The project ID this job belongs to, echoed from your request.
</ResponseField>

<ResponseField name="status" type="string">
  The current state of the job. Immediately after dispatch this will always be `"queued"`. Possible values are `queued`, `processing`, `succeeded`, and `failed` — the final state is reported in the webhook payload, not via polling.
</ResponseField>

<ResponseField name="created_at" type="integer">
  Unix timestamp (seconds) recording when the job was enqueued.
</ResponseField>

<Warning>
  **Do not poll the API to check job status.** There is no `GET /v1/jobs/{job_id}` status endpoint. The only supported way to receive completed assets is by listening for the `generation.success` webhook event. Attempting to work around this with high-frequency requests to other endpoints will trigger HTTP `429 Too Many Requests` errors and may result in temporary account suspension.
</Warning>

***

## Rate Limits

Generation requests consume significant GPU resources and are subject to strict per-minute rate limits based on your subscription tier. If you exceed the limit, the API returns `HTTP 429` with a `Retry-After` header indicating when you may resume.

| Tier   | Requests per Minute |
| ------ | ------------------- |
| Free   | 10                  |
| Pro    | 60                  |
| Agency | 300                 |

Rate limit headers are included on every response:

| Header                  | Description                                                               |
| ----------------------- | ------------------------------------------------------------------------- |
| `X-RateLimit-Limit`     | The maximum number of requests allowed per minute for your tier.          |
| `X-RateLimit-Remaining` | The number of requests remaining in the current one-minute window.        |
| `X-RateLimit-Reset`     | Unix timestamp when the current window resets and your quota is restored. |

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Webhooks" icon="webhook" href="/api-reference/webhooks">
    Configure your server to receive completed brand assets and handle signature verification.
  </Card>

  <Card title="Memory API" icon="brain" href="/api-reference/memory">
    Pass a Memory ID to iterate on an existing generation instead of starting from scratch.
  </Card>
</CardGroup>
