---
title: "Upload a mask image"
method: POST
path: "/api/upload/mask"
tags: ["file"]
---

# Upload a mask image

`POST /api/upload/mask`

Upload a mask image to be applied to an existing image.

Image limits apply to both the uploaded mask and the referenced
original image:
  - Maximum file size: 50 MB
  - Maximum width/height per edge: 16384 px
  - Maximum total pixel count: 64 megapixels (67108864 pixels)

Uploads that exceed any of these limits are rejected with HTTP 400.

## Response `200`

Mask uploaded successfully

- object
  - `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
    - `is_mask` boolean — Whether this file is a mask
    - `original_hash` string — Hash of the original unmasked image
    - `mask_type` string — Type of mask (e.g., "painted_masked")
    - `related_files` object — Related mask layer files (if available)
      - `mask` string — Hash of the mask layer
      - `paint` string — Hash of the paint layer
      - `painted` string — Hash of the painted image

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `500` — Internal server error

---

[API](https://skmtc.dev/ac/apis/comfy-api.md) · [All operations](https://skmtc.dev/ac/apis/comfy-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ac/comfy-api/revisions/c1893dffe250/schema)
