ScreenshotNeo

BlogHow-to

How to Capture a Webpage in Hindi Using ApiFlash

Use ApiFlash’s accept_language=hi parameter to request a Hindi version of a webpage, then save the screenshot or return JSON links.

By the ScreenshotNeo team4 October 20267 min read

To request a Hindi webpage capture with ApiFlash, send a request to its screenshot endpoint with a valid access_key, a complete target URL, and accept_language=hi. That parameter asks the target site to serve a Hindi version by setting the request’s Accept-Language header. It does not translate a page that has no Hindi version. See the ApiFlash API documentation and its language FAQ.

1. Make the basic Hindi capture request

ApiFlash accepts GET requests with query parameters and POST requests with form data. By default, the response is the screenshot image data. The examples below save that response as a WebP file. Replace the placeholder key and target URL with your own values.

cURL

curl -G "https://api.apiflash.com/v1/urltoimage" \
  --data-urlencode "access_key=YOUR_ACCESS_KEY" \
  --data-urlencode "url=https://example.com/" \
  --data-urlencode "accept_language=hi" \
  --data-urlencode "format=webp" \
  -o screenshot.webp

Python

Install the dependency with python -m pip install requests, then run:

import requests

endpoint = "https://api.apiflash.com/v1/urltoimage"
params = {
    "access_key": "YOUR_ACCESS_KEY",
    "url": "https://example.com/",
    "accept_language": "hi",
    "format": "webp",
}

response = requests.get(endpoint, params=params, timeout=90)
response.raise_for_status()

with open("screenshot.webp", "wb") as image_file:
    image_file.write(response.content)

Node.js

This example uses the built-in fetch available in current Node.js releases:

import { writeFile } from 'node:fs/promises';

const endpoint = new URL('https://api.apiflash.com/v1/urltoimage');
endpoint.search = new URLSearchParams({
  access_key: 'YOUR_ACCESS_KEY',
  url: 'https://example.com/',
  accept_language: 'hi',
  format: 'webp',
});

const response = await fetch(endpoint);
if (!response.ok) {
  throw new Error(`ApiFlash returned HTTP ${response.status}: ${await response.text()}`);
}

await writeFile('screenshot.webp', Buffer.from(await response.arrayBuffer()));

Use a URL-building library or the language’s query-parameter encoder. This matters when the target address itself contains query parameters, ampersands, spaces, or other characters that need URL encoding. The target URL must include https:// or http://.

2. Check that Hindi is actually available

accept_language=hi requests Hindi from the site. Whether the screenshot is in Hindi depends on how that site handles the header. The site may instead use a saved language preference, a locale-specific path, a cookie, or a language menu. If so, use the site’s documented Hindi URL or its supported session and cookie flow. The ApiFlash FAQ confirms the parameter sets the requested language; it does not describe a translation service.

For a useful check, first open the target page in a browser configured for Hindi and confirm the site serves Hindi without manual interaction. Then capture that same page with the parameter. If the site requires login or a language-selection cookie, account for that requirement using supported ApiFlash parameters and the site’s own access rules.

3. Choose the response and capture options

Keep response_type at its default, image, when you want the image bytes directly. Set response_type=json when your application needs a JSON document containing result links. Do not save a JSON response with an image extension; inspect the response content type and parse the selected format correctly.

Need Parameter Practical detail
Request Hindi accept_language=hi Sets the target request’s Accept-Language header.
Capture the entire page full_page=true Captures the full page; height is ignored in this mode.
Wait for a known element wait_for=.content-ready Waits for a matching CSS selector. Capture aborts with an error if it does not appear within 15 seconds.
Choose page readiness wait_until=network_idle Options documented include dom_loaded, page_loaded, and network_idle. The default is network idle.
Add a short fixed wait delay=2 Delay is in seconds, up to 10. The documentation recommends selector or readiness waits when possible.
Choose image encoding format=jpeg|png|webp JPEG is the documented default. WebP has documented dimension limits after scaling.
Request JSON links response_type=json Returns JSON with links instead of the image bytes as the response.
Refresh instead of using cache fresh=true Forces a fresh capture rather than a cached screenshot.
Set cache lifetime ttl=86400 TTL is in seconds; the documented range is 0 to 2,592,000 seconds.

The documented default viewport is 1920 × 1080 pixels. ApiFlash also documents width and height bounds and a maximum viewport pixel area; check the current parameter table before using unusually large dimensions or scale factors. Full-page capture can create very tall output, so use it only when the complete page is needed.

Full-page capture with a readiness wait

