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

# Text to Image

> Create images with text prompt



## OpenAPI

````yaml POST /v1/jobs/gen2/text2image
openapi: 3.0.1
info:
  title: OpenAPI Plant Store
  description: >-
    A sample API that uses a plant store as an example to demonstrate features
    in the OpenAPI specification
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.haiper.ai
security:
  - bearerAuth: []
paths:
  /v1/jobs/gen2/text2image:
    post:
      description: Create images with text prompt
      requestBody:
        description: The information to create images
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Text2image'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NewCreation'
        '400':
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Text2image:
      allOf:
        - required:
            - prompt
          type: object
          properties:
            is_public:
              description: >-
                Whether is generation be public on Haiper Platform, please set
                to false if you will to keep it private. The default value is
                true
              type: boolean
            is_enable_prompt_enhancer:
              description: >-
                Whether let AI help you to enhance the prompt. The default value
                is true
              type: boolean
            prompt:
              description: The prompt of the generation
              type: string
            negative_prompt:
              description: The negative prompt of the generation
              type: string
            config:
              properties:
                image_number:
                  description: 'default: 4, could be 1,2,3,4'
                  type: number
            settings:
              type: object
              properties:
                seed:
                  description: 'Default: -1'
                  type: number
                aspect_ratio:
                  description: >-
                    The proportional relationship between the width and height
                    of the image .Default '16:9', valid: '21:9', '16:9', '9:16',
                    '3:4', '4:3', '1:1'
                  type: string
                resolution:
                  description: 'Default 720, valid: 720, 1080, 2160'
                  type: number
    NewCreation:
      required:
        - status
      type: object
      properties:
        status:
          description: ''
          type: string
        value:
          description: ''
          type: object
          properties:
            generation_id:
              description: ''
              type: string
    Error:
      required:
        - error
      type: object
      properties:
        message:
          type: string
        code:
          type: integer
          format: int32
        details:
          type: array
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````