Skip to content

ADD_MASKS API Documentation ​

🌐 Language Switch ​

中文版 | English

Interface Information ​

POST /openapi/capcut-mate/v1/add_masks

Function Description ​

Add mask effects to existing drafts. This interface is used to add various shape masks to control visible areas of the screen in Jianying drafts. Masks can be used to create interesting visual effects and focus attention on specific areas.

Request Parameters ​

json
{
  "draft_url": "https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/get_draft?draft_id=2025092811473036584258",
  "segment_ids": ["segment1-uuid", "segment2-uuid"],
  "name": "圆形",
  "X": 100,
  "Y": 200,
  "width": 300,
  "height": 300,
  "feather": 20,
  "rotation": 0,
  "invert": false,
  "roundCorner": 0
}

Parameter Description ​

ParameterTypeRequiredDefaultDescription
draft_urlstring✅-Complete URL of the target draft
segment_idsarray✅-List of segment IDs to apply masks
namestring❌"线性"Mask type name: 线性 / 镜面 / 圆形 / 矩形 / 爱心 / 星形
Xinteger❌0Mask center X in pixels, relative to the material center (positive = right)
Yinteger❌0Mask center Y in pixels, relative to the material center (positive = down)
widthinteger❌512Mask width in pixels
heightinteger❌512Mask height in pixels
featherinteger❌0Feather edge softness (0-100)
rotationinteger❌0Rotation angle (degrees)
invertboolean❌falseInvert mask effect
roundCornerinteger❌0Rounded corner radius (0-100), rectangle mask only

Response Format ​

Success Response (200) ​

json
{
  "code": 0,
  "message": "success",
  "draft_url": "https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/get_draft?draft_id=2025092811473036584258",
  "masks_added": 2,
  "affected_segments": ["segment1-uuid", "segment2-uuid"],
  "mask_ids": ["mask1-uuid", "mask2-uuid"]
}

Response Field Description ​

FieldTypeDescription
draft_urlstringUpdated draft URL
masks_addedintegerNumber of masks added
affected_segmentsarrayList of affected segment IDs
mask_idsarrayList of added mask IDs

Error Response ​

json
{
  "code": 2023,
  "message": "Invalid mask information, please check if mask parameters are correct."
}

Usage Examples ​

cURL Examples ​

1. Basic Circle Mask ​

bash
curl -X POST https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/add_masks \
  -H "Content-Type: application/json" \
  -d '{
    "draft_url": "YOUR_DRAFT_URL",
    "segment_ids": ["segment1-uuid"],
    "name": "圆形",
    "X": 0,
    "Y": 0,
    "width": 400,
    "height": 400
  }'

2. Rectangle Mask with Effects ​

bash
curl -X POST https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/add_masks \
  -H "Content-Type: application/json" \
  -d '{
    "draft_url": "YOUR_DRAFT_URL",
    "segment_ids": ["segment1-uuid", "segment2-uuid"],
    "name": "矩形",
    "X": 100,
    "Y": 50,
    "width": 400,
    "height": 300,
    "feather": 10,
    "roundCorner": 10
  }'

3. Inverted Mask ​

bash
curl -X POST https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/add_masks \
  -H "Content-Type: application/json" \
  -d '{
    "draft_url": "YOUR_DRAFT_URL",
    "segment_ids": ["segment1-uuid"],
    "name": "爱心",
    "X": 0,
    "Y": 0,
    "width": 300,
    "height": 300,
    "invert": true
  }'

Error Code Description ​

Error CodeError MessageDescriptionSolution
1001Parameter validation failedRequest body failed schema validation (e.g. a non-integer X / width)Check parameter types and required fields
2001Invalid draft URLdraft_url is missing, malformed, or the draft is not in the cachePass the draft_url returned by create_draft
2015Segment not foundA segment_id does not exist in the draftCheck the segment IDs
2016Invalid segment typeThe segment is not a video segment, which cannot take a maskApply masks only to video segments
2023Invalid mask informationsegment_ids is emptyProvide at least one segment ID
2024Mask addition failedFailed while writing the mask into the draftCheck the draft state and retry
2025Mask type not foundname is not one of the supported mask namesUse 线性 / 镜面 / 圆形 / 矩形 / 爱心 / 星形
2042Draft lock acquisition timeoutOnly one operation is allowed on a draft at a timeRetry later

Notes ​

  1. Coordinate System: X / Y are pixels, with the origin at the material center (positive X = right, positive Y = down)
  2. Size Values: width / height are pixels (default 512), not normalized ratios
  3. Mask Types: name must be the Chinese mask name — 线性 / 镜面 / 圆形 / 矩形 / 爱心 / 星形; an unknown name returns error 2025
  4. Feather Effect: Softens mask edges for natural transitions
  5. Rotation: Rotation angle in degrees
  6. Invert: When true, shows area outside the mask

Workflow ​

  1. Validate required parameters
  2. Check segment existence
  3. Create mask with specified parameters
  4. Apply mask to segments
  5. Save the draft
  6. Return processing result