> ## 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.

# Midjourney 局部重绘 API 文档

> 使用 Midjourney 局部重绘接口修改图片指定区域，适合细节修复、局部替换和图像精修工作流。



## OpenAPI

````yaml openapi/cn/midjourney.json POST /midjourney/v1/inpaint
openapi: 3.1.0
info:
  title: TTAPI API DOCS
  version: 1.0.0
  description: Midjourney 图片生成相关接口
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /midjourney/v1/inpaint:
    post:
      description: 区域重绘，等同midjourney的Vary(region)按钮
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InpaintRequest'
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  schemas:
    InpaintRequest:
      type: object
      properties:
        jobId:
          type: string
          description: 上一步请求返回的jobId
        mask:
          type: string
          description: >-
            所选择图片的Base64值；提交的base64内容 是一张跟原图尺寸一样的黑白通道的蒙版（就是图中只包括黑色与白色）
            其中白色部分是重绘圈出来的部分 其余部分是黑色；该base64值无需 “data:image/png;base64,”前缀
        prompt:
          type: string
          description: 对所选择图片区域想要修改的描述
        timeout:
          type: integer
          example: '300'
          description: 任务超时时间，单位：秒，范围 300 - 1200。fast与turbo模式下默认最小值为300，relax模式下默认最小值为600。
        hookUrl:
          type: string
          description: 回调通知地址
      required:
        - jobId
        - mask
  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 密钥。

````