UGC Video API: Generate AI Videos via REST API | agent-media

Developer

Most AI video tools lock you into a browser. agent-media exposes a public REST API at agent-media.ai/api/v1/. Send a script, pick an actor, get back a finished MP4 with lip-sync, subtitles, and music. Bearer token auth. JSON responses. Standard polling flow. See pricing.

Authentication

Every request requires a Bearer token. Generate an API key from your dashboard. Keys start with ma_ and are scoped to your account.

Authorization: Bearer ma_your_api_key_here

All endpoints return JSON. Error responses include a message field with a human-readable explanation.

API Endpoints

POST /api/v1/videos

Submit a video generation job. Returns a job ID immediately. The video renders asynchronously. Poll the status endpoint to check progress.

curl -X POST https://agent-media.ai/api/v1/videos \\
  -H "Authorization: Bearer ma_your_api_key" \\
  -H "Content-Type: application/json" \\
  -d '{
    "script": "Stop scrolling. This app saves me two hours every morning.",
    "actor": "sofia",
    "duration": 10,
    "subtitle_style": "tiktok",
    "voice_tone": "energetic",
    "aspect_ratio": "9:16"
  }'

Response (202 Accepted)

{
  "id": "vid_abc123",
  "status": "processing",
  "credits_charged": 300,
  "estimated_seconds": 120,
  "created_at": "2026-04-15T10:30:00Z"
}

Request Body Parameters

GET /api/v1/videos/:id

Check the status of a video job. When status is completed, the output_url field contains a direct link to the MP4.

curl https://agent-media.ai/api/v1/videos/vid_abc123 \\
  -H "Authorization: Bearer ma_your_api_key"

Response (completed)

{
  "id": "vid_abc123",
  "status": "completed",
  "output_url": "https://media.agent-media.ai/videos/vid_abc123.mp4",
  "duration": 10,
  "credits_charged": 300,
  "created_at": "2026-04-15T10:30:00Z",
  "completed_at": "2026-04-15T10:32:15Z"
}

GET /api/v1/actors

List all available actors. Returns slug, name, gender, and variant count. Use the slug when creating videos.

curl https://agent-media.ai/api/v1/actors \\
  -H "Authorization: Bearer ma_your_api_key"

Response (truncated)

{
  "actors": [
    {
      "slug": "sofia",
      "name": "Sofia",
      "gender": "female",
      "variants": 10
    },
    {
      "slug": "marco",
      "name": "Marco",
      "gender": "male",
      "variants": 10
    }
  ],
  "total": 200
}

Polling Flow: Submit, Poll, Download

Video generation takes 1 to 3 minutes. The recommended pattern: submit the job, then poll every 10 seconds until the status is completed or failed.

# Submit the video
VIDEO_ID=$(curl -s -X POST https://agent-media.ai/api/v1/videos \\
  -H "Authorization: Bearer ma_your_api_key" \\
  -H "Content-Type: application/json" \\
  -d '{"script":"This changed everything for me.","actor":"sofia","duration":10}' \\
  | jq -r '.id')

echo "Submitted: $VIDEO_ID"

# Poll until done
while true; do
  STATUS=$(curl -s https://agent-media.ai/api/v1/videos/$VIDEO_ID \\
    -H "Authorization: Bearer ma_your_api_key" \\
    | jq -r '.status')

  echo "Status: $STATUS"

  if [ "$STATUS" = "completed" ]; then
    OUTPUT=$(curl -s https://agent-media.ai/api/v1/videos/$VIDEO_ID \\
      -H "Authorization: Bearer ma_your_api_key" \\
      | jq -r '.output_url')
    echo "Download: $OUTPUT"
    break
  fi

  if [ "$STATUS" = "failed" ]; then
    echo "Video generation failed."
    break
  fi

  sleep 10
done

Status values: processing (rendering in progress), completed (MP4 ready at output_url), failed (check the error field for details).

API Pricing

The API uses the same credit system as the CLI and dashboard. 30 credits per second of video.

AI script generation adds 5 credits per request. View full pricing plans.

Why the agent-media API

Related Pages

Last updated: April 2026