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

# Midjourney Inpaint

Use the Midjourney Inpaint feature to repaint a specified region of a generated image. Supports specifying the repaint region via polygon areas or black-and-white mask images. This endpoint uses async processing; the client needs to query the final result using the task\_id.

## Request Headers

<ParamField header="Content-Type" type="string" required={true}>
  Enum: `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 which image to inpaint.

  Range: 0\~3
</ParamField>

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

<ParamField body="remix_prompt" type="string" required={false}>
  Inpaint region prompt, used to describe the desired content for the repainted region.

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

<ParamField body="mask" type="object" required={true}>
  Repaint region 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}>
      A black-and-white binary image specifying polygon regions; supports specifying multiple regions. The white region is the repaint region.
    </ParamField>

    <ParamField body="areas" type="array" required={false}>
      Array of polygon regions; supports specifying multiple regions.

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

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

          Range: 500\~4096
        </ParamField>

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

          Range: 500\~4096
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

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

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

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

      Range: 500\~4096
    </ParamField>

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

      Range: 500\~4096
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="task_id" type="string" required={true}>
  The task\_id of the async task. Use the task\_id to call the [Get Async Task Result API](/docs/models/reference-get-async-task-result) to retrieve the generated result.
</ResponseField>
