Country.io Data API

Country.io exposes six static JSON files under https://country.io. Each file is a flat object keyed by ISO 3166-1 alpha-2 country code and maps to a single reference value: country name, capital city, continent code, ISO3 code, dialing prefix, or currency code. The endpoints are open and unauthenticated.

OpenAPI Specification

country-io-data-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Country.io Data API
  description: >-
    Country.io publishes a small set of static JSON files that map ISO 3166-1
    alpha-2 country codes to common reference data (country names, capital
    cities, continent codes, ISO 3166-1 alpha-3 codes, telephone dialing
    codes, and currency codes). Each endpoint returns a flat JSON object
    keyed by the two-letter country code.
  version: '1.0'
  contact:
    name: Country.io
    url: https://country.io/contact/
  license:
    name: Country.io Data
    url: https://country.io/
externalDocs:
  description: Country.io Data Index
  url: https://country.io/data/
servers:
  - url: https://country.io
    description: Country.io static JSON host
tags:
  - name: Names
    description: Country names by ISO2 code.
  - name: Capitals
    description: Capital cities by ISO2 code.
  - name: Continents
    description: Continent codes by ISO2 country code.
  - name: ISO3
    description: ISO 3166-1 alpha-3 codes by ISO2 country code.
  - name: Phone
    description: International dialing codes by ISO2 country code.
  - name: Currency
    description: Currency codes by ISO2 country code.
paths:
  /names.json:
    get:
      operationId: getCountryNames
      summary: Get country names keyed by ISO2 code
      tags:
        - Names
      responses:
        '200':
          description: A JSON object mapping ISO2 country codes to country names.
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                example:
                  US: United States
                  GB: United Kingdom
                  FR: France
  /capital.json:
    get:
      operationId: getCapitals
      summary: Get capital cities keyed by ISO2 code
      tags:
        - Capitals
      responses:
        '200':
          description: A JSON object mapping ISO2 country codes to capital city names.
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                example:
                  US: Washington
                  GB: London
                  FR: Paris
  /continent.json:
    get:
      operationId: getContinents
      summary: Get continent codes keyed by ISO2 country code
      tags:
        - Continents
      responses:
        '200':
          description: A JSON object mapping ISO2 country codes to two-letter continent codes (AF, AN, AS, EU, NA, OC, SA).
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                example:
                  US: NA
                  GB: EU
                  JP: AS
  /iso3.json:
    get:
      operationId: getIso3
      summary: Get ISO 3166-1 alpha-3 codes keyed by ISO2 code
      tags:
        - ISO3
      responses:
        '200':
          description: A JSON object mapping ISO2 country codes to ISO 3166-1 alpha-3 codes.
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                example:
                  US: USA
                  GB: GBR
                  FR: FRA
  /phone.json:
    get:
      operationId: getPhoneCodes
      summary: Get international dialing codes keyed by ISO2 country code
      tags:
        - Phone
      responses:
        '200':
          description: A JSON object mapping ISO2 country codes to international dialing prefixes.
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                example:
                  US: '1'
                  GB: '44'
                  FR: '33'
  /currency.json:
    get:
      operationId: getCurrencyCodes
      summary: Get currency codes keyed by ISO2 country code
      tags:
        - Currency
      responses:
        '200':
          description: A JSON object mapping ISO2 country codes to ISO 4217 currency codes.
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                example:
                  US: USD
                  GB: GBP
                  FR: EUR