---
title: "image-to-image/masking"
method: POST
path: "/generation/{engine_id}/image-to-image/masking"
tags: ["v1beta/generation"]
---

# image-to-image/masking

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

Paint fancy things into fancy pictures

## Path parameters

- `engine_id` string, required

## Headers

- `Accept` 'application/json' | 'image/png'
- `Organization` string

## Response `200`

OK response.

- Image[] — The result of the generation request, containing one or more images as base64 encoded strings.
  - `base64` string — Image encoded in base64
  - `finishReason` 'SUCCESS' | 'ERROR' | 'CONTENT_FILTERED'
  - `seed` number — The seed associated with this image

## Other responses

- `400` — bad_request: general error for invalid parameters <br/><br/> <p style="display: flex; margin-top: -20px; margin-bottom: 0">More specific errors:</p> - invalid_samples: Sample count may only be greater than 1 when the accept header is set to `application/json` - invalid_height_or_width: Height and width must be specified in increments of 64 - invalid_file_size: The file size of one or more of the provided files is invalid - invalid_mime_type: The mime type of one or more of the provided files is invalid - invalid_image_dimensions: The dimensions of the provided `init_image` and `mask_image` do not match - invalid_mask_image: The parameter `mask_source` was set to `MASK_IMAGE_WHITE` or `MASK_IMAGE_BLACK` but no `mask_image` was provided - invalid_prompts: One or more of the prompts contains filtered words - invalid_pixel_count: Incorrect number of pixels specified. Requirements: - For 768 engines : <span style='display: inline-flex; justify-content: flex-start; gap:8px'>589,824 <span>≤</span> `height * width` <span>≤</span> 1,048,576</span> - All other engines: <span style='display: inline-flex; justify-content: flex-start; gap:8px'>262,144 <span>≤</span> `height * width` <span>≤</span> 1,048,576</span>\n
- `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 was not found (e.g. specifing a model that does not exist)
- `500` — server_error: Some unexpected server error occurred

---

[API](https://skmtc.net/stability-ai/apis/stability-ai-rest-api-2.md) · [All operations](https://skmtc.net/stability-ai/apis/stability-ai-rest-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/stability-ai/stability-ai-rest-api-2/versions/76f7cc79a3d7/schema)
