Skip to main content

Generate a video and poll for completion

# Generate
RESPONSE=$(curl -s -X POST https://rawugc.com/api/v1/videos/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "veo3_fast", "prompt": "Product showcase with smooth camera", "aspectRatio": "16:9"}')

TASK_ID=$(echo $RESPONSE | jq -r '.taskId')
echo "Task ID: $TASK_ID"

# Poll for completion
while true; do
  STATUS=$(curl -s https://rawugc.com/api/v1/videos/$TASK_ID \
    -H "Authorization: Bearer $API_KEY")
  STATE=$(echo $STATUS | jq -r '.status')
  echo "Status: $STATE"
  if [ "$STATE" = "completed" ] || [ "$STATE" = "failed" ]; then
    echo $STATUS | jq .
    break
  fi
  sleep 10
done

List completed videos

curl "https://rawugc.com/api/v1/videos?status=completed&limit=10" \
  -H "Authorization: Bearer $API_KEY"

Create an inspo project and scrape videos

// Create project
const project = await fetch(`${BASE_URL}/inspo`, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'Fitness Content Q1',
    niche: 'fitness',
  }),
}).then(r => r.json());

// Scrape TikTok videos
const scrapeResult = await fetch(`${BASE_URL}/inspo/${project._id}/scrape`, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    mode: 'keyword',
    keyword: 'fitness motivation',
    limit: 20,
  }),
}).then(r => r.json());

console.log(`Scraped ${scrapeResult.created} videos`);

Trigger an automation

curl -X POST "https://rawugc.com/api/v1/automations/AUTOMATION_ID/webhook" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"trigger": "manual"}'