FlagCDN Flag Image Metadata Scraper avatar

FlagCDN Flag Image Metadata Scraper

Pricing

from $14.69 / 1,000 results

Go to Apify Store
FlagCDN Flag Image Metadata Scraper

FlagCDN Flag Image Metadata Scraper

Scrapes flag image metadata from FlagCDN by country code and width. Returns each flag as a row with its URL, format, dimensions, file size, and last-modified header.

Pricing

from $14.69 / 1,000 results

Rating

0.0

(0)

Developer

Acquisition Automation Co.

Acquisition Automation Co.

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

3 days ago

Last modified

Share

Acquisition Automation

FlagCDN Flag Image Metadata Scraper

Scrape flag image metadata from FlagCDN for any country code, width, or the full country list. Each row returns the image URL, format, dimensions, file size, and last-modified header. No API key required. Export to CSV, JSON, Excel, or XML.

FlagCDN serves flag images for every country but its public API only returns country codes and names. This actor reads the full country list from the API, then makes HEAD requests to each flag image URL to extract the metadata that the API does not expose. You get the image format, width, height, file size, and last-modified date for every flag you request.

Who uses itWhat they scrape FlagCDN for
Frontend developersBuild a flag picker component with correct image dimensions and file sizes to avoid layout shift.
Data analystsAudit a flag dataset to confirm every country code resolves to a live image and record its attributes.
QA engineersVerify that a CDN migration preserved all flag images and their metadata.
Content managersGenerate a manifest of flag assets with last-modified dates to track updates.

What it does

This Actor collects flag image metadata from FlagCDN by country code and image width, and returns each flag as a flat row with its URL, format, dimensions, file size, and last-modified timestamp.

  • ๐ŸŒ Full country list: Leave country codes empty to process every country FlagCDN knows about.
  • ๐ŸŽฏ Targeted codes: Provide a list of ISO 3166-1 alpha-2 codes to scrape only the flags you need.
  • ๐Ÿ“ Selectable width: Choose from 20, 40, 80, 160, 320, 640, 1280, or 2560 pixels wide.
  • ๐Ÿ“ฆ Flat row output: Each flag becomes one row with its URL, format, width, height, file size, and last-modified date.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

What you can do with FlagCDN data

๐ŸŒ Build a flag asset inventory.

A frontend team scrapes all flags at 160px wide to document every image URL, its dimensions, and file size before integrating them into a design system.

๐Ÿ” Validate a country code list.

A data engineer feeds a list of 50 country codes into the actor to confirm each one returns a 200 response and records the last-modified date for freshness checks.

๐Ÿ“Š Compare image sizes across widths.

A performance analyst runs the actor at 80px, 160px, and 320px for the same 10 countries to chart how file size scales with width.

๐Ÿ”„ Monitor CDN updates.

A DevOps engineer schedules a weekly scrape of all flags at 2560px and diffs the last-modified timestamps to detect when FlagCDN refreshes its images.

Why choose this scraper

What you get
No API keyFlagCDN's public API and image endpoints need no authentication.
Image metadataGet format, dimensions, file size, and last-modified header for every flag.
Flexible scopeScrape one flag, a custom list, or the entire country catalog.
Structured exportDownload results as CSV, JSON, Excel, or XML for any downstream tool.

What a FlagCDN record looks like

Every record returns as one flat JSON row. Here is a real one from a run:

{
"url": "https://flagcdn.com/w80/ad.png",
"id": "ad",
"countryCode": "ad",
"countryName": "Andorra",
"imageUrl": "https://flagcdn.com/w80/ad.png",
"width": 80,
"height": 56,
"format": "png",
"fileSize": 600,
"lastModified": "Tue, 01 Jul 2025 15:39:52 GMT",
"status": "success"
}

Every value above comes from a real run. A field a record does not have comes back as null.

Configure the run

Drive the Actor from a list of ISO 3166-1 alpha-2 country codes and a target image width. Leave the country list empty to process every available flag, and set a max items limit to control the run size. The Input tab lists every parameter.

A first run with the defaults:

{
"maxItems": 10,
"imageWidth": "80"
}

A larger pull:

{
"maxItems": 200,
"imageWidth": "80"
}

Free users

Free-plan runs return up to 10 results as a preview. Upgrade your Apify plan to collect up to 1,000,000 results per run.

Run it

  1. Create a free Apify account with $5 in credit.
  2. Open the FlagCDN Flag Image Metadata Scraper.
  3. Set your inputs and any filters, then click Start.
  4. Export the results as CSV, Excel, JSON, or XML from the Dataset tab.

Run it programmatically through the Apify API (run-sync-get-dataset-items) or the ApifyClient for JavaScript and Python.

Use with AI agents (MCP)

Give an AI agent live access to FlagCDN through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

$claude mcp add --transport http apify "https://mcp.apify.com?tools=acquistion-automation/flagcdn-flag-metadata-scraper"

Then prompt it in plain language to run the scraper and read back the results.

Troubleshooting

Why am I getting no results?

Check that your country codes are valid ISO 3166-1 alpha-2 codes. If you left the list empty, the actor fetches the full list from FlagCDN. Also verify your max items is not set to zero.

Why is the file size zero for some flags?

FlagCDN may not always return a Content-Length header. The actor records whatever the server sends. A missing header results in a zero or null value.

Why do I get a 404 for a country code?

The code may not exist in FlagCDN's current list. The actor fetches the official code list first, but if you supply a custom code that is not served, it will record the HTTP status.

Why is the run slow with many countries?

Each flag requires a separate HEAD request. Processing hundreds of countries takes time. Reduce the country list or increase the run timeout.

FAQ

QuestionAnswer
Does this actor download the flag images?No. It makes HEAD requests to read the HTTP headers only. You get the metadata without downloading the image body.
What metadata fields does it return?Each row includes the image URL, content type, width, height, file size in bytes, and the last-modified header.
Can I scrape all country flags in one run?Yes. Leave the country codes input empty and the actor will fetch the full country list from FlagCDN's API, then process every flag.
What image widths are available?FlagCDN serves flags at 20, 40, 80, 160, 320, 640, 1280, and 2560 pixels wide. You pick one width per run.
Do I need an API key for FlagCDN?No. FlagCDN's codes.json endpoint and image URLs are publicly accessible with no authentication.
How do I limit the number of flags scraped?Set the max items field. On the Free plan the limit is 10 items. Paid plans can go up to 1,000,000.
What format are the country codes?Use ISO 3166-1 alpha-2 codes, like 'us' for the United States or 'de' for Germany.
Can I export the results?Yes. The dataset can be exported to CSV, JSON, Excel, or XML from the Apify run page.

Browse the full Acquisition Automation collection for more scrapers.

๐Ÿ†˜ Need help? Open an issue in the Issues tab of this Actor with your run ID, your input, and what you expected.

Pricing

This Actor uses pay-per-result pricing: $0.01624 per result collected. You are billed only for the results you receive, so a run that returns nothing costs nothing.

โš ๏ธ Disclaimer. This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by FlagCDN. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.