Skip to main content

Endpoint

POST https://api.ugc.inc/media/create

Overview

Create media records from file URLs. Use this after uploading files directly to blob storage via the presigned URL endpoint, or to reference media from external URLs. The API will:
  1. Determine the media type from the URL extension (video, image, or audio)
  2. Create a database record pointing to the provided URL
This endpoint does NOT re-upload files. It creates database records that reference the provided URLs directly. Make sure your URLs are publicly accessible and permanent.

Request Body

urls
string[]
required
Array of file URLs to create media from. Always provide as an array, even for single files.
names
string[]
Optional array of original filenames, parallel to the urls array. If not provided, filenames are extracted from the URLs.
previewUrls
(string | null)[]
Optional array of preview/thumbnail URLs, parallel to the urls array. Useful for providing video thumbnails.
tag
string
Optional tag to apply to all created media

Response

data
object
Upload result object
curl -X POST https://api.ugc.inc/media/create \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      "https://example.com/video1.mp4",
      "https://example.com/image1.jpg"
    ],
    "tag": "imported"
  }'
{
  "ok": true,
  "code": 200,
  "data": {
    "data": [
      {
        "id": "media_abc123",
        "org_id": "org_xyz789",
        "name": "video1.mp4",
        "tag": "imported",
        "type": "video",
        "url": "https://api.ugc.inc/media/file/media_abc123",
        "created_at": "2024-01-15T10:30:00.000Z",
        "media_type": "user_media"
      },
      {
        "id": "media_def456",
        "org_id": "org_xyz789",
        "name": "image1.jpg",
        "tag": "imported",
        "type": "image",
        "url": "https://api.ugc.inc/media/file/media_def456",
        "created_at": "2024-01-15T10:30:01.000Z",
        "media_type": "user_media"
      }
    ],
    "message": "Created 2 media files"
  }
}