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"}')
VIDEO_ID=$(echo $RESPONSE | jq -r '.videoId')
echo "Video ID: $VIDEO_ID"
# Poll for completion
while true; do
STATUS=$(curl -s https://rawugc.com/api/v1/videos/$VIDEO_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
const API_KEY = process.env.RAWUGC_API_KEY;
const BASE_URL = 'https://rawugc.com/api/v1';
async function generateVideo(params) {
const response = await fetch(`${BASE_URL}/videos/generate`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(params),
});
if (!response.ok) {
const error = await response.json();
throw new Error(`${error.title}: ${error.detail}`);
}
return response.json();
}
async function waitForVideo(videoId) {
while (true) {
const response = await fetch(`${BASE_URL}/videos/${videoId}`, {
headers: { 'Authorization': `Bearer ${API_KEY}` },
});
const result = await response.json();
if (result.status === 'completed') return result;
if (result.status === 'failed') throw new Error(result.failMessage);
await new Promise(r => setTimeout(r, 10000));
}
}
// Usage
const { videoId } = await generateVideo({
model: 'veo3_fast',
prompt: 'Product showcase with smooth camera movement',
aspectRatio: '16:9',
});
const video = await waitForVideo(videoId);
console.log('Video URL:', video.url);
import requests
import time
import os
API_KEY = os.environ['RAWUGC_API_KEY']
BASE_URL = 'https://rawugc.com/api/v1'
HEADERS = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json',
}
def generate_video(params):
response = requests.post(
f'{BASE_URL}/videos/generate',
headers=HEADERS,
json=params,
)
response.raise_for_status()
return response.json()
def wait_for_video(video_id):
while True:
response = requests.get(
f'{BASE_URL}/videos/{video_id}',
headers=HEADERS,
)
result = response.json()
if result['status'] == 'completed':
return result
if result['status'] == 'failed':
raise Exception(result.get('failMessage', 'Generation failed'))
time.sleep(10)
# Usage
result = generate_video({
'model': 'veo3_fast',
'prompt': 'Product showcase with smooth camera movement',
'aspectRatio': '16:9',
})
video = wait_for_video(result['videoId'])
print('Video URL:', video['url'])
List completed videos
curl "https://rawugc.com/api/v1/videos?status=completed&limit=10" \
-H "Authorization: Bearer $API_KEY"
const response = await fetch(
`${BASE_URL}/videos?status=completed&limit=10`,
{ headers: { 'Authorization': `Bearer ${API_KEY}` } }
);
const { videos, pagination } = await response.json();
console.log(`${pagination.total} total videos`);
response = requests.get(
f'{BASE_URL}/videos',
headers=HEADERS,
params={'status': 'completed', 'limit': 10},
)
data = response.json()
print(f"{data['pagination']['total']} total videos")
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`);
# Create project
project = requests.post(
f'{BASE_URL}/inspo',
headers=HEADERS,
json={'name': 'Fitness Content Q1', 'niche': 'fitness'},
).json()
# Scrape TikTok videos
scrape = requests.post(
f'{BASE_URL}/inspo/{project["_id"]}/scrape',
headers=HEADERS,
json={'mode': 'keyword', 'keyword': 'fitness motivation', 'limit': 20},
).json()
print(f"Scraped {scrape['created']} videos")

