---
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")

## Other responses

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

## Changes

> 38 revisions in range; 2 could not be searched.

- **2026-06-03** `8560879e6188` — 4 warning, 7 info
  - removed the request property `original_ref/filename`
  - removed the request property `overwrite`
  - removed the request property `subfolder`
  - removed the request property `type`
  - …7 more
- **2026-05-22** `09a5075587c8` — 2 info
  - added the non-success response with the status `401`
  - added the non-success response with the status `500`
- **2026-05-19** `6cf3d6964916` — 1 info
  - endpoint deprecated
- **2026-04-24** `a66055fa384e` — 3 breaking, 7 info
  - added the new required request property `original_ref/filename`
  - the `original_ref` request property type/format changed from `string`/`` to `object`/``
  - removed the media type `application/json` for the response with the status `400`
  - api tag `upload` added
  - …6 more

[Change history](https://skmtc.dev/comfy-org/apis/comfyui-api/changes/api/upload/mask/post.md)

---

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