How do I automate blog post images with the API?

How do I automate blog post images with the API?

The imghero API lets you automatically generate hero images for blog posts as part of your publishing workflow.

How it works

  1. Call the API with your blog post URL
  2. Get a static image URL back instantly
  3. Use that URL in your HTML or CMS
  4. The image generates in the background (typically 10-30 seconds)

Example workflow

When you publish a new blog post, make a single API call:

curl -X POST https://img-hero.com/api/v1/generate/ \
  -H "Authorization: Token YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://yourblog.com/posts/my-new-article/"}'

The response includes a stable image URL:

{
  "url_id": "url_abc12345",
  "image_url": "https://img-hero.com/img/url_abc12345/",
  "status": "generating"
}

Use image_url directly in your HTML:

<img src="https://img-hero.com/img/url_abc12345/" alt="Article hero image">

The URL is stable and permanent. It will return a 404 briefly while generating, then serve your image forever.

Customizing the style

Pass the style parameter to control the visual style:

{
  "url": "https://yourblog.com/posts/my-article/",
  "style": "illustration"
}

Available styles include: photo, illustration, sketch, neon_geo, cartoon, pop_art, isometric, minimal, 3d_render, cinematic, watercolor, line_art, retro, anime, paper_cut, and auto (AI chooses).

Regenerating images

Need a different look? Call the API again with the same URL but a different style. The image at your URL will update once the new generation completes.

Integration ideas

  • Static site generators: Call the API in your build script before deploying
  • CMS webhooks: Trigger image generation when a post is published
  • CI/CD pipelines: Generate images as part of your deployment process

See the full API documentation for authentication details and all available parameters.