|
| 1 | +--- |
| 2 | +name: logolink |
| 3 | +description: >- |
| 4 | + Use Context.dev Logo Link to dynamically pull in logos. Use when embedding |
| 5 | + company logos in UI (img tags, React components, CSS backgrounds, email HTML, |
| 6 | + spreadsheets), building logo walls, CRM avatars, or merchant icons — without |
| 7 | + calling the brand API from the frontend. |
| 8 | +--- |
| 9 | + |
| 10 | +# Context.dev Logo Link |
| 11 | + |
| 12 | +Logo Link delivers company logos via CDN. Pass a front-end-safe `publicClientId` and a `domain`; the URL returns raw image bytes (no JSON, no API key). |
| 13 | + |
| 14 | +**Do not** use the brand API or MCP from browser/client code for logos. Use Logo Link instead. |
| 15 | + |
| 16 | +## When to use |
| 17 | + |
| 18 | +- User wants logos in a UI, landing page, CRM, directory, or transaction list |
| 19 | +- User asks to "dynamically fetch/display company logos by domain" |
| 20 | +- High-volume logo rendering where `ctxt_secret_` keys must stay server-side |
| 21 | +- User needs a simple `<img src="...">` instead of parsing `brand.logos[]` |
| 22 | + |
| 23 | +Use the **brand API** (see `context-dev` skill) when you need stored logos, multiple variants (light/dark/icon), or colors alongside the image. |
| 24 | + |
| 25 | +## Step 1 — Get the Public Client ID |
| 26 | + |
| 27 | +1. Sign up at [context.dev/signup](https://context.dev/signup) if needed (free tier: 10,000 Logo Link requests/month). |
| 28 | +2. Copy the **Public Client ID** from [context.dev/dashboard/logolink](https://context.dev/dashboard/logolink). Keys look like `brandLL_xxx`. |
| 29 | +3. Prefer an env var the codebase already uses, e.g. `NEXT_PUBLIC_LOGOLINK_KEY` or `VITE_LOGOLINK_PUBLIC_CLIENT_ID`. Never put `ctxt_secret_` keys in client code. |
| 30 | + |
| 31 | +## Step 2 — Restrict referring domains |
| 32 | + |
| 33 | +In the Logo Link dashboard, **Edit Restrictions** and allow only domains that embed the image (e.g. `*.example.com`, `localhost:3000`). The `publicClientId` is safe in frontend code only when restrictions are set. |
| 34 | + |
| 35 | +## Step 3 — Build the URL |
| 36 | + |
| 37 | +```text |
| 38 | +https://logos.context.dev/?publicClientId=MY_PUBLIC_CLIENT_ID&domain=TARGET_DOMAIN |
| 39 | +``` |
| 40 | + |
| 41 | +- Replace `MY_PUBLIC_CLIENT_ID` with the user's ID (or env var). |
| 42 | +- Replace `TARGET_DOMAIN` with the company domain variable (bare domain, e.g. `stripe.com`). |
| 43 | +- **GET** and **HEAD** only. Response is the image file; `Content-Type` is `image/png`, `image/svg+xml`, etc. |
| 44 | +- **24-hour** `Cache-Control` on the response. Browser/CDN caching is expected. |
| 45 | +- **Fallback:** if no logo is found, Logo Link returns a generated SVG monogram — `<img>` tags never 404. |
| 46 | + |
| 47 | +## Step 4 — Implement in the codebase |
| 48 | + |
| 49 | +1. Ask where logos should appear and which domain variable drives them. |
| 50 | +2. Update **only** those locations; preserve existing fallback and `onError` patterns. |
| 51 | +3. Examples: |
| 52 | + |
| 53 | +```html |
| 54 | +<img |
| 55 | + src="https://logos.context.dev/?publicClientId=brandLL_xxx&domain=stripe.com" |
| 56 | + alt="Stripe logo" |
| 57 | +/> |
| 58 | +``` |
| 59 | + |
| 60 | +```jsx |
| 61 | +function CompanyLogo({ domain }) { |
| 62 | + const publicClientId = process.env.NEXT_PUBLIC_LOGOLINK_KEY; |
| 63 | + return ( |
| 64 | + <img |
| 65 | + src={`https://logos.context.dev/?publicClientId=${publicClientId}&domain=${domain}`} |
| 66 | + alt={`${domain} logo`} |
| 67 | + onError={(e) => { |
| 68 | + e.target.style.display = "none"; |
| 69 | + }} |
| 70 | + /> |
| 71 | + ); |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | +## Usage rules |
| 76 | + |
| 77 | +- **Allowed:** embed via URL in `<img>`, CSS `background-image`, email HTML, `=IMAGE()` in Sheets/Excel; normal browser caching. |
| 78 | +- **Not allowed:** download and re-host logos in your own storage or persist image files outside cache headers. For that, use brand APIs server-side. |
| 79 | + |
| 80 | +Logo Link requests are billed separately from API credits (no rate limit; one charge per unique logo per client per 24h). |
| 81 | + |
| 82 | +## Links |
| 83 | + |
| 84 | +- [Get logos from a domain](https://docs.context.dev/guides/get-logo-from-url) |
| 85 | +- [Logo Link dashboard](https://context.dev/dashboard/logolink) |
| 86 | +- [Pricing](https://context.dev/pricing) |
0 commit comments