Migration guide
Replace Google's s2/favicons URL
Many apps use https://www.google.com/s2/favicons?domain=... in an <img src> because it returns an image directly with no API key. FaviconAPIs is a favicon API that requires a key and returns JSON with a CDN URL to a crisp 256×256 PNG — so the swap is a small integration change, not a one-line URL replacement.
What you have today
<Avatar
src={`https://www.google.com/s2/favicons?domain=${brand.domain}&sz=128`}
/>The browser loads an image from Google's endpoint. There is no account or billing tied to your app.
What changes with FaviconAPIs
- Licensed usage: every call is tied to your API key and counts toward your monthly quota (see Usage & billing in the docs).
- JSON first: you call
GET /api/v1/favicon?url=...with your key, then use theurlfield in your UI. - Don't put the secret in
<img src>— use a server fetch or your own proxy so the key never leaks viaReferer.
Recommended pattern (server or proxy)
Resolve the favicon URL on the server (or in a Route Handler) with Authorization: Bearer fav_live_..., then pass the returned CDN url to your avatar component. Cache domain → image URL in your database or cache layer so you don't call the API on every page view.
// Pseudocode: server-side (key in env, never in the browser)
const res = await fetch(
`https://faviconapis.com/api/v1/favicon?url=${encodeURIComponent(
"https://" + brand.domain
)}`,
{ headers: { Authorization: `Bearer ${process.env.FAVICONAPIS_KEY}` } }
);
const { url: faviconUrl } = await res.json();
// Then: <Avatar src={faviconUrl} />FAQ
- Does the domain in the URL identify my account?
- No. Your API key identifies your account. The
urlparameter only selects which site's favicon to fetch. - Do cached responses count toward my quota?
- Yes — each successful API response counts as one call. See docs: Usage & billing.