Segmind Pulsar Serverless API

Turn any talking or singing video into designed, moving captions. Segmind Pulsar sets each phrase as typography, times every word to the voice and keeps it off the face and the app buttons.

~2m 56s
~$0.3
 1import requests
 2import time
 3import json
 4
 5api_key = "YOUR_API_KEY"
 6url = "https://api.segmind.com/workflows/v2/6b045beeea4a00a0bc807580-v2"
 7
 8data = {
 9    "video": "https://images.segmind.com/public/2117b979f443508b69f6d7cb84398fb1.mp4",
10    "look": "Editorial (italic serif key word)",
11    "posting_to": "Instagram Reels",
12    "text_size": "Medium",
13    "position": "Auto (beside the face)",
14    "words_behind_head": "Auto",
15    "emphasis_words": "sample text",
16    "brand_names": "BRISA",
17    "accent_colour": "none",
18    "script": "sample text"
19}
20
21def poll_for_result(poll_url):
22    """Poll the API until the generation is complete"""
23    while True:
24        response = requests.get(
25            poll_url,
26            headers={'x-api-key': api_key}
27        )
28        result = response.json()
29
30        if result['status'] == 'COMPLETED':
31            # Parse the output (it's a JSON string)
32            outputs = json.loads(result['output'])
33            return outputs
34        elif result['status'] == 'FAILED':
35            raise Exception(result.get('error', 'Generation failed'))
36
37        # Wait 7 seconds before polling again
38        time.sleep(7)
39
40# Make the initial request
41response = requests.post(
42    url,
43    json=data,
44    headers={
45        'x-api-key': api_key,
46        'Content-Type': 'application/json'
47    }
48)
49
50if response.status_code == 200:
51    result = response.json()
52    print('Request queued:', result)
53
54    # Start polling for results
55    outputs = poll_for_result(result['poll_url'])
56    print('Generation complete:', outputs)
57else:
58    print(f"Error: {response.status_code}")
59    print(response.text)

API Endpoint

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

Parameters

videooptional
string (uri)

Video

Default: "https://images.segmind.com/public/2117b979f443508b69f6d7cb84398fb1.mp4"
lookoptional
string

Look

Default: "Editorial (italic serif key word)"
posting_tooptional
string

Posting To

Default: "Instagram Reels"
text_sizeoptional
string

Text Size

Default: "Medium"
positionoptional
string

Position

Default: "Auto (beside the face)"
words_behind_headoptional
string

Words Behind Head

Default: "Auto"
emphasis_wordsoptional
string

Emphasis Words

brand_namesoptional
string

Brand Names

Default: "BRISA"
accent_colouroptional
string

Accent Colour

Default: "none"
scriptoptional
string

Script

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