# Brandfetch Brand Assets Scraper (`rainminer/brandfetch-brand-assets-scraper`) Actor

Resolve any brand to its real logos, icons, and symbols. Returns every Brandfetch asset variant ranked by priority, flags placeholder and lettermark fallbacks so you never ship a fake logo, and can download the image files.

- **URL**: https://apify.com/rainminer/brandfetch-brand-assets-scraper.md
- **Developed by:** [rainminer](https://apify.com/rainminer) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 brand resolveds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Brandfetch Brand Assets Scraper

Resolve any brand to its **real** logo, icon, and symbol, ranked by priority — and know for certain which assets are genuine and which are Brandfetch's generated placeholders.

### What it returns

One dataset row per brand:

- `brandId`, `name`, `domain`, `qualityScore` — the resolved Brandfetch brand
- `hasRealAssets` — whether genuine brand artwork exists at all
- `best` — the highest-priority asset
- `bestSquare` — the asset closest to 1:1, the one you want for an avatar or app icon
- `assets[]` — every variant, each with `type`, `theme`, `url`, `format`, `width`, `height`, `aspectRatio`, `bytes`, `sha256`, `real`, `placeholder`, `lettermark`, `priority`, and `storedKey`

With `downloadAssets` on, the image files are written to the run's key-value store under `asset-<brandId>-<type>-<theme>-<sha>.ext`, ready to hand to an upload step.

### Why the verification matters

Brandfetch's asset CDN answers **HTTP 200 with a placeholder image** when it has no artwork for a brand — it never returns 404. There are five such placeholders, each byte-identical across every brand that lacks that asset. Meanwhile the search API returns a lettermark URL for *every* brand, including ones with full logo sets, so the obvious check ("is the URL a fallback?") rejects good brands and accepts bad ones.

This actor compares SHA-256 hashes: against a registry of the five known placeholders, against each brand's own lettermark, and against hashes it saw for *other* brands in the same run. That last part is self-learning — a placeholder the registry has not seen yet still gets caught the second time it appears.

### Priority

Higher `priority` wins:

1. Real artwork beats any fallback (worth 10,000 points).
2. `icon` (30) → `logo` (25) → `symbol` (15) — an icon is the compact mark and suits avatars best.
3. Dark theme preferred over light.
4. Larger pixel area preferred.

Use `bestSquare` instead when you need a 1:1 image.

### Input

| Field | Default | Notes |
| --- | --- | --- |
| `queries` | — | Domains or names. A domain is exact: `nike.com`. |
| `assetTypes` | all | `logo`, `icon`, `symbol` |
| `maxWidth` | 512 | Resolution hint for the generic icon endpoint |
| `maxAssetsPerBrand` | 12 | Cap on `assets[]` |
| `includeFallback` | true | Return lettermark tiles for brands with no artwork |
| `downloadAssets` | true | Write image files to the key-value store |
| `brandsApiKey` | — | Optional official Brands API key, needs API credits |

### Brandfetch API key

The official [Brands API](https://docs.brandfetch.com/) returns the definitive asset list plus brand colors and fonts, and requires **API credits** on your Brandfetch account. Provide `brandsApiKey` to use it. Without a key (or without credits, which answers `403 no_api_credits`) the actor uses the same public asset CDN that brandfetch.com itself serves, which needs no key.

Check your key's credit balance before relying on the API path.

### Example

```json
{
  "queries": ["nike.com", "spotify.com", "sportograf.com"],
  "assetTypes": ["logo", "icon"],
  "downloadAssets": true
}
```

### Notes

- Brandfetch returns assets at their native size; `maxWidth` does not upscale.
- A brand with `hasRealAssets: false` genuinely has no logo on Brandfetch — pick the lettermark or use the brand's own site assets.
- Pay per brand resolved, not per asset.

### Output example

```json
{
  "query": "nike.com",
  "matched": true,
  "brandId": "id_0dwKPKT",
  "name": "Nike",
  "domain": "nike.com",
  "hasRealAssets": true,
  "best": {
    "type": "logo",
    "theme": "dark",
    "format": "webp",
    "width": 800,
    "height": 278,
    "real": true,
    "priority": 10655
  }
}
```

# Actor input Schema

## `queries` (type: `array`):

Domains or brand names, one per line. A domain is the most reliable: "nike.com" resolves the exact brand, while "Nike" takes the best search match.

## `assetTypes` (type: `array`):

Any of: logo, icon, symbol. Leave empty for all three. Icons are the compact marks, logos the full lockups, symbols the standalone glyphs.

## `maxWidth` (type: `integer`):

Width used for the resolution-led icon request. Brandfetch returns its native asset size regardless, so this only affects brands with no named icon.

## `maxAssetsPerBrand` (type: `integer`):

Cap on the assets array written for each brand. The full set is usually 6 entries.

## `includeFallback` (type: `boolean`):

Keep Brandfetch's generated letter-tile when a brand has no real artwork. Useful as a placeholder; turn it off to only get genuine brand marks.

## `downloadAssets` (type: `boolean`):

Save every asset to the run's key-value store and return its key, so you can feed the files straight into an upload step.

## `requireExactMatch` (type: `boolean`):

Skip brands whose domain and name both fail to match, instead of taking Brandfetch's best-scored search hit. Turn this on when a wrong brand would be worse than no brand.

## `brandsApiKey` (type: `string`):

Optional. Only needed for the official Brands API (brand colors, fonts, full asset metadata), which requires API credits. Without it the actor uses Brandfetch's public asset CDN.

## Actor input object example

```json
{
  "queries": [
    "nike.com",
    "spotify.com",
    "stripe.com"
  ],
  "maxWidth": 512,
  "maxAssetsPerBrand": 12,
  "includeFallback": true,
  "downloadAssets": true,
  "requireExactMatch": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `images` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "queries": [
        "nike.com",
        "spotify.com",
        "stripe.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("rainminer/brandfetch-brand-assets-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "queries": [
        "nike.com",
        "spotify.com",
        "stripe.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("rainminer/brandfetch-brand-assets-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "queries": [
    "nike.com",
    "spotify.com",
    "stripe.com"
  ]
}' |
apify call rainminer/brandfetch-brand-assets-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rainminer/brandfetch-brand-assets-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ntw1GUyUlvxnsBTOm/builds/AGukQOjzizpI1Pa8L/openapi.json
