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.

More Documentation

📖 For more detailed documentation and tutorials, please visit: https://docs.jcaigc.cn

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": "Circle Mask",
  "X": 0.5,
  "Y": 0.5,
  "width": 0.3,
  "height": 0.3,
  "feather": 0.1,
  "rotation": 0,
  "invert": false,
  "roundCorner": 0.2
}

Parameter Description

ParameterTypeRequiredDefaultDescription
draft_urlstring-Complete URL of the target draft
segment_idsarray-List of segment IDs to apply masks
namestring-Mask name/type
Xnumber-Horizontal position (0.0-1.0)
Ynumber-Vertical position (0.0-1.0)
widthnumber-Mask width (0.0-1.0)
heightnumber-Mask height (0.0-1.0)
feathernumber0.0Feather edge softness
rotationnumber0Rotation angle (degrees)
invertbooleanfalseInvert mask effect
roundCornernumber0.0Rounded corner radius

Response Format

Success Response (200)

json
{
  "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 (4xx/5xx)

json
{
  "detail": "Error message description"
}

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": "Circle Mask",
    "X": 0.5,
    "Y": 0.5,
    "width": 0.4,
    "height": 0.4
  }'

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": "Rectangle Mask",
    "X": 0.3,
    "Y": 0.4,
    "width": 0.5,
    "height": 0.3,
    "feather": 0.1,
    "roundCorner": 0.1
  }'

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": "Heart Mask",
    "X": 0.5,
    "Y": 0.5,
    "width": 0.3,
    "height": 0.3,
    "invert": true
  }'

Error Code Description

Error CodeError MessageDescriptionSolution
400draft_url is requiredMissing draft URL parameterProvide a valid draft URL
400segment_ids is requiredMissing segment IDsProvide valid segment ID list
400name is requiredMissing mask nameProvide mask name
400Position values invalidX/Y must be between 0.0-1.0Use valid position values
400Size values invalidwidth/height must be between 0.0-1.0Use valid size values
404Draft does not existSpecified draft URL invalidCheck if draft URL is correct
404Segment not foundSpecified segment ID does not existCheck segment IDs
500Mask processing failedInternal processing errorContact technical support

Notes

  1. Coordinate System: Position values use normalized coordinates (0.0-1.0)
  2. Size Values: Width and height are relative to screen size
  3. Mask Types: Support various mask shapes (circle, rectangle, heart, etc.)
  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 and encrypt draft
  6. Return processing result