← Back to API Ninjas
Get a country's flag as an SVG image in base64 format.
Returns one country's flag as a base64-encoded SVG image. Requires a 2-letter ISO-3166 alpha-2 `country` code. For URLs of all supported flags use /allcountryflags.
API Ninjas·$0.001 per call
Example code
// Using @orth/sdk - The simplest way to call APIs
// Install: npm install @orth/sdk
import Orthogonal from "@orth/sdk";
const orthogonal = new Orthogonal({
apiKey: process.env.ORTHOGONAL_API_KEY,
});
const output = await orthogonal.run({
api: "api-ninjas",
path: "/v1/countryflag",
query: {
"country": "example"
}
});
console.log(output);Query parameters
countryrequired
string
2-letter ISO-3166 alpha-2 country code (e.g. US, CA, FR). For countries in the United Kingdom, use GB for Great Britain, GB-ENG for England, GB-SCT for Scotland, GB-WLS for Wales, GB-NIR for Northern Ireland.