API Get key

Ad formats

Product hero

Your product on a clean set with a slow camera push-in, a music bed and your text.

From
61 crper ad
Endpoint
POST /api/v1/runs
Workflow id
product_hero
product_hero
Tier
draft, standard, premium
Shape
9:16, 4:5, 1:1
Length
6 s

No example of this workflow yet. These are its real settings.

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/runs/estimate \
  -H "Authorization: Bearer $STAGLIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "product_hero",
    "options": {"tier": "draft", "aspect": "9:16", "lang": "en"}
  }' | 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/runs \
  -H "Authorization: Bearer $STAGLIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "format": "product_hero",
    "product": {
      "name": "Vitamin C serum",
      "description": "A vitamin C serum in a glass dropper bottle",
      "photos": ["'"$MEDIA_ID"'"]
    },
    "options": {"tier": "draft", "aspect": "9:16", "lang": "en"},
    "auto": true,
    "max_credits": '"$PRICE"'
  }')

ID=$(echo "$START" | jq -r .id)

# 3. Wait until it finishes.
while :; do
  STATUS=$(curl -s "https://staglight.ai/api/v1/runs/$ID?wait=30" -H "Authorization: Bearer $STAGLIGHT_API_KEY" | jq -r .status)
  case "$STATUS" in succeeded|failed|canceled|awaiting_approval|needs_attention) break ;; esac
done

# 4. Download every file in one zip.
curl -s -L -o result.zip "https://staglight.ai/api/v1/runs/$ID/outputs.zip" -H "Authorization: Bearer $STAGLIGHT_API_KEY"

What it costs

Tier9:164:51:1
Draft61 cr61 cr61 cr
Standard151 cr151 cr151 cr
Premium305 cr305 cr305 cr

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

Inputs

NameTypeAllowed
formatrequiredThe format string product_hero
product | product_idrequiredThe product: a saved one, or name, description and photos object | string product_id from POST /api/v1/products, or {name, description, photos}
options.tierTier enum draft, standard, premium
options.aspectShape enum 9:16, 4:5, 1:1
options.langLanguage of the words enum es, en
autoApprove every step within max_credits boolean true, false

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

More workflows