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

# Image to Image

> This endpoint generates and returns an image from an image passed with its URL in the request.

<Warning>
  Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `realtime` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours**
</Warning>

<img src="https://mintcdn.com/mod/Xe_I2k0P2zG5615S/images/enterprise-api/realtime/assets/images/Realtime-Image-to-image-9643cb98e1b294f96c3c632d9e6202fd.jpg?fit=max&auto=format&n=Xe_I2k0P2zG5615S&q=85&s=662f08a0995737f5753b5ed416a12e65" alt="Image to image endpoint result" width="691" height="518" data-path="images/enterprise-api/realtime/assets/images/Realtime-Image-to-image-9643cb98e1b294f96c3c632d9e6202fd.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/v1/enterprise/realtime/img2img' \
```

## Body

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

}
```

## Body Attributes

<ParamField query="key" type="string" required>
  Your API Key used for request authorization.
</ParamField>

<ParamField query="prompt" type="string" required>
  Text prompt with description of the things you want in the image to be generated.
</ParamField>

<ParamField query="negative_prompt" type="string">
  Items you don't want in the image.
</ParamField>

<ParamField query="init_image" type="string" format="url">
  Link to the Initial Image.
</ParamField>

<ParamField query="width" type="integer" max="1024">
  Width of the image. Maximum allowed: 1024.
</ParamField>

<ParamField query="height" type="integer" max="1024">
  Height of the image. Maximum allowed: 1024.
</ParamField>

<ParamField query="samples" type="integer" max="4">
  Number of images to be returned in response. Maximum: 4.
</ParamField>

<ParamField query="safety_checker" type="boolean" default="true">
  A checker for NSFW images. If such an image is detected, it will be replaced by a blank image.
</ParamField>

<ParamField query="base64" type="boolean" default="false">
  Get response as base64 string. Options: `true` or `false`.
</ParamField>

<ParamField query="strength" type="number" min="0.0" max="1.0">
  Prompt strength when using init image. 1.0 corresponds to full destruction of information in the init image.
</ParamField>

<ParamField query="instant_response" type="boolean" default="false">
  Queue response instantly before processing finishes instead of waiting. Options: `true` or `false`.
</ParamField>

<ParamField query="seed" type="integer" nullable="true">
  Seed is used to reproduce results. Pass `null` for a random number.
</ParamField>

<ParamField query="enhance_prompt" type="boolean">
  Enhance prompts for better results. Options: `true` or `false`.
</ParamField>

<ParamField query="webhook" type="string" format="url">
  Set a URL to get a POST API call once the image generation is complete.
</ParamField>

<ParamField query="track_id" type="string">
  This ID is returned in the response to the webhook API call. This will be used to identify the webhook request.
</ParamField>
