CDN explained
Dedicated Flag Hosting
To keep our website fast and organized, we separate raw country data from assets like images and videos. While country JSON is hosted on our API, all flag artwork is hosted separately on our CDN at cdn.reqi.dev.
When you fetch a country record, the image fields return full URLs pointing directly to their respective CDN links. The API host only serves JSON, so trying to obtain images from api.reqi.dev at /flags/* will return 404.
Clean ISO Code URLs
Public flag URLs use lowercase two-letter country codes followed by their image formats. At the moment, we only support .svg and .png:
Redirect Shortcuts
If you prefer using shortcut paths, /get endpoints automatically redirect to the actual file. You can call these directly on the CDN, or through the API under /v1/flags/get/.... If you don't specify a format, the shortcut defaults to PNG:
- GET https://cdn.reqi.dev/get/nl →
/flags/nl.png - GET https://cdn.reqi.dev/get/png/nl →
/flags/nl.png - GET https://cdn.reqi.dev/get/svg/nl →
/flags/nl.svg - GET https://api.reqi.dev/v1/flags/get/svg/nl →
/flags/nl.svg
Cache-Busting with Hashed URLs
If you want to cache flags aggressively without worrying about stale images, you can request a content-hashed filename instead of an ISO code. Just pass ?opaque=true or ?anonymous=true on any /get redirect or JSON request, and the URL will swap the country code for a 24-character hex hash. These hashed images can also be useful if you're hosting a quiz game and don't want the website to expose ISO codes to the frontend.
Caching & CORS
Because standard ISO-code URLs and hashed URLs serve different purposes, they use different caching rules:
- Standard ISO URLs are cached for up to 24 hours. This ensures that if a country updates its flag, clients pick up the change within a day.
- Hashed URLs are cached for 1 year and marked immutable. This makes them a safe choice for long-term browser caching.
All successful flag responses also include the Access-Control-Allow-Origin: * header, so you can load them directly into web apps on any domain without running into CORS issues.
Artwork Credits & Docs
All SVG flag designs are sourced from the MIT-licensed flag-icons project, which we hash and distribute through our own CDN. For full request schemas and curl examples, check out the documentation at https://docs.reqi.dev/flags.