API Documentation
Simple, powerful, and designed for developers
React component
RecommendedThe official drop-in component. Renders an <img>, polls the x-brandicons-state header, and auto-upgrades the placeholder once the real icon arrives — no reload needed.
Live <BrandIcon /> — same component, same API key
import { BrandIcon } from "react-brandicons";export function CompanyLogo() {return (<BrandIcondomain="stripe.com"apiKey="YOUR_API_KEY"size="medium"loadingPlaceholder="@loader-spin"placeholder="@empty"/>);}
bun add react-brandiconsnpm i react-brandiconspnpm add react-brandiconsQuick Start
Use the following URL pattern to fetch brand icons:
https://cdn.brandicons.dev/icons/{domain}/{size}?key=YOUR_API_KEYSize (path segment):
small— 32×32medium— 64×64 (default)large— 128×128vector— SVG when available
Optional placeholders:
?p=— shown when the icon is definitively not found?pl=— shown while we're still searching
Reference a built-in (e.g. @image-off, @loader-spin, @globe) or one of your own uploaded names. Twelve built-ins are available by default.
Or use @letter to draw a square with the domain's initials. Pick a palette that fits your site — @letter-pastel, @letter-vibrant, or muted by default — or pass your own color as @letter:0ea5e9.
Set nothing and you get @empty — a thin neutral X that reads on light and dark pages. Every built-in can be themed: add -light or -dark (e.g. @globe-dark), or set your own colors with @globe:ffffff:1f2937 (background then line; none background = no fill).
Backgrounds for transparent logos:
?bg=auto— bakes our contrast-safe tile into the image so the logo stays visible on colored or dark surfaces?bg=0ea5e9— force a color (6-digit hex, no#) to match your UI
Opt-in: leave it off and the icon is served as-is (transparent), so it composes with your own rounded containers and cards.
Example:
<img src="https://cdn.brandicons.dev/icons/spotify.com/medium?key=YOUR_API_KEY&p=@empty&pl=@loader-spin&bg=auto" alt="Spotify" />
How Icon Discovery Works
Brandicons uses an intelligent discovery system to find and cache brand icons:
Loading state
On the first request for a new domain we serve your ?pl= placeholder and trigger a background search. Response carries x-brandicons-state: loading with a 10-second TTL.
Found — icon cached
The worker stores the icon globally on our CDN. Subsequent requests return the real icon (no state header) — typically within seconds.
Not found — graceful fallback
If we can't discover an icon, we serve your ?p= placeholder with x-brandicons-state: not-found and a 24-hour TTL.
Auto-upgrade with react-brandicons
The official component reads x-brandicons-state from a HEAD request and refreshes the image when the real icon arrives — no reload needed.
Usage & Caching
API Keys:
Each key is locked to a single domain (e.g. example.com + www.example.com). Keys are public by design — safe to use in <img> tags and client-side code.
Monthly Quota:
Each plan includes a monthly request quota. All requests (cache hits and misses) count toward it. No per-second rate limiting — icons are served directly from CDN edge nodes.
Caching:
Icons are cached globally on the CDN after first discovery. Subsequent requests for the same domain resolve in ~20ms in the browser from the nearest edge.
Frequently Asked Questions
Everything you need to know about BrandIcons and how it simplifies brand icon integration