ForHosting KIT · SEO

Optimize images for SEO

Every image you ship either helps or hurts your page speed score, and most teams find out which one only after Search Console complains. This endpoint takes a raw image and returns a web-ready version — recompressed, converted to the best format for the browser that will request it, and renamed so the filename itself carries keyword signal instead of a camera's serial number.

● StablePer request + per image$0.002
Use it from WebAPIEmailApp soonTelegram soon

Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.

The problem: heavy images, dumb filenames

A product photo straight off a camera or a designer's export is rarely fit for the web. It is often three to ten times larger than it needs to be, saved in a format the browser has to decode the hard way, and named something like IMG_4821.JPG that tells search engines nothing about what is in the picture. Multiply that across a catalog of a few hundred SKUs or a blog with years of posts and you get a site that Core Web Vitals quietly penalizes, and a set of images that never show up in image search because there is no textual anchor for them to rank on.

What the endpoint actually does

Send a request to POST /seo/image-optimize with the source image and a target slug or keyword hint, and the task pipeline strips unnecessary metadata, re-encodes the pixels at a quality level tuned to stay visually lossless while cutting bytes, and picks the output container — modern formats when the workflow calls for maximum compression, JPEG or PNG when compatibility matters more. The response includes a suggested filename built from your hint, normalized to lowercase, hyphenated, and free of the underscores and spaces that break URLs.

A short note on why format even matters

JPEG has been the default for photographic web images since the mid-1990s because it does one thing well: throw away detail the human eye barely notices. PNG solved a different problem — lossless output for graphics with sharp edges and transparency. The newer generation of formats built on video codec research closes the gap between those two use cases, often producing a visually equivalent image at a fraction of the size. Choosing correctly per image, rather than applying one setting to an entire folder, is the actual lever that moves page weight.

Where it sits in a pipeline

Because the call is asynchronous, it slots naturally into a content pipeline that already runs other steps in sequence: pull the image from a CMS upload, optimize it here, push the optimized file and its filename suggestion into the same record, then move on to alt-text generation or a sitemap update. You get a task_id immediately and the finished file arrives by webhook, so nothing in your pipeline has to poll or wait synchronously.

Who this is for

Teams publishing at volume feel this first: marketplaces onboarding new sellers, publishers with an image-heavy archive, and agencies rebuilding a client's media library ahead of a Core Web Vitals push. If your CMS accepts uploads faster than a human can rename and compress them, this is the step that keeps output quality consistent no matter who uploaded the file.

Marketplace seller onboarding

Automatically optimize every product photo a new seller uploads, so listing pages stay fast without a manual review queue.

Blog archive cleanup

Batch-process years of legacy post images to recover Core Web Vitals scores without touching the original media library.

Headless CMS upload hook

Trigger the endpoint the moment an editor uploads an image, and store the optimized version plus its SEO-ready filename in the same content entry.

Pre-launch site migration

Run an entire asset folder through the endpoint before a redesign goes live, so the new site never inherits old bloat.

Does this API optimize images for SEO automatically, or do I set the format myself?

The endpoint picks the output format automatically based on the image content and your compatibility needs, though you can constrain it if a specific format is required.

Is there a free tier to test the image optimize endpoint?

There's no free tier — free tiers get abused and slow everyone down. Access runs on a prepaid ForHosting KIT balance: top up from $10.00 (it never expires) and each request is charged at its published price, so a call with no balance returns HTTP 402. No subscription, no tokens, no invented credits, and a failed task is never charged.

What image formats can I submit?

Common raster formats used on the web are accepted as input; the response tells you exactly what was produced so your pipeline can branch on it.

How is the SEO filename generated?

It is derived from the keyword hint or slug you send, normalized into a lowercase, hyphenated string safe for URLs — you always get to see it before you use it.

Can I send hundreds of images in bulk?

Yes, submit one async request per image; each returns its own task_id so you can track and reconcile large batches independently.

What happens if the optimization fails?

Failed tasks are retried automatically up to three times and, if they still fail, you get a clear error with no charge — you only pay for results that were actually delivered.

How do I get the optimized file back?

Via a signed webhook call, which we recommend for automation, or a signed link valid for 24 hours if you prefer to fetch it manually.

How much does it cost per image?

$0.002 per request plus $0.005 per image processed, billed only on successful completion.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/seo/image-optimize

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.

curl -X POST https://api.kit.forhosting.com/seo/image-optimize \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image":"https://ejemplo.com/imagen.jpg"}'
{
  "image": "https://ejemplo.com/imagen.jpg"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "seo.image_optimize",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002
Per image$0.005

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →