Testing and going live
The free sandbox, test scenarios and the checklist before you go live.
Test keys (fs_test_) run the same checks, statuses, webhooks, limits and error codes as live keys. They use no credits and return sample images marked SAMPLE, at 2K; the photos you send are checked, then thrown away, never stored.
Test scenarios
Pick the outcome of a test job with test_scenario. Live keys can't send it.
test_scenario | What happens |
|---|---|
succeeded (default) | The job succeeds with a sample image |
content_refused | The job fails with content_refused |
generation_failed | The job fails with generation_failed |
slow | The job stays processing for about 2 minutes, then succeeds |
curl https://api.foodshot.ai/v1/generations \
-H "Authorization: Bearer $FOODSHOT_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"image_url": "https://docs.foodshot.ai/samples/dish.jpg",
"style_id": "pure-shot",
"test_scenario": "content_refused"
}'To test request errors, such as image_too_small, send a request that causes them.
Go-live checklist
When FoodShot opens live access for your account, you accept the API Terms with one checkbox and create a live key. Your account can start with trial credits, valid for 30 days, so you can judge real results on your own dishes.
- Live keys are only on your servers, in a secret manager or environment variables.
- Each photo has one
Idempotency-Key, reused with the same body on every retry. - Your client timeout is 60 seconds, and
429and5xxanswers are retried afterRetry-After. - Your webhook endpoint verifies signatures, answers
2xxwithin 10 seconds and handles each event once. - Results are downloaded from your server and stored on your side within 30 days.
- Your code reads
output.content_type: results are JPEG or PNG, as yourformatasks. - Your upload screen shows the photo tips, and each error code has a message for the vendor.
- Results are reviewed before they are published.
- Your vendors agree to their photos being processed, as Data and privacy describes.
metadataholds opaque ids only, never personal data.- You watch the
account.low_balancewebhook, so credits don't run out unnoticed. - If you plan a large import at launch, you have told us.