api-ninjas-com Country Flag API

The Country Flag API provides SVG flag images for any country, territory, or area of special interest (over 250 supported). The small file sizes are perfect for displaying flag icons on your website or populating a dropdown menu.

Operations 2

GET /v1/allcountryflags List flag URLs for all supported countries (premium only) #
GET /v1/countryflag Get the SVG flag image URLs for one country #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/api-ninjas-com:api-ninjas-com-country-flag-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

api-ninjas-com-country-flag-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Ninjas Country Flag API
  description: 'Combined OpenAPI specification for every API Ninjas endpoint. Requests go to https://api.api-ninjas.com with an `X-Api-Key` header; get a free key at https://api-ninjas.com/register. Human-readable docs: https://api-ninjas.com/api. Index for LLMs: https://api-ninjas.com/llms.txt.'
  version: 1.0.0
  contact:
    name: API Ninjas
    url: https://api-ninjas.com
  license:
    name: Proprietary
servers:
- url: https://api.api-ninjas.com
  description: API Ninjas Production
security:
- ApiKeyAuth: []
tags:
- name: Country Flag
  description: The Country Flag API provides SVG flag images for any country, territory, or area of special interest (over 250 supported). The small file sizes are perfect for displaying flag icons on your website or populating a dropdown menu.
paths:
  /v1/allcountryflags:
    get:
      tags:
      - Country Flag
      summary: List flag URLs for all supported countries (premium only)
      description: Returns flag image URLs for every supported country, territory and area. For one country's flag use /countryflag. Requires a premium subscription.
      operationId: getAllCountryFlags
      responses:
        '200':
          description: 'Successful response: an array of country flag entries.'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CountryFlagResponse'
        '401':
          $ref: '#/components/responses/CountryFlagOpenapi_Unauthorized'
        '500':
          $ref: '#/components/responses/CountryFlagOpenapi_InternalServerError'
      security:
      - ApiKeyAuth: []
  /v1/countryflag:
    get:
      summary: Get the SVG flag image URLs for one country
      description: Returns URLs of one country's square and rectangle SVG flag images. Requires a 2-letter ISO-3166 alpha-2 `country` code. For URLs of all supported flags use /allcountryflags.
      operationId: getCountryFlag
      tags:
      - Country Flag
      parameters:
      - name: country
        in: query
        description: 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.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CountryFlagResponse'
        '400':
          $ref: '#/components/responses/CountryFlagOpenapi_BadRequest'
        '401':
          $ref: '#/components/responses/CountryFlagOpenapi_Unauthorized'
        '500':
          $ref: '#/components/responses/CountryFlagOpenapi_InternalServerError'
      security:
      - ApiKeyAuth: []
components:
  responses:
    CountryFlagOpenapi_InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
    CountryFlagOpenapi_BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
    CountryFlagOpenapi_Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
  schemas:
    CountryFlagResponse:
      type: object
      properties:
        country:
          type: string
          description: 2-letter ISO-3166 alpha-2 country code.
        square_image_url:
          type: string
          format: uri
          description: URL to the square flag image in SVG format.
        rectangle_image_url:
          type: string
          format: uri
          description: URL to the rectangle flag image in SVG format.
      required:
      - country
      - square_image_url
      - rectangle_image_url
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
externalDocs:
  description: API Ninjas documentation
  url: https://api-ninjas.com/api