# AI Replace

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/aiart/replacer:
    post:
      summary: AI Replace
      deprecated: false
      description: >
        ---


        ## 🎨 Partial Image Replacement (Inpainting)


        The **Partial Image Replacement** feature allows you to selectively
        modify a specific region of an image using a **mask** and a **text
        prompt**. Simply define the area you want to change with a mask image,
        describe the desired content, and the model will intelligently fill in
        the masked region based on your prompt — while keeping the rest of the
        image untouched.


        ### ✨ How It Works


        - **`imageUrl`**: Original image to be modified.

        - **`maskImageUrl`**: Mask image that defines the area to be replaced.
        Supports both base64 and image URL.

        - **`content`**: Text prompt that describes the desired replacement in
        the masked region.


        ---


        ### 🖼️ Example


        | Original Image | Mask Image | Prompt | Result |

        |----------------|------------|--------|--------|

        |
        ![Original](https://u-static.fotor.com/uid_0f5eccd484e6403084043fd20e320027/image_to_image/app-fotor-web/e09b6003-020f-444c-9472-884e56ea50e9.jpeg)
        |
        ![Mask](https://u-static.fotor.com/uid_0f5eccd484e6403084043fd20e320027/image_to_image/app-fotor-web/0dc32dbd-8ee9-4216-b9dc-71cd48e4acf0.jpeg)
        | `"Butterfly"` |
        ![Result](https://u-static.haozhaopian.net/uid_0f5eccd484e6403084043fd20e320027/ai-replacer/a13e4a7c1e4545fe9aeac3987095b513.jpg)
        |


        ---
      tags:
        - Reference
      parameters:
        - name: Authorization
          in: header
          description: ''
          required: true
          example: Bearer <your api key>
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                imageUrl:
                  type: string
                  description: >-
                    The URL or BASE64 encoded image of the initial image
                    provided by the user.
                content:
                  type: string
                  description: >-
                    Describe what you want to appear in the masked area — this
                    prompt tells the model how to modify just that part of the
                    image.
                maskImageUrl:
                  type: string
                  description: >-
                    Specifies a mask image used to define the regions for
                    partial replacement in the source image. Accepts either a
                    base64-encoded image string or a publicly accessible image
                    URL.
              required:
                - imageUrl
                - content
                - maskImageUrl
              x-apifox-orders:
                - imageUrl
                - content
                - maskImageUrl
            example:
              imageUrl: >-
                https://u-static.fotor.com/uid_0f5eccd484e6403084043fd20e320027/image_to_image/app-fotor-web/e09b6003-020f-444c-9472-884e56ea50e9.jpeg
              content: Butterfly
              maskImageUrl: >-
                https://u-static.fotor.com/uid_0f5eccd484e6403084043fd20e320027/image_to_image/app-fotor-web/0dc32dbd-8ee9-4216-b9dc-71cd48e4acf0.jpeg
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: '000: Success，999: Unknown error'
                    x-apifox-mock: '000'
                    examples:
                      - '000'
                  msg:
                    type: string
                    x-apifox-mock: success
                    examples:
                      - success
                  data:
                    type: object
                    properties:
                      taskId:
                        type: string
                        description: Task ID, used to query task information.
                        x-apifox-mock: e0dc194703174b6eafeacb4ee8e02850
                        examples:
                          - e0dc194703174b6eafeacb4ee8e02850
                    required:
                      - taskId
                    x-apifox-orders:
                      - taskId
                required:
                  - code
                  - msg
                  - data
                x-apifox-orders:
                  - code
                  - msg
                  - data
          headers: {}
          x-apifox-name: success
      security: []
      x-apifox-folder: Reference
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/5562290/apis/api-240777227-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api-b.fotor.com
    description: 正式环境
security: []

```
