Stability.Ai
  1. generation
Stability.Ai
  • Getting Started
  • v1
    • user
      • account
      • balance
    • engines
      • list
    • generation
      • text-to-image
        POST
      • image-to-image
        POST
      • image-to-image/upscale
        POST
      • image-to-image/masking
        POST
  • v2alpha
    • generation
      • image-to-video
      • image-to-video/result
      • stable-image/upscale
      • stable-image/upscale/result
      • stable-image/inpaint
  1. generation

image-to-image/masking

https://api.stability.ai
https://api.stability.ai
https://api.stability.ai
https://api.stability.ai
POST
/v1/generation/{engine_id}/image-to-image/masking
v1/generation
Selectively modify portions of an image using a mask
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking' \
--form 'init_image=""' \
--form 'mask_source=""' \
--form 'text_prompts=""'
Response Response Example
200 - Example 1
{
    "artifacts": [
        [
            {
                "base64": "...very long string...",
                "finishReason": "SUCCESS",
                "seed": 1050625087
            },
            {
                "base64": "...very long string...",
                "finishReason": "CONTENT_FILTERED",
                "seed": 1229191277
            }
        ]
    ]
}

Request

Path Params
engine_id
string 
required
Example:
stable-diffusion-xl-1024-v1-0
Header Params
Accept
string 
optional
The format of the response. Leave blank for JSON, or set to 'image/png' for a PNG image.
Organization
string 
optional
Allows for requests to be scoped to an organization other than the user's default. If not provided, the user's default organization will be used.
Example:
org-123456
Stability-Client-ID
string 
optional
Used to identify the source of requests, such as the client application or sub-organization. Optional, but recommended for organizational clarity.
Example:
my-great-plugin
Stability-Client-Version
string 
optional
Used to identify the version of the application or service making the requests. Optional, but recommended for organizational clarity.
Example:
1.2.1
Body Params multipart/form-data
init_image
string 
required
mask_source
string 
required
mask_image
string 
optional
text_prompts
string 
required
cfg_scale
string 
optional
clip_guidance_preset
string 
optional
sampler
string 
optional
samples
string 
optional
seed
string 
optional
steps
string 
optional
style_preset
string 
optional
extras
string 
optional

Responses

🟢200Success
application/json
Body
An array of results from the generation request, where each image is a base64 encoded PNG.
artifacts
array[object (Image) {3}] 
optional
base64
string 
optional
Image encoded in base64
finishReason
enum<string> 
optional
Allowed values:
CONTENT_FILTEREDERRORSUCCESS
Example:
CONTENT_FILTERED
seed
number 
optional
The seed associated with this image
Example:
1229191277
🟠400400
🟠401401
🟠403403
🟠404404
🔴500500
Previous
image-to-image/upscale
Next
image-to-video
Built with