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

# Midjourney Inpainting

Use Midjourney inpainting to redraw specified areas of a generated image. You can specify the inpainting area using polygon regions or a black-and-white mask image. This API uses asynchronous processing, and the client needs to query the final generated result via `task_id`.

## Request Headers

<ParamField header="Content-Type" type="string" required={true}>
  Enum value: `application/json`
</ParamField>

<ParamField header="Authorization" type="string" required={true}>
  Bearer authentication format: Bearer \{\{API key}}.
</ParamField>

## Request Body

<ParamField body="image_no" type="integer" required={true}>
  Image number, used to specify the image to inpaint.

  Value range: 0\~3
</ParamField>

<ParamField body="task_id" type="string" required={true}>
  Unique identifier of the original image generation task.
</ParamField>

<ParamField body="remix_prompt" type="string" required={false}>
  Inpainting prompt, used to describe the desired content for the inpainted area.

  Length limit: 1-8192 characters.
</ParamField>

<ParamField body="mask" type="object" required={true}>
  Inpainting area configuration. Replaces the area parameter and supports multi-region inpainting. Choose either areas or url.

  <Expandable title="Properties" defaultOpen={false}>
    <ParamField body="url" type="string" required={false}>
      Specify polygon regions using a black-and-white binary image. Multiple regions are supported; white areas are the inpainting regions.
    </ParamField>

    <ParamField body="areas" type="object[]" required={false}>
      Polygon region array. Multiple regions are supported.

      <Expandable title="InpaintArea Properties" defaultOpen={false}>
        <ParamField body="points" type="number[]" required={true}>
          Array of coordinate points for the polygon region, with the top-left corner as the origin, organized clockwise in XYXY format.
        </ParamField>

        <ParamField body="width" type="float" required={true}>
          Image width in pixels.

          Value range: 500\~4096
        </ParamField>

        <ParamField body="height" type="float" required={true}>
          Image height in pixels.

          Value range: 500\~4096
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="area" type="object" required={true}>
  Single polygon region configuration (use either this parameter or the mask parameter).

  <Expandable title="Properties" defaultOpen={false}>
    <ParamField body="points" type="number[]" required={true}>
      Array of coordinate points for the polygon region, with the top-left corner as the origin, organized clockwise in XYXY format.
    </ParamField>

    <ParamField body="width" type="float" required={true}>
      Image width in pixels.

      Value range: 500\~4096
    </ParamField>

    <ParamField body="height" type="float" required={true}>
      Image height in pixels.

      Value range: 500\~4096
    </ParamField>
  </Expandable>
</ParamField>

## Response Parameters

<ResponseField name="task_id" type="string" required={true}>
  The `task_id` of the asynchronous task. You should use this `task_id` to request the [Query Task Result API](/en/docs/models/reference-get-async-task-result) to obtain the generated result.
</ResponseField>
