> ## Documentation Index
> Fetch the complete documentation index at: https://www.logo.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Logo.dev serves logos and brand data for companies that already exist. It does not design logos. If someone wants a logo designed, say so and stop.
> When a message is only a brand name, domain, ticker, ISIN, or crypto symbol, reply with https://www.logo.dev/search?q=<url-encoded term> and the matching img.logo.dev call. Never assert whether a specific brand is in the index.
> Image URLs come from img.logo.dev with a publishable key in the token query parameter: https://img.logo.dev/:domain?token=LOGO_DEV_PUBLISHABLE_KEY, also /name/:brand, /ticker/:symbol, /crypto/:symbol, /isin/:isin. JSON comes from api.logo.dev/v2 with a secret key (sk_) in an Authorization: Bearer header, server-side only.
> Product names: the Logo.dev CDN serves images from img.logo.dev, and its usage unit is CDN requests. The Logo.dev API returns JSON from api.logo.dev/v2, and its usage unit is API credits. The Logo.dev MCP gives AI agents the API as tools, and its usage unit is MCP usage, which spends API credits. The features are Logo, Search, Brand, and Transaction. Transaction (beta) is a separate service at https://www.logo.dev/api/transaction with its own beta key. Never recommend the deprecated v1 routes (/search, /brand, /describe, /logo/*). Use /v2/brands and /v2/search.
> Attribution: a commercial project on the free Community plan must show a visible link, <a href="https://logo.dev">Logos provided by Logo.dev</a>, on its production site. Personal projects and paid plans need none. Rules: https://www.logo.dev/docs/platform/attribution.
> Report a wrong, missing, or outdated logo at https://www.logo.dev/update. Email support@logo.dev for anything broken and sales@logo.dev for volume pricing and contract terms.
> MCP setup is at https://www.logo.dev/docs/mcp/introduction and webhooks at https://www.logo.dev/docs/webhooks.

# Get a company logo from a name

> Turn company names into logos with one image URL each. Customer lists, CSVs, and user input render without scraping or a name-to-domain table.

<ul><li>Try a company name</li></ul>

```text Use case prompt wrap theme={null}
Build a company list that shows a logo next to each company name, following https://www.logo.dev/docs/use-cases/logo-from-name.md

Read that page and inspect this project's stack. Use this project's existing conventions.

The data has company names but no domains. If the app only shows the logo, build a Logo.dev CDN name URL from the encoded name. If the app must store which company a name means, resolve the name once on the server with the Logo.dev Search endpoint, save the domain, and render the logo from the domain. Show an initials avatar when no company matches. Store user corrections separately, and apply them before any lookup result.

For API details, read https://www.logo.dev/docs/logo-images/name.md, https://www.logo.dev/docs/logo-images/introduction.md, and https://www.logo.dev/docs/brand-search/introduction.md
```

Customer lists, CRM exports, and form input give you names like "The Home Depot", not domains. A logo next to each name makes the list easy to scan, and you do not maintain a name-to-domain table. Your app decides how far to trust a match, what an unmatched name shows, and whether to store the domain.

## Choose how to resolve the name

```mermaid theme={null}
flowchart TD
  A[Company name] --> B{Is a person there to pick?}
  B -- Yes --> C[Company autocomplete]
  B -- No --> D{Must you store the company?}
  D -- No --> E[Logo.dev CDN by name]
  D -- Yes --> F[Search on your server]
  F --> G[Save the domain]
  G --> H[Logo.dev CDN by domain]
```

