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

# 编辑图像

> 根据图像与描述词生成四张图像，该接口为**异步任务**

<Note>
  由于Midjourney官方编辑图片自带裁剪功能，所以实际支持的可编辑图片有固定比例，目前支持的比例范围为 **1:1, 1:2, 2:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9**，如上传图片不在给定比例范围内，系统会自动调整至合适比例生成新图。
</Note>


## OpenAPI

````yaml openapi/cn/midjourneyedit.json POST /midjourney/image-edits/submit
openapi: 3.1.0
info:
  title: Midjourney Edit API DOCS
  version: 1.0.0
  description: Midjourney 图片修改相关接口
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /midjourney/image-edits/submit:
    post:
      description: 根据图像与描述词生成四张图像，该接口为**异步任务**
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageeditsRequest'
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  schemas:
    ImageeditsRequest:
      type: object
      properties:
        prompt:
          type: string
          description: 用于修改图片的提示，Midjourney支持多语言，实测英文效果最佳。
        image:
          type: string
          description: >-
            图像文件 支持 url 和 base64 文件，仅支持 png, jpg, jpeg, bmp, webp <br/>
            注意：图片中需要修改的部分为**透明区域**，如示例所示。
          enum:
            - >-
              https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png
        mode:
          type: string
          description: 编辑图片的速率模式
          enum:
            - relax
            - fast
            - turbo
          default: fast
        type:
          type: string
          description: 编辑类型
          enum:
            - edit
            - retexture
          default: edit
        hookUrl:
          type: string
          description: >-
            回调地址，任务完成或失败将通过请地址进行通知，如果未设置，则需要请求 <a href="fetch"
            target="_self">获取任务状态接口</a>进行查询
      required:
        - prompt
        - image
  responses:
    SuccessResponse:
      description: 请求成功
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: SUCCESS
              message:
                type: string
                example: success
              data:
                type: object
                example:
                  jobId: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            required:
              - status
              - message
              - data
    400Response:
      description: 参数错误
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: '"prompt" cannot be empty.'
              data:
                type: object
            required:
              - status
              - message
    401Response:
      description: 授权失败
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: Wrong TT-API-KEY or email is not activated.
            required:
              - status
              - message
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        请前往 <a href='https://dashboard.ttapi.io' target='_blank'>TTAPI 控制台</a>
        获取 API 密钥。

````