Create User Media
Upload video or image files to your user media library by providing a URL. This media can then be referenced in your video projects using the returned userMediaId.
This endpoint requires authentication and has a rate limit of 500 requests per
hour.
Authentication
Your Submagic API key starting with sk-
Request Body
Public URL to your video or image file. Must be a valid URL and accessible
without authentication.
Response
Unique identifier for the uploaded media (UUID format). Use this ID to
reference the media in your video projects.
curl -X POST "https://api.submagic.co/v1/user-media" \
-H "x-api-key: sk-your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/media/sample-video.mp4"
}'
{
"userMediaId": "88a08eec-712a-45d0-8d0b-3b631700cb3a"
}
Once you have a userMediaId, you can reference it in the items array when creating or uploading projects:
{
"items": [
{
"type": "user-media",
"startTime": 5,
"endTime": 10,
"userMediaId": "88a08eec-712a-45d0-8d0b-3b631700cb3a"
}
]
}
See the Create Project or Upload Project documentation for more details on using user media in your videos.
Error Responses
{
"error": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"field": "url",
"message": "Must be a valid URL",
"value": "invalid-url"
}
]
}
{
"error": "VALIDATION_ERROR",
"message": "The following media is not ready yet: df7d8cfd-eb82-4865-8b32-df3396b972b1. Please wait for the upload to complete."
}
{
"error": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
{
"error": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests",
"retryAfter": 30
}
{
"error": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred"
}