Taal: NL
Op de wachtlijst

De productfotostudio als API.

De Herofab-API ontvangt een productfoto en de naam van een tool en verwerkt de taak op de achtergrond; het opvragen van de taak of een ondertekende webhook meldt wanneer de afbeelding klaarstaat om te downloaden.

  • Bearer-API-sleutels
  • Ondertekende webhooks
  • Tot 100 taken per batch
  • OpenAPI 3.1 en llms.txt
curl https://app.herofab.app/api/v1/jobs -H "Authorization: Bearer $HEROFAB_API_KEY" -H "Idempotency-Key: $(uuidgen)" --json '{"tool": "ghost_mannequin", "inputs": {"garment": "ASSET_ID"}}'
Zo werkt het

Van foto tot eindbeeld.

01

Versturen

Productfoto uploaden en een taak aanmaken met een tool en de instellingen; de taak reserveert de benodigde credits.

POST /api/v1/assetsPOST /api/v1/jobs

02

Opvragen

De taak opvragen tot die klaar is, of een ondertekende webhook ontvangen zodra dat zo is.

GET /api/v1/jobs/{id}

03

Downloaden

De afbeelding ophalen via de asset-ID van de uitvoer van de taak.

GET /api/v1/assets/{id}/content

Volledig voorbeeld: foto uploaden, taak aanmaken, wachten, downloaden
API=https://app.herofab.app/api/v1
AUTH="Authorization: Bearer $HEROFAB_API_KEY"

# 1 · Upload the product photo
ASSET_ID=$(curl -s "$API/assets" \
  -H "$AUTH" \
  -F [email protected] | jq -r .id)

# 2 · Create the job
BODY=$(jq -n --arg garment "$ASSET_ID" '{tool: "ghost_mannequin",
  inputs: {garment: $garment}, params: {style: "3d", backdrop: "white"}}')
JOB_ID=$(curl -s "$API/jobs" \
  -H "$AUTH" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq -r .id)

# 3 · Poll until the job is finished
while :; do
  JOB=$(curl -s "$API/jobs/$JOB_ID" -H "$AUTH")
  STATE=$(jq -r .state <<<"$JOB")
  [ "$STATE" = queued ] || [ "$STATE" = running ] || break
  sleep 2
done
[ "$STATE" = succeeded ] || { jq -r .failure.code <<<"$JOB"; exit 1; }

# 4 · Download the image
OUTPUT_ID=$(jq -r '.outputs[0].asset_id' <<<"$JOB")
EXT=$(jq -r '.outputs[0].content_type | ltrimstr("image/")' <<<"$JOB")
curl -sL "$API/assets/$OUTPUT_ID/content" -H "$AUTH" -o "result.$EXT"
Early access

Uw volgende collectie, deze week gefotografeerd.

20 gratis credits wanneer early access opent. Geen creditcard nodig.