---
title: "Image-to-image with a mask"
method: POST
path: "/v1/generation/{engine_id}/image-to-image/masking"
tags: ["Version1.Image"]
---

# Image-to-image with a mask

`POST /v1/generation/{engine_id}/image-to-image/masking`

Selectively modify portions of an image using a mask. The `mask` must be the same shape and size as the init image. This endpoint also supports `image` parameters with alpha channels.  See below for more details. 

> NOTE: Only **Version 1** engines will work with this endpoint.

## Path parameters

- `engine_id` string, required

## Headers

- `Organization` string
- `Stability-Client-ID` string
- `Stability-Client-Version` string

## Response `200`

Generation successful.

- object — An array of results from the generation request, where each image is a base64 encoded PNG.
  - `artifacts` Image[]
    - `base64` string — Image encoded in base64
    - `finishReason` 'SUCCESS' | 'ERROR' | 'CONTENT_FILTERED'
    - `seed` number — The seed associated with this image

## Other responses

- `400` — bad_request: one or more parameters were invalid.
- `401` — unauthorized: API key missing or invalid
- `403` — permission_denied: You lack the necessary permissions to perform this action
- `404` — not_found: The requested resource/engine was not found
- `500` — server_error: Some unexpected server error occurred

---

[API](https://skmtc.net/nod-ai/apis/stabilityai-rest-api.md) · [All operations](https://skmtc.net/nod-ai/apis/stabilityai-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/nod-ai/stabilityai-rest-api/revisions/ea57a82c5c16/schema)
