easy_create_material API Documentation
API Overview
API Name: easy_create_material
API Endpoint: POST /openapi/capcut-mate/v1/easy_create_material
Description: Add multiple types of material content to an existing draft, including audio, video, images, and text. This interface can add various media materials to the draft at once, automatically handle material properties such as duration and dimensions, and intelligently manage different types of media tracks. It is one of the core interfaces for video creation.
More Documentation
π For more detailed documentation and tutorials, please visit: https://docs.jcaigc.cn
Request Parameters
Request Body (application/json)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| draft_url | string | Yes | - | Complete URL of the target draft |
| audio_url | string | Yes | - | Audio file URL, cannot be empty or null |
| text | string | No | null | Text content to be added |
| img_url | string | No | null | Image file URL |
| video_url | string | No | null | Video file URL |
| text_color | string | No | "#ffffff" | Text color (hexadecimal format) |
| font_size | integer | No | 15 | Font size |
| text_transform_y | integer | No | 0 | Text Y-axis position offset |
Material Type Description
| Material Type | Supported Formats | Auto Processing | Duration Setting |
|---|---|---|---|
| Audio | MP3, WAV, AAC | Auto-get duration | Use audio original duration |
| Video | MP4, AVI, MOV | Auto-get properties | Fixed duration 5 seconds |
| Image | JPEG, PNG, GIF | Auto-get dimensions | Default duration 3 seconds |
| Text | UTF-8 text | Support style settings | Default duration 5 seconds |
Request Examples
Add All Types of Materials
{
"draft_url": "https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/get_draft?draft_id=2025092811473036584258",
"audio_url": "https://assets.jcaigc.cn/audio.mp3",
"text": "Hello World",
"img_url": "https://s.coze.cn/t/JTa5Ne6_liY/",
"video_url": "https://assets.jcaigc.cn/video.mp4",
"text_color": "#ff0000",
"font_size": 20,
"text_transform_y": 100
}
Add Only Audio and Text
{
"draft_url": "https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/get_draft?draft_id=2025092811473036584258",
"audio_url": "https://assets.jcaigc.cn/background_music.mp3",
"text": "Welcome to watch",
"text_color": "#0066ff",
"font_size": 18
}
Simplest Request (Audio Only)
{
"draft_url": "https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/get_draft?draft_id=2025092811473036584258",
"audio_url": "https://assets.jcaigc.cn/audio.wav"
}
Response Format
Success Response
{
"draft_url": "https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/get_draft?draft_id=2025092811473036584258"
}
Error Response
400 Bad Request - Parameter Validation Failed
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request parameter validation failed",
"details": "audio_url cannot be empty"
}
}
404 Not Found - Draft Does Not Exist
{
"error": {
"code": "DRAFT_NOT_FOUND",
"message": "Draft file does not exist",
"details": "Cannot find the specified draft file"
}
}
500 Internal Server Error - Material Creation Failed
{
"error": {
"code": "MATERIAL_CREATE_FAILED",
"message": "Material creation failed",
"details": "Error occurred while adding audio material"
}
}
Error Code Description
| Error Code | HTTP Status Code | Description | Solution |
|---|---|---|---|
| VALIDATION_ERROR | 400 | Request parameter validation failed | Check if required parameters are provided and parameter format is correct |
| DRAFT_NOT_FOUND | 404 | Draft file does not exist | Confirm if the draft URL is correct and if the draft has been deleted |
| MATERIAL_CREATE_FAILED | 500 | Material creation failed | Check if the material URL is valid and network connection is normal |
| INVALID_URL | 400 | URL format is invalid | Confirm the provided URL format is correct and accessible |
Usage Instructions
Parameter Description
-
draft_url: Must be a valid CapCut draft URL, format is
https://capcut-mate.jcaigc.cn/openapi/capcut-mate/v1/get_draft?draft_id=2025092811473036584258 - audio_url: Required parameter, must provide a valid audio file URL, does not accept empty strings or null values
- Optional Materials: text, img_url, video_url are all optional parameters, can be added as needed
- Text Style: text_color supports hexadecimal color codes, font_size range recommended 10-50
- Position Offset: text_transform_y is used to adjust the vertical position of text in the frame
Material Processing Rules
-
Audio Processing:
- Automatically parse audio duration
- Add to audio track
- Support multiple audio formats
-
Video Processing:
- Fixed display duration 5 seconds
- Maintain original resolution ratio
- Add to video track
-
Image Processing:
- Default display duration 3 seconds
- Automatically get image dimensions
- Add to image track
-
Text Processing:
- Default display duration 5 seconds
- Support color and font size settings
- Adjustable vertical position
Notes
- Audio is a required parameter, other material types are optional
- Material URLs must be publicly accessible, HTTPS protocol is recommended
- Text color uses standard hexadecimal format (e.g., #ffffff, #000000)
- All durations are calculated in microseconds internally
- It is recommended to ensure stable network connection before adding materials
Application Scenarios
- Quickly Create Multimedia Content: Add background music, video clips, images, and title text at once
- Batch Material Import: Quickly add various types of basic materials to newly created drafts
- Template-based Creation: Quickly generate video drafts based on fixed material type templates
- Automated Workflow: Batch add preset material content in automated video production workflows
Related Interfaces
- create_draft - Create new draft file
- add_audios - Add audio materials separately
- add_videos - Add video materials separately
- add_images - Add image materials separately
- save_draft - Save draft file
Technical Implementation
File Structure
src/
βββ schemas/easy_create_material.py # Request/response data models
βββ service/easy_create_material.py # Business logic implementation
βββ router/v1.py # API route definition
Core Logic
- Parameter Validation: Validate the validity of draft URL and audio URL
- Draft Loading: Parse and load draft file from URL
- Material Addition: Add audio, video, image, and text materials by type
- Track Management: Automatically manage track allocation for different material types
- File Saving: Save the updated draft file
Log Recording
The system will record logs for the following key operations:
- Draft loading success/failure
- Detailed process of adding each type of material
- File saving results
- Error exception information
Version Information: v1.0
Last Updated: 2024-09-24
π Project Resources
GitHub: https://github.com/Hommy-master/capcut-mate
Gitee: https://gitee.com/taohongmin-gitee/capcut-mate
Top comments (0)