API Get key

Images

Edit Product Photo

One precise change (a new colour, a cleaner background, a removed distraction) with everything else in the photo left untouched.

From
18 crper ad
Endpoint
POST /api/v1/studio/editar_foto/runs
Workflow id
editar_foto

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/editar_foto/estimate \
  -H "Authorization: Bearer $STAGLIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "card": "angle",
    "media": {
      "image": ["'"$MEDIA_ID"'"]
    }
  }' | 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/editar_foto/runs \
  -H "Authorization: Bearer $STAGLIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "card": "angle",
    "media": {
      "image": ["'"$MEDIA_ID"'"]
    },
    "max_credits": '"$PRICE"'
  }')

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

# 3. Wait until it finishes.
while :; do
  STATUS=$(curl -s "https://staglight.ai/api/v1/studio/editar_foto/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 result.zip "https://staglight.ai/api/v1/studio/editar_foto/runs/$ID/outputs.zip" -H "Authorization: Bearer $STAGLIGHT_API_KEY"

What it costs

TemplateFinal, best text
Another angle18 cr
Studio flat-lay18 cr
Studio shot18 cr
Change colour18 cr
Change background18 cr
Remove something18 cr
Custom edit18 cr

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

Inputs

NameTypeAllowed
cardrequiredThe template string angle, flatlay, studio, color, background, remove, free
media.imagerequiredProduct photo media id[]
media.referenceInspiration shot media id[]
media.modelModel photo media id[]
inputs.angleWhich shot enum threequarter, side, back, detail, sitting, lookaway
inputs.colorNew colour string
inputs.targetWhich part (optional) string
inputs.whoWho wears it string
inputs.instructionDescribe it string
inputs.extraAnything else (optional) string
inputs.resolutionResolution enum 1K, 2K, 4K
qualityQuality enum final
aspectShape enum 1:1, 4:5, 3:4, 16:9

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