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

# List and generate AI QR Code variants

> GET, POST /qr/{qrid}/ai/

Lists and generates AI artwork variants for one **Dynamic** QR Code.

```
GET    https://api.scanova.io/qr/{qrid}/ai/
POST   https://api.scanova.io/qr/{qrid}/ai/
Authorization: 401f7ac837da42b97f613d789819ff93537bee6a
```

<ParamField path="qrid" type="string" required>
  The QR Code's `qrid`. Must be a Dynamic (`dy`) QR Code — a static one returns `400`.
</ParamField>

Generating consumes the `AI_QR_CODE` quota.

### Generate (POST)

<ParamField body="prompt" type="string" required>
  The image prompt, max 200 characters.
</ParamField>

<ParamField body="negative_prompt" type="string">
  What to avoid, max 50 characters.
</ParamField>

Every other field — `weight`, `qr_code_pattern`, `preset`, `provider`, `status`, `selected`, `is_scannable`, `qr_image_url`, `qr_image`, `created` — is read-only.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.scanova.io/qr/Qa1b2c3d4e5f6g7h8/ai/" \
    -H "Authorization: 401f7ac837da42b97f613d789819ff93537bee6a" \
    -H "Content-Type: application/json" \
    -d '{
        "prompt": "cyberpunk city skyline at night",
        "negative_prompt": "blurry, low quality"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "results": [
      { "id": 501, "provider": "quickqr", "status": "generating", "selected": false },
      { "id": 502, "provider": "qrcode_ai", "status": "generating", "selected": false }
    ]
  }
  ```
</ResponseExample>

<Warning>
  One `POST` creates **one record per configured AI provider**, so the response is a `{"results": [...]}` list, not a single object. Don't write client code that expects a single created resource — and remember each of those records counts against your generation quota.
</Warning>

<Note>
  Generation is asynchronous. `status` moves `new` → `generating` → `generated` (or `failed`). The default `GET` returns only `generated` variants, so poll in-flight records explicitly with `?ids=501,502` until they leave `generating`.
</Note>

## Related

* [Retrieve and select an AI variant](/api-reference/management-api/qr/ai-retrieve-update) — read one record and mark it as the chosen design.
* [Create a QR Code](/api-reference/management-api/qr/create) — `ai_session_id` links a new QR Code to an AI Assistant session.
* [Update a QR Code's design](/api-reference/management-api/qr/update-pattern) — the non-AI design path.
* [QR Manager overview](/api-reference/management-api/qr/overview) — the quotas, role permissions, and Trash model shared by every endpoint in this module.
* [Management API overview](/api-reference/management-api/overview) — the auth scheme and quota rules that apply to this endpoint.


## OpenAPI

````yaml api-reference/openapi/management-api.json GET /qr/{qrid}/ai/
openapi: 3.1.0
info:
  title: Scanova Management API (v2)
  description: >-
    The complete Scanova Management API — every endpoint available at
    api.scanova.io (QR codes, folders, tags, leads, forms, analytics, plans,
    shared users & roles), plus the token-creation and usage-stats endpoints
    used to authenticate against it. Every path and request/response shape below
    was verified live against a real API key and the actual running backend
    (Phase 7, 2026-08-16) — not guessed from reading urls.py alone.
  version: 2.0.0
servers:
  - url: https://api.scanova.io
    description: Management API — QR/folder/tag/lead/form/analytics/plans endpoints
security:
  - apiKeyAuth: []
paths:
  /qr/{qrid}/ai/:
    get:
      summary: List AI QR variants
      description: >-
        AI-generated artwork variants for one Dynamic QR code. By default only
        variants with status `generated` are returned; pass `?ids=1,2,3` to
        fetch specific records regardless of status (useful for polling
        in-flight generations). Only Dynamic QR codes are supported.
      operationId: listAiQrCodes
      parameters:
        - name: qrid
          in: path
          required: true
          schema:
            type: string
          description: >-
            The QR code's `qrid` — the opaque public identifier returned by the
            list endpoint, not the numeric `id`.
        - name: ids
          in: query
          required: false
          schema:
            type: string
          description: >-
            Comma-separated AI-record ids. Returns those records regardless of
            status, instead of the default `generated`-only listing.
      responses:
        '200':
          description: AI variants for this QR code.
          content:
            application/json:
              example:
                - id: 501
                  prompt: cyberpunk city skyline at night
                  negative_prompt: blurry, low quality
                  weight: 1.2
                  qr_code_pattern: null
                  preset: illustration
                  provider: quickqr
                  status: generated
                  selected: true
                  is_scannable: true
                  qr_image_url: https://cdn.scanova.io/ai/501.png
                  created: '2026-09-09T09:00:00Z'
        '400':
          description: The QR code is static — AI variants are Dynamic-only.
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Send your Management API key as the raw value of the Authorization
        header — no "Bearer " or "Token " prefix, and no other characters.
        Example: `Authorization: 401f7ac837da42b97f613d789819ff93537bee6a`. A
        header containing more than one space-separated part is rejected
        outright. Requests also require the request's Host header to be the
        management API host (e.g. api.scanova.io) — the same key sent to the
        regular API host will not authenticate.

````