How to Use ApiFlash to Create Website Thumbnails for a Hindi Blog
Generate Hindi blog thumbnails with ApiFlash: choose dimensions and format, preserve Devanagari rendering, handle caching and errors, and keep your API key private.
To create a website thumbnail for a Hindi blog with ApiFlash, send a server-side request to its URL-to-image endpoint with your access key, a fully qualified page URL, a thumbnail_width, and an output format. ApiFlash returns image bytes by default; save those bytes as a file or upload them to your blog’s media storage. For Hindi content, verify that the target page itself serves the right language and that its Devanagari fonts have loaded before capture. accept_language can set the request’s language header, but it does not translate a page.
This guide uses ApiFlash’s documented endpoint and options. See the ApiFlash API documentation, FAQ, and guides for current details.
1. Get an ApiFlash access key and choose the thumbnail shape
- Create or retrieve an access key from your ApiFlash account dashboard.
- Choose a public target page URL, including
https://orhttp://. - Decide the thumbnail’s output width and image format. Use a viewport capture for a conventional card image; use a full-page capture only when a tall image is actually useful.
- Make the request from a server, build step, or trusted worker. Do not put your access key in browser-visible JavaScript, HTML, or a public repository.
The API endpoint is https://api.apiflash.com/v1/urltoimage. Requests can use GET or POST; the examples below use GET. URL-encode the target URL when constructing a query string. Standard HTTP clients handle this when given query parameters separately.
2. Make a thumbnail with cURL
This request asks for a 600-pixel-wide WebP thumbnail and writes the returned image bytes to thumbnail.webp:
curl --fail --silent --show-error -G "https://api.apiflash.com/v1/urltoimage" \
--data-urlencode "access_key=YOUR_ACCESS_KEY" \
--data-urlencode "url=https://example.com/hindi-article" \
--data-urlencode "thumbnail_width=600" \
--data-urlencode "format=webp" \
--output thumbnail.webp
Replace the placeholder key and URL. Keep the key private. --fail makes cURL return an error for unsuccessful HTTP statuses instead of treating an error response as an image.
3. Runnable Python example
Install the HTTP client with python -m pip install requests. Then run this script from a trusted server or local environment, supplying the key through an environment variable:
import os
from pathlib import Path
import requests
access_key = os.environ["APIFLASH_ACCESS_KEY"]
params = {
"access_key": access_key,
"url": "https://example.com/hindi-article",
"thumbnail_width": 600,
"format": "webp",
}
response = requests.get(
"https://api.apiflash.com/v1/urltoimage",
params=params,
timeout=90,
)
response.raise_for_status()
Path("thumbnail.webp").write_bytes(response.content)
print("Saved thumbnail.webp")
Set APIFLASH_ACCESS_KEY in the process environment before running the script. The 90-second client timeout is a client-side limit in this example, not a promise that ApiFlash will wait that long; the API’s documented wait_until_timeout parameter is capped at 30 seconds.
4. Runnable Node.js example
This example uses the built-in fetch API available in modern Node.js releases and writes the image response to disk:
import { writeFile } from "node:fs/promises";
const accessKey = process.env.APIFLASH_ACCESS_KEY;
if (!accessKey) throw new Error("Set APIFLASH_ACCESS_KEY first");
const params = new URLSearchParams({
access_key: accessKey,
url: "https://example.com/hindi-article",
thumbnail_width: "600",
format: "webp",
});
const response = await fetch(
`https://api.apiflash.com/v1/urltoimage?${params}`
);
if (!response.ok) {
throw new Error(`ApiFlash returned HTTP ${response.status}`);
}
await writeFile("thumbnail.webp", Buffer.from(await response.arrayBuffer()));
console.log("Saved thumbnail.webp");
5. Select dimensions, format, and response type
Viewport size and thumbnail width are different controls
width and height set the browser viewport used to render the page. thumbnail_width sets the output image width and preserves the aspect ratio. Start with the viewport that resembles the layout you want represented, then set the output width to suit the blog card or publishing system. A narrow viewport can trigger a mobile layout; increasing only the output width does not change how the site was rendered.
ApiFlash documents that thumbnail_width is ignored when full_page=true. If you need the entire page, plan for a tall output and resize or crop it in your own publishing pipeline if necessary.
Choose an image format
| Format | When to choose it | Quality setting |
|---|---|---|
webp |
A compact thumbnail format when your blog delivery path supports it. | quality is supported. |
jpeg |
A broadly compatible format for photographic or mixed page previews. | quality is supported; documented default is JPEG at quality 80. |
png |
When you need a lossless image format. | The dossier does not list a PNG quality control. |
Use format to select jpeg, png, or webp. For JPEG and WebP, adjust quality to trade file size against detail. Check the resulting image at the actual display size: small Hindi text can become unreadable even when the source capture is sharp.
Image bytes or JSON
The default response_type=image returns image data directly, which is convenient when saving a file. Use response_type=json when your workflow needs the JSON document containing screenshot links and optional extracted page data. Handle the response according to the selected type; do not save a JSON response with an image extension.
6. Make Hindi text render correctly
The API captures what the target page renders. It does not translate English into Hindi. If the target site chooses localized content based on the incoming language header, set accept_language to the desired language tag. The site must still have Hindi content and serve it for that request.
- Check the target URL directly and confirm the article is already in Hindi.
- Use the site’s own web fonts when consistent Devanagari rendering matters; system fonts can differ between rendering environments.
- Allow the font and page content to load. Prefer waiting for a meaningful element with
wait_forover adding an arbitrary delay when possible. - Inspect the saved thumbnail at its final card width. Look for missing glyphs, clipped matras, awkward line wrapping, or a crop that hides the headline.
accept_language is an HTTP request header option. It may influence a site that varies content by request language, but it cannot force a site to offer Hindi or change the page’s content by itself.
7. Control page readiness, crop, and interruptions
| Option | Use | Important behavior |
|---|---|---|
wait_until |
Choose a readiness condition: network_idle, dom_loaded, or page_loaded. |
The documented default is network_idle. wait_until_timeout caps waiting at 30 seconds. |
wait_for |
Wait for a CSS selector that marks the content you need. | If the selector does not appear, it times out after 15 seconds. |
delay |
Add a fixed delay for content that appears after initial navigation. | Prefer a condition or selector when it can express readiness more reliably. |
element |
Capture a specific element by CSS selector. | Useful for a page’s hero image or article card, if that element is present. |
crop |
Capture a defined rectangular region. | Use when the desired preview is a specific region rather than the viewport. |
no_cookie_banners |
Suppress common cookie banners. | Verify the target result; site implementations vary. |
no_ads |
Suppress ads in the capture. | Useful for a cleaner preview where supported. |
For example, add parameters such as wait_for=article, no_cookie_banners=true, or no_ads=true to a request when they fit the target page. Encode each parameter using your HTTP library rather than manually concatenating unescaped values. Some sites load important content only after a user interaction or apply bot protection; capture options cannot guarantee every page is capturable.
8. Cache thumbnails and refresh them deliberately
Repeatedly generating an unchanged thumbnail wastes requests and can make publishing slower. ApiFlash provides ttl to control cache duration from 0 to 2,592,000 seconds, and fresh=true to bypass a cached screenshot. Identical cached requests do not count against the monthly screenshot quota according to its documentation.
- For stable articles, set a TTL that matches how often the source page changes.
- When publishing an update that should appear immediately, request a fresh capture or change the cache policy for that capture.
- Keep a saved copy in your own media storage if your blog needs a durable asset independent of a temporary capture URL.
- Decide whether your publishing system should reuse a previous thumbnail after a temporary capture failure.
9. Keep the access key off the public website
A browser-side request exposes its query string, including the access key, to anyone who can inspect the page or network traffic. Make the ApiFlash request from a server-side route, a build pipeline, or a trusted worker, then return or store the image for your frontend. ApiFlash’s guides describe proxy approaches using Nginx or Cloudflare Workers to keep the key hidden. Apply access controls and avoid logging full request URLs if those logs contain credentials.
10. Troubleshoot common failures
| HTTP status or symptom | Likely cause | What to do |
|---|---|---|
400 |
Invalid parameter or a target that cannot be captured. | Check parameter spelling and allowed values, confirm the target URL is complete and reachable, and try a simpler viewport capture. |
401 |
The access key is invalid or revoked. | Retrieve a valid key from the account dashboard and ensure the server is using it. |
402 |
The monthly quota has been exceeded. | Review usage and plan limits, then reduce duplicate captures with caching or adjust the plan. |
403 |
The account plan does not support a requested feature. | Check the feature’s plan requirements and remove or replace that option if needed. |
429 |
Request rate or burst limit exceeded. | Queue or slow requests and retry with backoff. ApiFlash documents 20 requests per second with burst size 400. |
500 |
Internal capture failure. | Retry later with backoff. If the failure repeats, simplify the capture options and consult ApiFlash support or documentation. |
| Missing Hindi glyphs or wrong language | The target does not serve Hindi, its font did not load, or request language affected localization. | Verify the page itself, use the site’s own font, set accept_language if relevant, and wait for the content or font-dependent element. |
| Blank or incomplete preview | The page is still rendering, content is lazy-loaded, or the site blocks automated capture. | Wait for a relevant selector, choose an appropriate readiness condition, or check whether the site’s bot protection prevents capture. |
| Unexpectedly tall or wrong-sized result | Full-page mode and thumbnail sizing were mixed up, or viewport and output width were confused. | Remember that thumbnail_width is ignored for full_page=true; set viewport dimensions separately from output width. |
| Failed identical captures repeat | ApiFlash limits failed identical captures. | Fix the underlying URL or parameters before retrying; the documentation says failed identical captures are limited to five requests per hour. |
11. Performance, reliability, and cost
Capture latency depends on navigation, fonts, images, scripts, and the readiness condition. Keep the viewport and wait behavior as small and specific as the thumbnail requires. Waiting for network idle may be unsuitable for pages with persistent network activity; use a relevant selector or another documented wait condition when appropriate. A selector that never appears can itself cause a timeout.
For publishing pipelines, treat screenshot capture as an external dependency: check the HTTP status, keep timeouts bounded, avoid aggressive retries, and retain an existing thumbnail when a refresh fails if that fits your publishing workflow. Use caching and batch or queue work within the documented rate limits. ApiFlash documents 20 requests per second with a burst size of 400; exceeding the burst can produce HTTP 429.
ApiFlash’s service page has displayed a free tier and paid plans, but pricing and quotas can change. Check the current ApiFlash service and pricing page before estimating recurring costs. Account for how many unique pages need captures, how often they change, cache TTL, and whether a fresh capture is required at each publication.
12. Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. One GET request can return a screenshot as PNG, JPEG, WebP, or PDF. Its request options cover full-page captures with lazy images loaded, CSS-selector element capture, dark mode, device presets and custom viewports, retina scale, custom CSS and JavaScript, selector waits and network idle, request blocking, custom headers and cookies, resizing, caching, signed public image links, asynchronous jobs, bulk capture, and more. See the ScreenshotNeo API documentation for parameter details.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Replace the example URL with the page you want to capture. Cookie banners, popups, and chat widgets are removed before the shot; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers say which outcome occurred. An MCP server lets AI agents, including Claude and Cursor, call screenshot tools. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.
Start free with 1,000 screenshots a month and no card.
13. FAQ
Does accept_language translate a page into Hindi?
No. It sets the Accept-Language request header. The target website must provide Hindi content and choose to serve it for that request.
Should a blog card use a full-page screenshot?
Usually a viewport capture is easier to fit into a card. Full-page mode is useful when the whole page is the intended artifact, and ApiFlash ignores thumbnail_width in that mode.
Can ApiFlash capture every website?
No. A site may be inaccessible or protected by bot checks. ApiFlash notes that proxy needs depend on the protection level, so test the specific target rather than assuming it will work.
How do I keep the thumbnail current?
Choose a TTL based on the source page’s update frequency. Use fresh=true when you need to bypass the cache for a particular capture.


