Skip to main content
POST
/
api
/
upload
/
mask
Upload a mask image
curl --request POST \
  --url https://cloud.comfy.org/api/upload/mask \
  --header 'Content-Type: multipart/form-data' \
  --header 'X-API-Key: <api-key>' \
  --form image='@example-file' \
  --form 'original_ref=<string>'
{
  "name": "<string>",
  "subfolder": "<string>",
  "type": "<string>",
  "metadata": {
    "is_mask": true,
    "original_hash": "<string>",
    "mask_type": "<string>",
    "related_files": {
      "mask": "<string>",
      "paint": "<string>",
      "painted": "<string>"
    }
  }
}

Authorizations

X-API-Key
string
header
required

API key authentication. Generate an API key from your account settings at https://comfy.org/account. Pass the key in the X-API-Key header.

Body

multipart/form-data
image
file
required

The mask image file to upload

original_ref
string
required

JSON string containing reference to the original image

Response

Mask uploaded successfully

name
string

Filename of the uploaded mask

subfolder
string

Subfolder path where mask was saved

type
string

Type of upload (e.g., "output")

metadata
object

Additional metadata for mask detection and re-editing