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

# Generate Images

> Create one or more image generation jobs in an existing project. The API returns image IDs immediately; poll each ID for status.



## OpenAPI

````yaml /openapi.json post /v1/images/generate
openapi: 3.1.0
info:
  title: TurboAds Public API
  version: 1.0.0
  description: >-
    Workspace-scoped API for creating media generation jobs and polling for
    results.
servers:
  - url: https://api.turboads.ai
security:
  - bearerAuth: []
tags:
  - name: Projects
    description: Discover projects available to the API key workspace.
  - name: Voices
    description: Discover voices for talking actor generations.
  - name: Actors
    description: Discover actors for talking actor generations.
  - name: Images
    description: Create image generation jobs, poll status, and fetch final URLs.
  - name: Videos
    description: Create video generation jobs, poll status, and fetch final URLs.
  - name: Replace Actors
    description: Create motion-transfer jobs from a character image and reference video.
  - name: Talking Actors
    description: Create AI actor videos, poll status, and fetch final URLs.
paths:
  /v1/images/generate:
    post:
      tags:
        - Images
      summary: Generate Images
      description: >-
        Create one or more image generation jobs in an existing project. The API
        returns image IDs immediately; poll each ID for status.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageGenerationRequest'
            example:
              project_id: j97project123abc456def789
              prompt: >-
                A cinematic product photo of a skincare bottle on a marble
                counter
              model: nano-banana-2
              aspect_ratio: '1:1'
              count: 1
      responses:
        '200':
          description: Image generation jobs created
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/ImageGenerationCreateResponse'
              examples:
                success:
                  summary: Success
                  value:
                    data:
                      ids:
                        - j97image123abc456def789
                      status: pending
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    ImageGenerationRequest:
      type: object
      required:
        - project_id
        - prompt
        - model
        - aspect_ratio
        - count
      properties:
        project_id:
          type: string
          description: Existing project ID in the API key workspace.
        prompt:
          type: string
          description: Text prompt describing the image to generate.
        model:
          type: string
          enum:
            - nano-banana-2
            - gpt-image-1.5
            - seedream-4.5
        aspect_ratio:
          type: string
          enum:
            - '1:1'
            - '9:16'
            - '16:9'
        count:
          type: integer
          minimum: 1
          maximum: 10
          description: Number of images to create.
        reference_file_ids:
          type: array
          items:
            type: string
          description: Completed image file upload IDs to use as reference images.
    ImageGenerationCreateResponse:
      type: object
      required:
        - ids
        - status
      properties:
        ids:
          type: array
          items:
            type: string
          description: Generated image IDs. Poll each ID separately.
        status:
          type: string
          enum:
            - pending
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
    RateLimitErrorResponse:
      type: object
      required:
        - error
        - retry_after_ms
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
        retry_after_ms:
          type: number
          description: Milliseconds to wait before retrying.
    ApiError:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable machine-readable error code.
        message:
          type: string
          description: Human-readable error message.
  responses:
    BadRequest:
      description: The request body or parameters are invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            error:
              summary: Required fields are missing or malformed.
              value:
                error:
                  code: invalid_request
                  message: Required fields are missing or malformed.
    Unauthorized:
      description: The API key is missing, invalid, or revoked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            error:
              summary: Missing, invalid, or revoked API key.
              value:
                error:
                  code: unauthorized
                  message: Missing, invalid, or revoked API key.
    PaymentRequired:
      description: The workspace does not have enough credits for the requested generation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            error:
              summary: Insufficient credits.
              value:
                error:
                  code: insufficient_credits
                  message: 'Insufficient credits. Required: 8, Available: 2'
    Forbidden:
      description: The requested project is outside the API key workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            error:
              summary: Project does not belong to this API key workspace.
              value:
                error:
                  code: forbidden
                  message: Project does not belong to this API key workspace.
    NotFound:
      description: The requested resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            error:
              summary: Resource not found.
              value:
                error:
                  code: not_found
                  message: Resource not found.
    RateLimited:
      description: The API key exceeded its rate limit.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitErrorResponse'
          examples:
            error:
              summary: Rate limited
              value:
                error:
                  code: rate_limited
                  message: Rate limit exceeded.
                retry_after_ms: 1200
    InternalServerError:
      description: Unexpected server or storage configuration error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            error:
              summary: Internal server error
              value:
                error:
                  code: internal_error
                  message: Something went wrong.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your TurboAds API key
      x-default: ta_live_your_api_key

````