DEV Community

Hommy
Hommy

Posted on

[JCAIGC]Create a new CapCut draft

CREATE_DRAFT API Interface Documentation

๐Ÿ“‹ Table of Contents

๐Ÿ”ง Interface Information

POST /openapi/capcut-mate/v1/create_draft
Enter fullscreen mode Exit fullscreen mode

Function Description

Create a new CapCut draft. This interface is used to create a new video editing draft, supporting custom resolution, frame rate, background color, and other parameters. It is suitable for video editing, content creation, template production, and other scenarios.

More Documentation

๐Ÿ“– For more detailed documentation and tutorials, please visit: https://docs.jcaigc.cn

Request Parameters

Request Body (application/json)

Parameter Name Type Required Default Value Description
title string โŒ "Untitled Draft" Draft title, supports Chinese, English, numbers, and special characters
resolution object โŒ {"width": 1920, "height": 1080} Video resolution configuration
fps number โŒ 30 Video frame rate, supports 24/25/30/48/50/60
background_color string โŒ "#000000" Background color, supports hex color codes
duration number โŒ 60 Default duration (seconds), range: 1-3600
aspect_ratio string โŒ "16:9" Aspect ratio, supports preset ratios or custom ratios
quality string โŒ "high" Video quality level
audio_sample_rate number โŒ 48000 Audio sampling rate (Hz)
audio_channels number โŒ 2 Number of audio channels

Resolution Configuration

{
  "resolution": {
    "width": 1920,
    "height": 1080
  }
}
Enter fullscreen mode Exit fullscreen mode

Resolution Options

Resolution Width Height Application Scenario
1080p 1920 1080 Standard HD, universal choice
720p 1280 720 Standard definition, small file size
4K 3840 2160 Ultra HD, high quality
1440p 2560 1440 2K HD, balanced choice
Vertical 1080p 1080 1920 Short video, mobile optimization
Square 1080 1080 Social media, square format

Aspect Ratio Options

Aspect Ratio Description Application Scenario
16:9 Widescreen Standard video, YouTube
9:16 Vertical screen Short video, TikTok
1:1 Square Instagram, social media
4:3 Standard screen Traditional video
21:9 Ultra-wide Movie, wide screen
custom Custom ratio Special needs

Quality Options

Quality Level Description File Size Processing Speed
low Low quality Small Fast
medium Medium quality Medium Medium
high High quality Large Slow
ultra Ultra high quality Very large Very slow

Frame Rate Options

Frame Rate Description Application Scenario
24 Movie standard Film production
25 PAL standard European TV
30 NTSC standard American TV, network video
48 High frame rate Smooth motion
50 PAL high frame rate Sports broadcast
60 Game standard Game recording, smooth motion

Audio Configuration

Parameter Name Options Description
audio_sample_rate 44100, 48000, 96000 Sampling rate, 48000 recommended
audio_channels 1, 2, 6 1=mono, 2=stereo, 6=5.1 surround

Response Format

Success Response (200)

{
  "draft_url": "https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/get_draft?draft_id=2025092811473036584258",
  "draft_id": "2025092811473036584258",
  "title": "My Video Draft",
  "resolution": {
    "width": 1920,
    "height": 1080
  },
  "fps": 30,
  "duration": 60,
  "created_at": "2024-09-28T11:47:30Z",
  "updated_at": "2024-09-28T11:47:30Z",
  "tip_url": "https://help.assets.jcaigc.cn/draft-usage"
}
Enter fullscreen mode Exit fullscreen mode

Response Field Description

Field Name Type Description
draft_url string Draft access URL, used for subsequent operations
draft_id string Unique identifier of the draft
title string Draft title
resolution object Video resolution configuration
fps number Video frame rate
duration number Video duration (seconds)
created_at string Creation time (ISO 8601 format)
updated_at string Last update time (ISO 8601 format)
tip_url string Draft usage help document URL

Error Response (4xx/5xx)

{
  "detail": "Error message description"
}
Enter fullscreen mode Exit fullscreen mode

Usage Examples

cURL Example

1. Create basic draft

curl -X POST https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/create_draft \
  -H "Content-Type: application/json" \
  -d '{
    "title": "My First Video",
    "resolution": {"width": 1920, "height": 1080},
    "fps": 30,
    "duration": 120
  }'
Enter fullscreen mode Exit fullscreen mode

2. Create vertical video draft

curl -X POST https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/create_draft \
  -H "Content-Type: application/json" \
  -d '{
    "title": "TikTok Short Video",
    "resolution": {"width": 1080, "height": 1920},
    "fps": 30,
    "aspect_ratio": "9:16",
    "background_color": "#FFFFFF",
    "duration": 60
  }'
Enter fullscreen mode Exit fullscreen mode

3. Create high-quality 4K draft

