# Country Flags Scraper (`acquistion-automation/flagcdn-country-flags-scraper`) Actor

Fetches country flags from FlagCDN and returns each as a row with a country name, ISO 3166-1 alpha-2 code, and direct PNG URLs at selected widths.

- **URL**: https://apify.com/acquistion-automation/flagcdn-country-flags-scraper.md
- **Developed by:** [Acquisition Automation Co.](https://apify.com/acquistion-automation) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $9.00 / 1,000 result items

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

![Acquisition Automation Co. Search less. Close more.](https://api.apify.com/v2/key-value-stores/AOdPHdOpeDpzEPS5f/records/banner.jpg)

## 🏳 Country Flags Scraper

> **One row per country: the ISO 3166-1 alpha-2 code, the country name in the language you pick, and direct PNG flag URLs at the widths you ask for.** Run it once, export the table, and stop hand maintaining a flag folder. No API key and no registration.

FlagCDN hosts a flag image for every country at a set of fixed widths. Getting a usable list out of it means guessing URL patterns one country at a time. This Actor builds the whole table for you: code, name and a ready URL per resolution, in a dataset you can export or read straight from the API.

| Who uses it | What they use the table for |
|---|---|
| 🧑‍💻 Developers | Filling a country picker, a pricing page or a shipping form with correct codes and images |
| 📊 Analysts building dashboards | Putting a flag next to a country row without storing image files |
| 🌍 Teams working across borders | Keeping one country list with names localized to the interface language |
| 🗂 Data teams | Seeding a reference table of country codes and names as a one time job |

### 📋 What it does

- 🏳 **Returns every country FlagCDN covers**, or only the alpha-2 codes you list.
- 🔤 **Localizes the country name** into English, Spanish, French, German, Italian, Portuguese, Chinese, Japanese or Korean.
- 📐 **Gives you a URL per width.** Pick any subset of `w80`, `w160`, `w320` and `w640`, and each row carries one URL per width you chose.
- 🖼 **Includes a preview URL** at `w320`, so a spreadsheet can render the flag in a cell.
- 🔢 **You cap the run** with a single number.
- 💾 **Exports to CSV, Excel, JSON or XML**, from the run page or the API.

### 📊 Output

Every country is one flat row. The fields below are what a `flagUrls` run returns.

| Field | Type | Description |
|---|---|---|
| 🔤 `countryCode` | string | ISO 3166-1 alpha-2 code, for example `AE` |
| 🌍 `countryName` | string | Country name in the language requested, for example `United Arab Emirates` |
| 🗣 `language` | string | The language the name was returned in, for example `en` |
| 🖼 `flagPreviewUrl` | string | Direct PNG link at `w320`, handy as a single preview column |
| 📐 `flagUrls` | object | One PNG URL per requested width, keyed `w80`, `w160`, `w320`, `w640` |
| 🕒 `scrapedAt` | string | ISO timestamp of collection |

#### Example rows

```json
{
  "flagPreviewUrl": "https://flagcdn.com/w320/ad.png",
  "countryCode": "AD",
  "countryName": "Andorra",
  "language": "en",
  "flagUrls": {
    "w80": "https://flagcdn.com/w80/ad.png",
    "w160": "https://flagcdn.com/w160/ad.png",
    "w320": "https://flagcdn.com/w320/ad.png",
    "w640": "https://flagcdn.com/w640/ad.png"
  },
  "scrapedAt": "2026-09-14T17:29:19.983Z"
}
```

```json
{
  "flagPreviewUrl": "https://flagcdn.com/w320/ae.png",
  "countryCode": "AE",
  "countryName": "United Arab Emirates",
  "language": "en",
  "flagUrls": {
    "w80": "https://flagcdn.com/w80/ae.png",
    "w160": "https://flagcdn.com/w160/ae.png",
    "w320": "https://flagcdn.com/w320/ae.png",
    "w640": "https://flagcdn.com/w640/ae.png"
  },
  "scrapedAt": "2026-09-14T17:29:20.090Z"
}
```

### ✨ Why choose this Actor

| | What you get |
|---|---|
| **Six fields, every row** | Code, name, language, preview, URL set and timestamp. Nothing to clean. |
| **No credentials** | FlagCDN is public. No key, no account, no quota. |
| **Names in nine languages** | One input switch, not a translation job. |
| **No image hosting** | Rows carry URLs, so nothing lands in your storage bucket. |
| **You pay per row** | No subscription. Around 250 countries and territories is a one time cost. |

### 🚀 How to use it

1. [Create a free Apify account](https://console.apify.com/sign-up). New accounts start with $5 of credit.
2. Open the Actor and select **Try for free**.
3. Leave `countries` empty for everything, or list the alpha-2 codes you want.
4. Pick `language`, `mode` and the `resolutions` you need, and set `maxItems`.
5. Select **Start**, then export from the **Dataset** tab as CSV, Excel, JSON or XML.

A first run:

```json
{
  "maxItems": 10,
  "mode": "flagUrls",
  "language": "en",
  "resolutions": ["w80", "w160", "w320", "w640"]
}
```

Four countries, names in Spanish, one width:

```json
{
  "countries": ["US", "MX", "CO", "ES"],
  "mode": "flagUrls",
  "language": "es",
  "resolutions": ["w320"],
  "maxItems": 10
}
```

### ⚙️ Input

| Field | Required | Description |
|---|---|---|
| `countries` | No | ISO 3166-1 alpha-2 codes to keep. Empty returns everything available |
| `mode` | No | `flagUrls` for the full PNG URL set, or `codes` for the compact name and code reference. Default `flagUrls` |
| `language` | No | Language for the country name: `en`, `es`, `fr`, `de`, `it`, `pt`, `zh`, `ja`, `ko`. Default `en` |
| `resolutions` | No | PNG widths to include, any subset of `w80`, `w160`, `w320`, `w640`. Applies in `flagUrls` mode |
| `maxItems` | No | How many flags to collect per run. Default 10 |

### 💰 Pricing

Pay per result. No subscription, and no Apify platform usage on top.

| Apify plan | Free | Bronze | Silver | Gold | Platinum | Diamond |
|---|---|---|---|---|---|---|
| Per country row | $0.012 | $0.011 | $0.010 | $0.009 | $0.009 | $0.009 |

| Rows collected | Cost on the Free plan |
|---|---|
| 100 | $1.20 |
| 250 | $3.00 |
| 1,000 | $12.00 |

**Free plan runs** return up to 10 rows as a preview. Any paid Apify plan lifts that to 1,000,000 per run.

### 🔌 Integrate with any app

The dataset is available through the Apify API as soon as the run finishes. Use `run-sync-get-dataset-items` for a one-shot call, webhooks to trigger what happens next, or the Make, Zapier, Airbyte and LangChain integrations listed on the Actor page.

### 🤖 Use with an AI agent

Give an agent live access to the flag table over the Model Context Protocol:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=acquistion-automation/flagcdn-country-flags-scraper"
```

Then ask it in plain language for a country's flag URL and have it read the result back.

### ❓ Frequently asked questions

**Does a row contain the image itself?**
No. Each row carries links to PNG files hosted by FlagCDN, so nothing is copied into your storage.

**What does `codes` mode return?**
The compact name and code reference rather than the full URL set. Use `flagUrls` when you want a link per width, which is what the example rows above show.

**Which widths can I ask for?**
`w80`, `w160`, `w320` and `w640`. Pick any subset in `resolutions`, and each row gets one URL per width you picked.

**How do I get only the countries I care about?**
List their alpha-2 codes in `countries`. Leaving it empty returns every country and territory FlagCDN covers.

**Do I need a proxy?**
No. Requests and retries are handled inside the Actor and included in the price.

**What can I export?**
CSV, Excel, JSON and XML from the run page, or JSON straight from the API.

### 🔗 More from Acquisition Automation Co.

- [DANE Colombia Statistics Scraper](https://apify.com/acquistion-automation/dane-colombia-statistics-scraper)
- [BitMart Markets Scraper](https://apify.com/acquistion-automation/bitmart-markets-scraper)
- [RAWG Video Games Scraper](https://apify.com/acquistion-automation/rawg-scraper)
- [SAM.gov Contract Opportunities Scraper](https://apify.com/acquistion-automation/sam-gov-contracts-scraper)
- [BizBuySell Scraper](https://apify.com/acquistion-automation/bizbuysell-scraper)

### About Acquisition Automation Co.

We build automation for people buying businesses. The repetitive part of an acquisition search, checking listings, pulling public records, tracking owners and assets, is work a machine should do, so the buyer's time goes into judging deals instead of collecting them.

We add new Actors regularly. If there is a source you need and do not see here, tell us.

### 🆘 Support

Open an issue in the **Issues** tab of this Actor with your run ID, the input you used, and what you expected to get back.

### ⚠️ Disclaimer

This Actor is independent and is not affiliated with, endorsed by, or sponsored by FlagCDN. It collects only publicly available data. You are responsible for using that data in compliance with the source's terms of service and applicable law.

# Actor input Schema

## `maxItems` (type: `integer`):

How many flags to collect per run.

## `mode` (type: `string`):

Codes only (compact name + code reference) or flagUrls (full PNG URL set at the requested resolutions).

## `language` (type: `string`):

Localization for the country name field.

## `countries` (type: `array`):

Optional ISO 3166-1 alpha-2 filter. Empty = return all available.

## `resolutions` (type: `array`):

PNG widths to include in each record (flagUrls mode only). Pick any subset.

## Actor input object example

```json
{
  "maxItems": 10,
  "mode": "flagUrls",
  "language": "en",
  "resolutions": [
    "w80",
    "w160",
    "w320",
    "w640"
  ]
}
```

# Actor output Schema

## `overview` (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 = {
    "maxItems": 10,
    "mode": "flagUrls",
    "language": "en",
    "resolutions": [
        "w80",
        "w160",
        "w320",
        "w640"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("acquistion-automation/flagcdn-country-flags-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 = {
    "maxItems": 10,
    "mode": "flagUrls",
    "language": "en",
    "resolutions": [
        "w80",
        "w160",
        "w320",
        "w640",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("acquistion-automation/flagcdn-country-flags-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 '{
  "maxItems": 10,
  "mode": "flagUrls",
  "language": "en",
  "resolutions": [
    "w80",
    "w160",
    "w320",
    "w640"
  ]
}' |
apify call acquistion-automation/flagcdn-country-flags-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,acquistion-automation/flagcdn-country-flags-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/4yJYjK3P90mw99y8P/builds/d4BLWdF2Kif2exvSO/openapi.json
