Loading documentation…
Loading documentation…
Call SteamCall from a server-side TypeScript runtime.
const url = new URL("https://api.steamcall.com/v2/steam/market/price");
url.searchParams.set("app_id", "730");
url.searchParams.set("market_hash_name", "Example");
url.searchParams.set("currency", "1");
const response = await fetch(url, {
headers: { "X-API-Key": process.env.STEAMCALL_API_KEY! },
signal: AbortSignal.timeout(15_000),
});
if (!response.ok)
throw new Error(`SteamCall request failed: ${response.status}`);
const data = await response.json();Run this code server-side so the key never enters the browser bundle.
Read response.headers.get("x-request-id") before handling the body, and parse the documented error envelope when response.ok is false. Avoid placing full response bodies in thrown error messages or observability breadcrumbs.
AbortSignal.timeout bounds one request. A retrying caller still needs one overall deadline and a maximum attempt count. Keep this module out of client components, service workers, and code that can be bundled for a browser.