curl -X POST https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/create_draft \
  -H "Content-Type: application/json" \
  -d '{
    "title": "4K Professional Video",
    "resolution": {"width": 3840, "height": 2160},
    "fps": 60,
    "aspect_ratio": "16:9",
    "quality": "ultra",
    "duration": 180
  }'
Enter fullscreen mode Exit fullscreen mode

JavaScript Example

// Create draft function
const createDraft = async (draftConfig) => {
  const response = await fetch('/openapi/capcut-mate/v1/create_draft', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(draftConfig)
  });
  return response.json();
};

// Usage example
(async () => {
  // Create standard HD draft
  const standardDraft = await createDraft({
    title: "My Video Project",
    resolution: { width: 1920, height: 1080 },
    fps: 30,
    duration: 90
  });

  console.log('Draft created successfully:', standardDraft);

  // Create short video draft
  const shortVideoDraft = await createDraft({
    title: "Short Video Content",
    resolution: { width: 1080, height: 1920 },
    aspect_ratio: "9:16",
    fps: 30,
    background_color: "#FF6B35",
    duration: 30
  });

  console.log('Short video draft created:', shortVideoDraft);
})();
Enter fullscreen mode Exit fullscreen mode

Python Example

import requests

def create_draft(draft_config):
    """Create a new CapCut draft"""
    response = requests.post(
        'https://api.assets.jcaigc.cn/openapi/capcut-mate/v1/create_draft',
        headers={'Content-Type': 'application/json'},
        json=draft_config
    )
    return response.json()

# Usage example
# 1. Create basic video draft
basic_config = {
    "title": "Basic Video Draft",
    "resolution": {"width": 1920, "height": 1080},
    "fps": 30,
    "duration": 60
}

basic_draft = create_draft(basic_config)
print(f"Basic draft created: {basic_draft['draft_url']}")

# 2. Create social media draft
social_config = {
    "title": "Instagram Video",
    "resolution": {"width": 1080, "height": 1080},
    "aspect_ratio": "1:1",
    "fps": 30,
    "quality": "high",
    "duration": 30
}

social_draft = create_draft(social_config)
print(f"Social media draft created: {social_draft['draft_url']}")

# 3. Create professional 4K draft
professional_config = {
    "title": "Professional 4K Video",
    "resolution": {"width": 3840, "height": 2160},
    "fps": 60,
    "aspect_ratio": "16:9",
    "quality": "ultra",
    "audio_sample_rate": 48000,
    "audio_channels": 2,
    "duration": 120
}

professional_draft = create_draft(professional_config)
print(f"Professional 4K draft created: {professional_draft['draft_url']}")
Enter fullscreen mode Exit fullscreen mode

Error Code Description

Error Code Error Message Description Solution
400 Invalid resolution format Resolution parameter format error Use correct resolution object format
400 Invalid fps value Frame rate value is out of range Use preset frame rate values
400 Invalid background_color format Background color format error Use valid hex color codes
400 Invalid duration value Duration value is out of range Duration should be between 1-3600 seconds
400 Invalid aspect_ratio format Aspect ratio format error Use preset ratio values
400 Invalid quality value Quality level error Use preset quality values
400 Invalid audio_sample_rate Audio sampling rate error Use preset sampling rate values
400 Invalid audio_channels Number of audio channels error Use 1, 2, or 6
500 Draft creation failed Internal service error Contact technical support or try again later
503 Service unavailable System under maintenance Try again later

Notes

  1. Title Setting: Use a descriptive title to facilitate subsequent management and search
  2. Resolution Selection: Choose appropriate resolution based on target platform and usage scenario
  3. Frame Rate Setting: Choose appropriate frame rate based on content type and target platform
  4. Quality Balance: Balance video quality and file size, choose appropriate quality level
  5. Duration Planning: Set reasonable default duration to avoid overly long or too short
  6. Background Color: Choose appropriate background color to match video content style
  7. Aspect Ratio: Choose appropriate aspect ratio based on target platform requirements
  8. Audio Configuration: Set appropriate audio parameters to ensure sound quality
  9. Network Stability: Draft creation requires network support, ensure stable network connection

Workflow

  1. Verify request parameter format and validity
  2. Create draft basic configuration
  3. Generate unique draft_id
  4. Initialize draft file structure
  5. Set video basic parameters (resolution, frame rate, etc.)
  6. Configure audio parameters
  7. Create draft access URL
  8. Return draft creation result

Next Steps

After creating the draft, you can use the following interfaces to add content:

  • add_videos: Add video materials
  • add_images: Add image materials
  • add_audios: Add audio materials
  • add_captions: Add subtitles
  • add_effects: Add special effects
  • add_masks: Add mask effects
  • save_draft: Save draft
  • gen_video: Export video

Related Interfaces


๐Ÿ“š Project Resources

GitHub: https://github.com/Hommy-master/capcut-mate

Gitee: https://gitee.com/taohongmin-gitee/capcut-mate

Top comments (0)