Segmind Blazar Serverless API

Make three UGC video ads from one product photo. Segmind Blazar films one creator with three different opening hooks and the same pitch, with captions and an end card, ready to A/B test.

~14m 34s
~$4.6882
 1import requests
 2import time
 3import json
 4
 5api_key = "YOUR_API_KEY"
 6url = "https://api.segmind.com/workflows/v2/6b03d7adc342dee3c913e021-v2"
 7
 8data = {
 9    "product_photo": "https://images.segmind.com/public/23422d267e0b6ade629e241f36705a71.jpeg",
10    "product_name": "SOLACE eau de parfum",
11    "selling_point": "A warm amber and sandalwood scent that lasts all day from two sprays, in a 50 ml glass bottle that fits in a bag.",
12    "audience": "Women 22 to 35 who want one signature scent for work and evenings",
13    "creator": "a friendly woman in her late twenties with shoulder-length dark hair, a cream knit sweater and minimal makeup",
14    "call_to_action": "Tap the link to get yours",
15    "quality": "Standard (720p)"
16}
17
18def poll_for_result(poll_url):
19    """Poll the API until the generation is complete"""
20    while True:
21        response = requests.get(
22            poll_url,
23            headers={'x-api-key': api_key}
24        )
25        result = response.json()
26
27        if result['status'] == 'COMPLETED':
28            # Parse the output (it's a JSON string)
29            outputs = json.loads(result['output'])
30            return outputs
31        elif result['status'] == 'FAILED':
32            raise Exception(result.get('error', 'Generation failed'))
33
34        # Wait 7 seconds before polling again
35        time.sleep(7)
36
37# Make the initial request
38response = requests.post(
39    url,
40    json=data,
41    headers={
42        'x-api-key': api_key,
43        'Content-Type': 'application/json'
44    }
45)
46
47if response.status_code == 200:
48    result = response.json()
49    print('Request queued:', result)
50
51    # Start polling for results
52    outputs = poll_for_result(result['poll_url'])
53    print('Generation complete:', outputs)
54else:
55    print(f"Error: {response.status_code}")
56    print(response.text)

API Endpoint

POSThttps://api.segmind.com/workflows/v2/6b03d7adc342dee3c913e021-v2

Parameters

product_photooptional
string (uri)

Product Photo

Default: "https://images.segmind.com/public/23422d267e0b6ade629e241f36705a71.jpeg"
product_nameoptional
string

Product Name

Default: "SOLACE eau de parfum"
selling_pointoptional
string

Selling Point

Default: "A warm amber and sandalwood scent that lasts all day from two sprays, in a 50 ml glass bottle that fits in a bag."
audienceoptional
string

Audience

Default: "Women 22 to 35 who want one signature scent for work and evenings"
creatoroptional
string

Creator

Default: "a friendly woman in her late twenties with shoulder-length dark hair, a cream knit sweater and minimal makeup"
call_to_actionoptional
string

Call To Action

Default: "Tap the link to get yours"
qualityoptional
string

Quality

Default: "Standard (720p)"

Response Format

Returns: Polling-based asynchronous response

Initial request returns a poll_url. Poll every 7 seconds until status is COMPLETED.

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Workflow not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out