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

# Generate Design

> Render one or more images from a Pixy design or template.

## Allowed Modifications

Review the [Modifications](/modifications) guide for the full support matrix and example payloads.


## OpenAPI

````yaml /openapi.yaml post /api/v1/{designId}/generate
openapi: 3.1.0
info:
  title: Pixy Public API
  version: 1.0.0
  description: >
    Public API for validating bearer API keys, browsing and duplicating saved

    designs, and generating rendered design output from a Pixy design or
    template.


    The first endpoint in this reference is the API key validation endpoint used
    by

    integrations such as Zapier. Design, template, duplicate, and generate
    endpoints

    follow after it.


    This specification documents the currently exposed public endpoints in

    `apps/pixy-web/app/api/(public)`.
servers:
  - url: https://app.pixy.art
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Auth
    description: Resolve the current user for a Pixy bearer API key.
  - name: Generate
    description: Render design output from a Pixy design or template.
  - name: Templates
    description: Browse public Pixy templates.
  - name: Designs
    description: Browse designs saved in your Pixy organization.
paths:
  /api/v1/{designId}/generate:
    post:
      tags:
        - Generate
      summary: Create images automatically
      description: >
        Renders all pages of a Pixy design and returns generated file metadata.


        The authenticated API key must belong to the same organization as the
        design,

        unless the design is a public template.
      operationId: generateDesign
      parameters:
        - in: path
          name: designId
          required: true
          schema:
            type: string
          description: Pixy design or template identifier.
          example: clr123exampledesign
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateRequest'
            examples:
              default:
                summary: Generate with text overrides
                value:
                  format: jpeg
                  modifications:
                    - id: title-text
                      text: Spring launch sale
              jpeg:
                summary: Generate JPEGs
                value:
                  format: jpeg
                  modifications:
                    - id: title-text
                      text: Spring launch sale
              pdf:
                summary: Generate PDFs
                value:
                  format: pdf
                  modifications:
                    - id: title-text
                      text: Spring launch sale
      responses:
        '200':
          description: Successfully rendered one or more output files.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateSuccessResponse'
              examples:
                png:
                  value:
                    id: run_123
                    designId: des_123
                    duration: 842
                    files:
                      - url: >-
                          https://assets.example.com/generated/design-output-1.png
                        previewUrl: null
                        size: 237993
                        width: 1080
                        height: 1920
                        mimetype: image/png
                      - url: >-
                          https://assets.example.com/generated/design-output-2.png
                        previewUrl: null
                        size: 236102
                        width: 1080
                        height: 1920
                        mimetype: image/png
                jpeg:
                  value:
                    id: run_123
                    designId: des_123
                    duration: 842
                    files:
                      - url: >-
                          https://assets.example.com/generated/design-output-1.jpeg
                        previewUrl: null
                        size: 182441
                        width: 1080
                        height: 1920
                        mimetype: image/jpeg
                      - url: >-
                          https://assets.example.com/generated/design-output-2.jpeg
                        previewUrl: null
                        size: 179332
                        width: 1080
                        height: 1920
                        mimetype: image/jpeg
                pdf:
                  value:
                    id: run_123
                    designId: des_123
                    duration: 842
                    files:
                      - url: https://assets.example.com/generated/design-output.pdf
                        previewUrl: >-
                          https://assets.example.com/generated/design-output-preview.png
                        size: 482119
                        width: 1080
                        height: 1920
                        mimetype: application/pdf
                      - url: >-
                          https://assets.example.com/generated/design-output-2.pdf
                        previewUrl: >-
                          https://assets.example.com/generated/design-output-2-preview.png
                        size: 479884
                        width: 1080
                        height: 1920
                        mimetype: application/pdf
        '400':
          description: The request path or body is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalidRequest:
                  value:
                    message: Invalid format. Supported values are png, jpeg, and pdf.
        '401':
          description: The bearer token is missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  value:
                    message: Unauthorized
        '404':
          description: The requested design could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                notFound:
                  value:
                    message: Design not found.
        '500':
          description: Pixy failed to render or export the design.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                exportFailure:
                  value:
                    message: >-
                      Something went wrong exporting images. Try again with a
                      different design.
                genericFailure:
                  value:
                    message: Something went wrong
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: javascript
          label: npm / @pixy-art/sdk
          source: |
            import { Pixy } from '@pixy-art/sdk'

            const pixy = new Pixy({
              apiKey: 'YOUR_API_KEY',
            })

            const image = await pixy.generate('YOUR_DESIGN_ID', [
              {
                id: 'TITLE_ID',
                text: 'Spring launch sale',
              },
            ])

            console.log(image.files)
components:
  schemas:
    GenerateRequest:
      type: object
      additionalProperties: false
      properties:
        format:
          type: string
          enum:
            - png
            - jpeg
            - pdf
          default: jpeg
          description: >-
            Output format. Defaults to `jpeg`. `jpg` is also accepted and
            normalized to `jpeg`.
        modifications:
          type: array
          description: >
            Optional object-level overrides applied before rendering.


            Supported overrides are inferred from the current implementation:

            text replacement for text objects, fill/stroke color replacement for

            text, image, and SVG objects, and source image replacement for image
            objects.
          items:
            $ref: '#/components/schemas/DesignModification'
    GenerateSuccessResponse:
      type: object
      additionalProperties: false
      required:
        - id
        - designId
        - files
        - duration
      properties:
        id:
          type: string
          description: Render run identifier.
        designId:
          type: string
          description: Design identifier used for the render.
        duration:
          type: integer
          description: Total render duration in milliseconds.
        files:
          type: array
          description: >-
            Rendered output files, one per generated page. When `format` is
            `pdf`, each page is returned as a separate PDF file.
          items:
            type: object
            additionalProperties: false
            required:
              - url
              - previewUrl
              - size
              - width
              - height
              - mimetype
            properties:
              url:
                type: string
                format: uri
              previewUrl:
                type:
                  - string
                  - 'null'
                format: uri
                description: Optional preview image URL for non-image outputs such as PDFs.
              size:
                type: integer
              width:
                type:
                  - integer
                  - 'null'
              height:
                type:
                  - integer
                  - 'null'
              mimetype:
                type: string
    ErrorResponse:
      type: object
      additionalProperties: false
      required:
        - message
      properties:
        message:
          type: string
    DesignModification:
      type: object
      additionalProperties: false
      required:
        - id
      properties:
        id:
          type: string
          description: Target object identifier inside the design JSON.
          example: title-text
        text:
          type: string
          description: Replacement text for a text object.
          example: Spring launch sale
        fill:
          type: string
          description: Fill or stroke color override.
          example: '#16a34a'
        stroke:
          type: string
          description: Stroke color override for supported objects.
          example: '#1c7ed6'
        src:
          type: string
          format: uri
          description: Replacement image source URL for an image object.
          example: https://images.example.com/hero.jpg
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Organization API key passed as a bearer token.

````