Wiring AltGen Into Your Upload Pipeline With the API
The dashboard is fine for one-off batches, but if images move through your product constantly, you don’t want a human in the loop for alt text. Here’s how to wire AltGen straight into your own upload path.
Get a scoped API key
Create one from Settings → API Keys. Keys are scoped per workspace, optionally expire, and can be revoked without touching anything else in your integration.
curl -X POST https://api.altgen.io/v1/images/generate \
-H "Authorization: Bearer $ALTGEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://cdn.yourstore.com/sneaker.jpg",
"preset": "ecommerce",
"style": "concise",
"languages": ["en", "de", "tr"]
}'
The response comes back with the primary alt text plus a translation per requested language:
{
"altText": "Burgundy low-top sneaker with a white sole, floating on a yellow background",
"translations": { "de": "…", "tr": "…" },
"status": "completed",
"creditsCost": 1
}
Two ways to consume results
Synchronous — call the endpoint and wait for the response. Simple, but only makes sense for single images or low volume.
Webhooks — for anything at scale, subscribe to generation events instead. AltGen pushes a payload to your endpoint as soon as an image finishes processing, so your upload handler doesn’t sit there waiting on a batch of 500 images.
A typical CMS integration
- Editor uploads an image to your CMS.
- Your upload handler calls
POST /v1/images/generatewith the image URL. - AltGen processes it and fires a webhook back to your endpoint on completion.
- Your handler writes the returned alt text straight into the image’s metadata field.
No dashboard, no manual review step, no image that ships without alt text because someone forgot to fill in a field.
Retrying failures without babysitting a batch
If a generation fails, call PATCH /v1/images/{id}/retry instead of resubmitting the whole thing. It’s the same mechanism the bulk batches use internally, just exposed for cases where you’re managing individual images through the API.
That’s the whole surface area: one endpoint to generate, list, update, and retry, plus webhooks if you don’t want to poll. Full reference is in the API docs.