API Get key

Ad pack

Ad pack from one photo

One product photo and one line about it in, a pack of finished ads out: UGC photos, talking clips and store videos.

From
299 crfor 4 ads
Endpoint
POST /api/v1/studio/pack/runs
Workflow id
pack

Real outputs of this workflow.

The request

# 0. Upload your file first. Its id goes in the body.
MEDIA_ID=$(curl -s -X POST https://staglight.ai/api/v1/uploads \
  -H "Authorization: Bearer $STAGLIGHT_API_KEY" -F file=@product.jpg | jq -r .id)

# 1. Price it. Free, nothing is charged.
PRICE=$(curl -s -X POST https://staglight.ai/api/v1/studio/pack/estimate \
  -H "Authorization: Bearer $STAGLIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "product": {"media_id": "'"$MEDIA_ID"'", "description": "A vitamin C serum in a glass dropper bottle"},
    "items": [
      {"studio": "ugc_video", "card": "talk"},
      {"studio": "ugc_fotos", "card": "ugc_mirror"},
      {"studio": "wiggle", "card": "wiggle"},
      {"studio": "ugc_fotos", "card": "ugc_kitchen"}
    ]
  }' | jq .credits)
echo "$PRICE"

# 2. Start it. max_credits refuses anything above that price; the Idempotency-Key stops a double charge.
START=$(curl -s -X POST https://staglight.ai/api/v1/studio/pack/runs \
  -H "Authorization: Bearer $STAGLIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "product": {"media_id": "'"$MEDIA_ID"'", "description": "A vitamin C serum in a glass dropper bottle"},
    "items": [
      {"studio": "ugc_video", "card": "talk"},
      {"studio": "ugc_fotos", "card": "ugc_mirror"},
      {"studio": "wiggle", "card": "wiggle"},
      {"studio": "ugc_fotos", "card": "ugc_kitchen"}
    ],
    "max_credits": '"$PRICE"'
  }')

# 3. Wait until it finishes.
echo "$START" | jq -r '.runs[] | "\(.studio) \(.id)"' | while read S ID; do
  while :; do
    STATUS=$(curl -s "https://staglight.ai/api/v1/studio/$S/runs/$ID" -H "Authorization: Bearer $STAGLIGHT_API_KEY" | jq -r .status)
    case "$STATUS" in succeeded|partial|failed) break ;; esac; sleep 10
  done
  # 4. Download every file in one zip.
  curl -s -L -o "$ID.zip" "https://staglight.ai/api/v1/studio/$S/runs/$ID/outputs.zip" -H "Authorization: Bearer $STAGLIGHT_API_KEY"
done

What it costs

TemplatePrice
UGC Video / Talks about it169 cr
UGC Shots / Mirror Selfie18 cr
Wiggle Clip / The wiggle clip94 cr
UGC Shots / Kitchen Counter18 cr

Prices from the server at the default settings. The estimate call gives the exact price for your inputs, for free.

Inputs

NameTypeAllowed
product.media_idrequiredThe product photo media id Image
product.descriptionOne line about the product string
itemsrequiredThe templates in the pack object[] Up to 12, each {studio, card} from GET /api/v1/studio/pack

Files are media ids from POST /api/v1/uploads. View documentation

Try it by hand

The same workflow runs in the studio, on the same balance. Use it to see the result before you write code.

Sign up to try it