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

# Create a new image(새로운 이미지 생성)



## OpenAPI

````yaml https://beta.flamel.app/api-json post /api/images/create
openapi: 3.0.0
info:
  title: Flamel API 문서
  description: REST API 문서입니다. 발급받은 API키를 X-Api-Key 헤더에 넣은 뒤 api를 사용하면 됩니다.
  version: '1.1'
  contact: {}
servers:
  - url: http://localhost:4010
    description: Local
  - url: https://beta.flamel.app
    description: Beta
security: []
tags:
  - name: Flamel
    description: ''
paths:
  /api/images/create:
    post:
      tags:
        - images
      summary: Create a new image(새로운 이미지 생성)
      operationId: ImagesApiController_createImage
      parameters:
        - name: X-Type
          required: false
          in: header
          description: API Type(API 유형)
          schema:
            type: string
        - name: X-Platform
          in: header
          description: 플랫폼 구분 (web, app, figma)
          required: false
          schema:
            type: string
            enum:
              - web
              - app
              - figma
              - api
            default: web
      requestBody:
        required: true
        description: >-
          (Reference Image + Prompt) OR (Style + Prompt) OR (Collection ID +
          Prompt)(레퍼런스 이미지 + 프롬프트) OR (스타일 + 프롬프트) OR (컬렉션 아이디 + 프롬프트)
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/CreateImageWithRefDto'
                - $ref: '#/components/schemas/CreateImageWithStyleIdDto'
                - $ref: '#/components/schemas/CreateImageWithImageIdDto'
            examples:
              Reference+Prompt(레퍼런스이미지+프롬프트):
                value:
                  prompt: 이미지 캡션 변형
                  image: 1/reference-1423131.png
                  ratio: '1:1'
              Reference+Prompt(레퍼런스이미지+프롬프트(imageToPrompt 수행 후)):
                value:
                  captionPrompt: image caption
                  captionTPrompt: 이미지 캡션 번역
                  prompt: 이미지 캡션 변형
                  image: 1/reference-1423131.png
                  ratio: '1:1'
              Style ID+Prompt(스타일아이디+프롬프트):
                value:
                  prompt: a unicorn is attacking group of humans
                  styleId: 352
                  ratio: '1:1'
              Style ID+Prompt(스타일아이디+프롬프트(textToPrompt 수행 후)):
                value:
                  initialPrompt: 초기프롬프트
                  enhancedPrompt: gpt프롬프트
                  prompt: a unicorn is attacking group of humans
                  styleId: 352
                  ratio: '1:1'
              Image ID+Prompt(컬렉션 이미지 기반 생성):
                value:
                  prompt: a unicorn is attacking group of humans
                  imageId: 123
                  ratio: '1:1'
      responses:
        '201':
          description: Array of Generated Images(생성된 이미지들의 배열)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateImageResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              examples:
                InvalidPrompts:
                  summary: Harmful Expression(유해표현)
                  value:
                    success: false
                    code: 400
                    data: invalid_prompts
                NSFW:
                  summary: NSFW(NSFW 이미지)
                  value:
                    success: false
                    code: 400
                    data: nsfw_image
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                InvalidApiKey:
                  summary: Invalid API KEY(API KEY 틀림)
                  value:
                    success: false
                    code: 401
                    data: wrong_api_key
                ApiKeyExpired:
                  summary: API KEY Expired(API KEY 만료)
                  value:
                    success: false
                    code: 401
                    data: api_key_expired
        '403':
          description: Forbidden
          content:
            application/json:
              examples:
                NotLoggedIn:
                  summary: Not Logged In(로그인되어있지 않음)
                  value:
                    success: false
                    code: 403
                    data: not_logged_in
                NotEnoughCredit:
                  summary: Not Enough Credit(크레딧 부족)
                  value:
                    success: false
                    code: 403
                    data: not_enough_credit
                PremiumCollectionForbidden:
                  summary: Premium Collection Unavailable(프리미엄컬렉션사용불가)
                  value:
                    success: false
                    code: 403
                    data: premium_collection(:imageId)
                FailedPaymentUser:
                  summary: Failed Payment User(결제 실패자)
                  value:
                    success: false
                    code: 403
                    data: failed_billing
                NeedUpgrade:
                  summary: Need to Upgrade to Pro(pro로 업그레이드 필요)
                  value:
                    success: false
                    code: 403
                    data: need_upgrade
                SimultaneousGenerationLimit:
                  summary: Simultaneous Generation Limit(동시 생성 제한)
                  value:
                    success: false
                    code: 403
                    data: simultaneous_generation_limit
                NotOwnedStyle:
                  summary: Not Owned Style(소유하지 않은 스타일)
                  value:
                    success: false
                    code: 403
                    data: not_owned_style
        '404':
          description: Not Found
          content:
            application/json:
              examples:
                NoStyle:
                  summary: Style Does Not Exist(스타일 존재 안 함)
                  value:
                    success: false
                    code: 404
                    data: no_style_with_that_id (:styleId)
                NoInputImage:
                  summary: Image Does Not Exist(이미지 존재 안 함)
                  value:
                    success: false
                    code: 404
                    data: no_input_image (:imageId)
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              examples:
                MissingDynamicParams:
                  summary: Missing Category Parameters(카테고리 params 누락)
                  value:
                    success: false
                    code: 422
                    data: missing_dynamic_params
                NoRefStyle:
                  summary: REF Category Missing(REF 카테고리 누락)
                  value:
                    success: false
                    code: 422
                    data: no_ref_style_in_admin
                NoB2BStyle:
                  summary: B2B Style Missing(B2B 스타일 누락)
                  value:
                    success: false
                    code: 422
                    data: >-
                      no b2b style(:styleId) in admin for user(:userId). If you
                      are sure it exists, check :bool is true
                NoEnabledStyle:
                  summary: Enabled Sub-category Missing(활성화된 소분류 누락)
                  value:
                    success: false
                    code: 422
                    data: >-
                      no_enabled_style_in_admin (:sup, :main). If exists, check
                      enabled is true
                UnknownModel:
                  summary: Model Not Registered in Admin(어드민에 등록되지 않은 모델)
                  value:
                    success: false
                    code: 422
                    data: unknown_model (:model)
      security:
        - apiKey: []