curl -G "https://api.apiflash.com/v1/urltoimage" \
  --data-urlencode "access_key=YOUR_ACCESS_KEY" \
  --data-urlencode "url=https://example.com/hi/" \
  --data-urlencode "accept_language=hi" \
  --data-urlencode "full_page=true" \
  --data-urlencode "wait_for=.article-content" \
  --data-urlencode "format=png" \
  -o page.png

Use a selector that genuinely appears after the content you need is rendered. If a selector wait times out, verify the selector against the rendered page and consider a documented wait_until condition instead. A fixed delay can help with a known short animation or late update, but it may be wasteful on fast pages and insufficient on slow ones.

4. Protect credentials and handle output safely

The access key is a credential. A GET request places it in the query string, so avoid putting that request directly in browser-visible code or public pages. For an application used by other people, keep the key on a controlled server and have the server make the ApiFlash request. The documented POST method accepts form data and can avoid placing parameters in the URL, but the credential still needs normal secret-handling practices.

Check the HTTP status before writing a response as an image. When using JSON mode, parse JSON and follow the returned result-link fields according to the API response. Treat target URLs and response bodies as untrusted input in your own service, and apply your usual limits for request time, file size, and allowed destinations.

5. Troubleshoot common problems

Symptom or status Likely cause What to do
Capture is not in Hindi The target has no Hindi version, ignores the header, or relies on a path, cookie, or saved preference. Confirm the site responds to Accept-Language: hi; try its Hindi-specific URL or required supported session state.
400 Bad Request Invalid parameters or a target URL ApiFlash cannot capture. Check parameter spelling and values; make sure the URL is complete and encoded as a query value.
401 Unauthorized The key is invalid or revoked. Check the key in the ApiFlash dashboard and update the server-side secret.
402 Payment Required The plan’s monthly screenshot quota is exhausted. Check quota and plan status before retrying repeatedly.
403 Forbidden A requested feature is unsupported by the current plan. Check the plan and remove or change the unsupported option.
429 Too Many Requests The request rate is too high. Reduce concurrency and retry with backoff; observe the response details and current documented rate limits.
500 Internal Server Error The capture service failed to handle the situation. Retry cautiously and retain the status and response body for diagnosis.
Blank or incomplete page Content is delayed, lazy-loaded, or blocked by the target site. Use an appropriate wait_for/wait_until setting, test the target page directly, and check whether its bot protection blocks capture.
Selector wait fails The selector is wrong or the element does not appear before the documented 15-second limit. Verify the selector and whether the target renders it inside a frame or after user interaction; choose a suitable readiness condition if possible.
Saved file cannot be opened An error or JSON response was saved as if it were an image. Check the HTTP status and content type before writing; parse the response according to response_type.

ApiFlash’s documentation describes target-site bot protection as a possible reason a capture may fail. A request parameter cannot guarantee access to a site that blocks automated capture.

6. Performance, reliability, and cost considerations

Use a cache for repeated captures of unchanged inputs. ApiFlash documents a default TTL of 86,400 seconds and a maximum of 2,592,000 seconds; the documentation says requests served from cache do not count against monthly quota. Use fresh=true when updated page content matters more than cache reuse. Choose the shortest wait that reliably includes the required content, and avoid full-page captures when a viewport capture is sufficient.

For production use, handle non-success responses, set client timeouts, and retry transient failures selectively with backoff. Do not retry invalid-input, authentication, unsupported-plan, or quota errors as though they were temporary. ApiFlash documents a default rate of 20 requests per second with a burst size of 400; confirm current limits and quota behavior in its documentation and account before planning throughput.

7. Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. One request can return an image or PDF, and its API supports a language request header alongside other capture settings. See the ScreenshotNeo API documentation for current usage details.

curl -G "https://api.screenshotneo.com/v1/shot" \
  -d access_key=YOUR_API_KEY \
  --data-urlencode url=https://example.com/hi/ \
  -o shot.webp
import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com/hi/", "accept_language": "hi"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://example.com/hi/',
  accept_language: 'hi',
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
await Bun.write('shot.webp', res);

ScreenshotNeo removes cookie banners, popups, and chat widgets before the shot. Bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. These cleanup and billing features do not translate a page: the target still needs to serve Hindi in response to the language preference.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

8. Frequently asked questions

Does accept_language=hi translate English text?

No. It requests Hindi from the site; translation is up to the target website.

Can I capture only the visible viewport?

Yes. Leave full_page unset or false to capture the viewport.

Set response_type=json and handle the JSON response rather than saving it as an image.

Why might the site still appear in another language?

The site may prioritize its own locale selection, URL, cookie, or account preference over the request header.