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

# Inpainting

> This endpoint generates and returns an image from an image and a mask passed with their URLs in the request

<Tip>
  Together with the image and the mask you can add your description of the desired result by passing prompt and negative prompt.
</Tip>

### Inpaintin

<img src="https://mintcdn.com/mod/i8dYICFkuz1vpdrI/images/image-editing/assets/images/Realtime-inpainting-620336ac69c1ce8e66904c1d1942eebc.jpg?fit=max&auto=format&n=i8dYICFkuz1vpdrI&q=85&s=b50c9814c648f346911037005c4b50d5" alt="Inpainting endpoint result" width="691" height="518" data-path="images/image-editing/assets/images/Realtime-inpainting-620336ac69c1ce8e66904c1d1942eebc.jpg" />

## Request

Make a `POST` request to below endpoint and pass the required parameters as a request body.

```curl curl theme={null}
--request POST 'https://modelslab.com/api/v6/image_editing/inpaint' \
```

## Body

```json json theme={null}
{  
    "key": "your_api_key",  
    "prompt": "a cat sitting on a bench",  
    "negative_prompt": null,  
    "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png",  
    "mask_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png",  
    "width": "512",  
    "height": "512",  
    "samples": 1,  
    "num_inference_steps": "30",  
    "safety_checker": "no", 
    "guidance_scale": 5,  
    "strength": 0.7,  
    "base64": false,  
    "seed": null,  
    "webhook": null,  
    "track_id": null
}
```


## OpenAPI

````yaml POST /image_editing/inpaint
openapi: 3.1.0
info:
  title: ModelsLab Image Editing API
  description: >-
    Image editing endpoints for ModelsLab API including background removal,
    super resolution, face generation, fashion try-on, and various image
    manipulation tools
  license:
    name: MIT
  version: 6.0.0
servers:
  - url: https://modelslab.com/api/v6
    description: Image Editing API v6 server
security: []
paths:
  /image_editing/inpaint:
    post:
      summary: Image inpainting
      description: >-
        This endpoint generates and returns an image from an image and a mask
        passed with their URLs in the request
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InpaintRequest'
      responses:
        '200':
          description: Inpainting response
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ImageEditingSuccessResponse'
                  - $ref: '#/components/schemas/ImageEditingProcessingResponse'
                  - $ref: '#/components/schemas/ImageEditingErrorResponse'
components:
  schemas:
    InpaintRequest:
      type: object
      required:
        - key
        - prompt
        - init_image
        - mask_image
      properties:
        key:
          type: string
          description: Your API Key used for request authorization
        prompt:
          type: string
          description: Text prompt describing the content you want in the generated image
        negative_prompt:
          type: string
          description: Items you do not want in the image
        init_image:
          type: string
          format: uri
          description: Link to the initial image
        mask_image:
          type: string
          format: uri
          description: Link to the mask image for inpainting
        width:
          type: integer
          default: 512
          maximum: 1024
          description: >-
            The width of the generated images, If not provided, the width of
            init_image is used
        height:
          type: integer
          default: 512
          maximum: 1024
          description: >-
            The height of the generated images, If not provided, the height of
            init_image is used
        samples:
          type: integer
          default: 1
          maximum: 4
          description: Number of images to be returned in response
        num_inference_steps:
          type: integer
          default: 30
          description: Number of denoising steps
        safety_checker:
          type: string
          default: 'no'
          enum:
            - 'yes'
            - 'no'
          description: A checker for NSFW images
        guidance_scale:
          type: integer
          default: 5
          minimum: 1
          maximum: 5
          description: Scale for classifier-free guidance
        strength:
          type: number
          default: 0.7
          minimum: 0
          maximum: 1
          description: Prompt strength when using the initial image
        instant_response:
          type: string
          enum:
            - 'true'
            - 'false'
          default: 'false'
          description: Set to true for instant queue response
        base64:
          type: string
          enum:
            - 'true'
            - 'false'
          default: 'false'
          description: Set to true to get response as base64 string
        seed:
          type: integer
          description: Seed used to reproduce results
        webhook:
          type: string
          format: uri
          description: URL to receive POST API call when complete
        track_id:
          type: integer
          description: ID for webhook identification
    ImageEditingSuccessResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
        generationTime:
          type: number
          description: Time taken to generate the image in seconds
        id:
          type: integer
          description: Unique identifier for the generation request
        output:
          type: array
          items:
            type: string
            format: uri
          description: Array of generated image URLs
        proxy_links:
          type: array
          items:
            type: string
            format: uri
          description: Array of proxy image URLs
        meta:
          type: object
          description: Metadata about the generation process
          additionalProperties: true
    ImageEditingProcessingResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - processing
        tip:
          type: string
          description: Information about the processing status
        eta:
          type: integer
          description: Estimated time remaining in seconds
        message:
          type: string
          description: Processing status message
        fetch_result:
          type: string
          format: uri
          description: URL to fetch the result when ready
        id:
          type: integer
          description: Unique identifier for the generation request
        output:
          type: array
          items:
            type: string
          description: Empty array during processing
        future_links:
          type: array
          items:
            type: string
            format: uri
          description: Array of future image URLs
        proxy_links:
          type: array
          items:
            type: string
            format: uri
          description: Array of proxy image URLs
        meta:
          type: object
          description: Metadata about the generation process
          additionalProperties: true
    ImageEditingErrorResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - error
        message:
          type: string
          description: Error message describing what went wrong

````