components:
  schemas:
    CreateImageWithRefDto:
      type: object
      properties:
        randomPrompt:
          type: string
          description: 랜덤 프롬프트
          example: a unicorn is attacking group of humans
        initialPrompt:
          type: string
          description: 초기 유저 프롬프트(텍스트2프롬프트 이전)
          example: a unicorn is attacking group of humans
        enhancedPrompt:
          type: string
          description: 텍스트2프롬프트 이후
          example: a unicorn is attacking group of humans
        captionPrompt:
          type: string
          description: img2prompt
          example: a unicorn is attacking group of humans
        captionTPrompt:
          type: string
          description: img2prompt 번역
          example: 유니콘이 인간 그룹을 공격하고 있다.
        prompt:
          type: string
          maxLength: 1200
          description: 프롬프트
          example: 유니콘이 인간 그룹과 뛰어놀고 있다
        ratio:
          type: string
          description: 비율
          enum:
            - square
            - vertical
            - horizontal
            - '1:1'
            - '3:4'
            - '4:3'
            - '9:16'
            - '16:9'
        groupId:
          type: string
          description: 그룹아이디
        sample:
          type: number
          default: 4
          enum:
            - 1
            - 2
            - 4
          description: 생성 개수
        async:
          type: boolean
          default: false
          description: 비동기 생성 여부
          example: false
        image:
          type: string
          description: 이미지 경로
          example: 1/reference-1423131.png
      required:
        - prompt
        - ratio
        - image
    CreateImageWithStyleIdDto:
      type: object
      properties:
        randomPrompt:
          type: string
          description: 랜덤 프롬프트
          example: a unicorn is attacking group of humans
        initialPrompt:
          type: string
          description: 초기 유저 프롬프트(텍스트2프롬프트 이전)
          example: a unicorn is attacking group of humans
        enhancedPrompt:
          type: string
          description: 텍스트2프롬프트 이후
          example: a unicorn is attacking group of humans
        captionPrompt:
          type: string
          description: img2prompt
          example: a unicorn is attacking group of humans
        captionTPrompt:
          type: string
          description: img2prompt 번역
          example: 유니콘이 인간 그룹을 공격하고 있다.
        prompt:
          type: string
          maxLength: 1200
          description: 프롬프트
          example: 유니콘이 인간 그룹과 뛰어놀고 있다
        ratio:
          type: string
          description: 비율
          enum:
            - square
            - vertical
            - horizontal
            - '1:1'
            - '3:4'
            - '4:3'
            - '9:16'
            - '16:9'
        groupId:
          type: string
          description: 그룹아이디
        sample:
          type: number
          default: 4
          enum:
            - 1
            - 2
            - 4
          description: 생성 개수
        async:
          type: boolean
          default: false
          description: 비동기 생성 여부
          example: false
        styleId:
          type: number
          description: 스타일 아이디
          example: 12
        imageId:
          type: number
          description: 컬렉션 이미지 아이디
          example: 234
      required:
        - prompt
        - ratio
        - styleId
    CreateImageWithImageIdDto:
      type: object
      properties:
        randomPrompt:
          type: string
          description: 랜덤 프롬프트
          example: a unicorn is attacking group of humans
        initialPrompt:
          type: string
          description: 초기 유저 프롬프트(텍스트2프롬프트 이전)
          example: a unicorn is attacking group of humans
        enhancedPrompt:
          type: string
          description: 텍스트2프롬프트 이후
          example: a unicorn is attacking group of humans
        captionPrompt:
          type: string
          description: img2prompt
          example: a unicorn is attacking group of humans
        captionTPrompt:
          type: string
          description: img2prompt 번역
          example: 유니콘이 인간 그룹을 공격하고 있다.
        prompt:
          type: string
          maxLength: 1200
          description: 프롬프트
          example: 유니콘이 인간 그룹과 뛰어놀고 있다
        ratio:
          type: string
          description: 비율
          enum:
            - square
            - vertical
            - horizontal
            - '1:1'
            - '3:4'
            - '4:3'
            - '9:16'
            - '16:9'
        groupId:
          type: string
          description: 그룹아이디
        sample:
          type: number
          default: 4
          enum:
            - 1
            - 2
            - 4
          description: 생성 개수
        async:
          type: boolean
          default: false
          description: 비동기 생성 여부
          example: false
        imageId:
          type: number
          description: 컬렉션 이미지 아이디
          example: 234
      required:
        - prompt
        - ratio
        - imageId
    CreateImageResponseDto:
      type: object
      properties:
        images:
          description: Image Array(이미지 배열)
          type: array
          items:
            $ref: '#/components/schemas/CreatedImageDto'
        defaultCredit:
          type: number
          description: Charge Credit(충전 크레딧)
        dailyCredit:
          type: number
          description: Daily Credit(일일 크레딧)
        monthlyCredit:
          type: number
          description: Monthly Credit(월간 크레딧)
      required:
        - images
        - defaultCredit
        - dailyCredit
        - monthlyCredit
    CreatedImageDto:
      type: object
      properties:
        imageId:
          type: number
          description: ID(아이디)
        createdAt:
          format: date-time
          type: string
          description: Creation Date(생성 일시)
        generationStatus:
          type: string
          description: Generation Status(생성 상태)
          enum:
            - PENDING
            - COMPLETED
            - FAILED
          nullable: true
          default: COMPLETED
        generationError:
          type: string
          description: Generation Error(생성 에러 메시지)
          nullable: true
        resolution:
          type: string
          pattern: /\d{3,4}x\d{3,4}/
          description: Resolution(해상도)
          example: 512x512
        ownerId:
          type: number
          description: Owner ID(소유자 아이디)
        etc:
          type: string
          description: Other Information(기타 정보)
        bookmarked:
          type: boolean
          description: Bookmark Status(북마크 여부)
          example: false
        base64:
          type: string
          description: Image webp base64(이미지 webp base64)
        mimeType:
          type: string
          description: Image mimeType(이미지 mimeType)
          example: image/webp
        Bought:
          type: array
          description: Purchase History(구매내역)
          items:
            type: string
          example: []
          maxItems: 0
        Bookmarks:
          type: array
          description: Bookmark History(북마크내역)
          items:
            type: string
          example: []
          maxItems: 0
        Upscaled:
          description: Upscale History(업스케일 내역)
          type: array
          items:
            $ref: '#/components/schemas/CollectionUpscaleInfoDto'
        GenerationInfo:
          description: Generation Information(생성 정보)
          allOf:
            - $ref: '#/components/schemas/PickTypeClass'
      required:
        - imageId
        - createdAt
        - generationStatus
        - generationError
        - resolution
        - ownerId
        - etc
        - bookmarked
        - base64
        - mimeType
        - Bought
        - Bookmarks
        - Upscaled
        - GenerationInfo
    CollectionUpscaleInfoDto:
      type: object
      properties:
        imageId:
          type: number
          description: 이미지 아이디
        type:
          type: string
          description: 업스케일 유형
          enum:
            - upscale
            - enhance
        scaleSize:
          type: string
          pattern: /\dx/
          description: 스케일 사이즈
          example:
            - 1x
            - 2x
            - 4x
            - 8x
        Image:
          $ref: '#/components/schemas/CollectionUpscaleInfoImageDto'
      required:
        - imageId
        - type
        - scaleSize
    PickTypeClass:
      type: object
      properties:
        originalPrompt:
          type: string
          description: Original Prompt(원본 프롬프트)
        super:
          type: string
          description: Super Category Code(대분류코드)
        main:
          type: string
          description: Main Category Code(중분류코드)
        variationId:
          type: number
          description: Variation Original ID(배리에이션 원본 아이디)
        groupId:
          type: string
          description: Group ID(그룹아이디)
        blurReason:
          type: string
          description: Blur Image Status(블러이미지 여부(블러이미지면 버튼 표시하면 안 됨))
      required:
        - originalPrompt
        - super
        - main
        - variationId
        - groupId
        - blurReason
    CollectionUpscaleInfoImageDto:
      type: object
      properties:
        DownloadLog:
          type: array
          items:
            $ref: '#/components/schemas/CollectionUpscaleInfoImageDownloadLogDto'
        CollectionInfo:
          $ref: '#/components/schemas/CollectionUpscaleInfoImageCollectionInfoDto'
      required:
        - DownloadLog
    CollectionUpscaleInfoImageDownloadLogDto:
      type: object
      properties:
        userId:
          type: number
          description: 유저 아이디
        imageId:
          type: number
          description: 이미지 아이디
      required:
        - userId
        - imageId
    CollectionUpscaleInfoImageCollectionInfoDto:
      type: object
      properties:
        enabled:
          type: boolean
          description: 컬렉션 여부
      required:
        - enabled
  securitySchemes:
    apiKey:
      type: apiKey
      name: X-Api-Key
      in: header

````