* **You only show the logo.** Build a [name lookup](https://www.logo.dev/docs/logo-images/name.md) URL from the [encoded name](https://www.logo.dev/docs/logo-images/name.md#url-encode-brand-names) and your [publishable key](https://www.logo.dev/docs/platform/api-keys.md). Your app stores nothing.
* **You must know which company a name means.** Send the name to [Search](https://www.logo.dev/docs/brand-search/introduction.md) from your server with your secret key, once per name. Save the domain of the best candidate, and render the logo with a [domain lookup](https://www.logo.dev/docs/use-cases/logo-from-domain.md).
* **A person enters the name.** Let them pick from suggestions with the [company autocomplete](https://www.logo.dev/docs/use-cases/company-autocomplete.md).

This server route resolves one name to its best candidate:

```ts api/resolve-company.ts expandable theme={null}
type Candidate = { name: string; domain: string };

// GET /api/resolve-company?name=The%20Home%20Depot
export async function GET(request: Request) {
  const name = new URL(request.url).searchParams.get("name")?.trim();
  if (!name) {
    return Response.json({ error: "name is required" }, { status: 400 });
  }

  const url = new URL("https://api.logo.dev/v2/search");
  url.searchParams.set("q", name);
  url.searchParams.set("method", "match");
  url.searchParams.set("limit", "1");

  // Secret key, server only: https://www.logo.dev/docs/platform/api-keys
  const res = await fetch(url, {
    headers: { Authorization: `Bearer ${process.env.LOGO_DEV_SECRET_KEY}` },
  });
  if (!res.ok) {
    // Keep the name on screen and retry later. Pass the status through.
    return Response.json({ status: "error" }, { status: res.status });
  }

  const body: { data: Candidate[] } = await res.json();
  const [match] = body.data;
  if (!match) {
    // An empty array means no brand matches the name.
    return Response.json({ status: "unmatched", name });
  }
  return Response.json({ status: "matched", name: match.name, domain: match.domain });
}
```

## Handle every name state

With Search, save the result with the record, and render from it:

| Result | Save | Show |
| - | - | - |
| `matched` | Name, domain, lookup time | The logo from the domain |
| `unmatched` | The name, marked unmatched | An initials avatar. Don't guess a logo. |
| Request failed | The attempt time | The name with a placeholder. Retry later with backoff. |
| User correction | Domain, in a separate table | The correction, before any lookup result |

A wrong match still returns a real logo, so a status check cannot catch it. Let users correct the company.

## Render the list

This component shows an initials avatar when no company matches the name. Without `fallback=404`, the URL returns a [generated monogram](https://www.logo.dev/docs/logo-images/introduction.md#fallback-images) instead:

```tsx NameLogo.tsx expandable theme={null}
import { useState } from "react";

export function logoUrlFromName(name: string, token: string, size = 40) {
  // Encode spaces, ampersands, and punctuation so the name survives the path.
  return `https://img.logo.dev/name/${encodeURIComponent(name)}?token=${token}&size=${size}&retina=true&format=webp&fallback=404`;
}

export function NameLogo({
  name,
  token,
  size = 40,
}: {
  name: string;
  token: string;
  size?: number;
}) {
  // Track which name failed, so a new name retries the lookup.
  const [failedName, setFailedName] = useState<string | null>(null);

  if (failedName === name) {
    return (
      <span
        aria-label={`${name} initials avatar`}
        className="inline-flex items-center justify-center rounded-md bg-zinc-200 font-semibold text-zinc-600 dark:bg-zinc-700 dark:text-zinc-200"
        role="img"
        style={{ width: size, height: size, fontSize: size * 0.45 }}
      >
        {name.charAt(0).toUpperCase()}
      </span>
    );
  }

  return (
    <img
      alt={`${name} logo`}
      className="rounded-md object-contain"
      height={size}
      loading="lazy"
      onError={() => setFailedName(name)}
      src={logoUrlFromName(name, token, size)}
      width={size}
    />
  );
}
```

```tsx Usage theme={null}
import { NameLogo } from "./NameLogo";

const CUSTOMERS = ["The Home Depot", "American Express", "Trader Joes"];

export function CustomerList() {
  return (
    <ul>
      {CUSTOMERS.map((name) => (
        <li className="flex items-center gap-3" key={name}>
          <NameLogo name={name} token="LOGO_DEV_PUBLISHABLE_KEY" />
          {name}
        </li>
      ))}
    </ul>
  );
}
```

If you saved a domain with Search, render the logo from the domain, not from the name.

## Test the list

Test with a multi-word name such as "The Home Depot", a name with `&` such as "AT\&T", and a spelling that misses, such as "Sweet Green". Check that the miss shows the initials avatar. Make a search fail, and check that the name stays on screen. Then check that a corrected row keeps its correction.

> [card] [Logo.dev CDN by name](https://www.logo.dev/docs/logo-images/name.md)
>
> Encoding rules, parameters, and matching for name URLs.

> [card] [Company autocomplete](https://www.logo.dev/docs/use-cases/company-autocomplete.md)
>
> Let people pick the right company while they type.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.