跳转到主要内容
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>"
    }
  }
}

授权

X-API-Key
string
header
必填

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.

请求体

multipart/form-data
image
file
必填

The mask image file to upload

original_ref
string
必填

JSON string containing reference to the original image

响应

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