Skip to content

Countries API

Endpoint

GET https://api.backend.traveln.ai/v1/countries/?limit=20&offset=0

List available countries.

Authentication: Authorization: Api-Key <partner_key>

Query parameters

Parameter Type Required Description
limit integer No Max items to return
offset integer No Items to skip for paging

Example requests

curl "https://api.backend.traveln.ai/v1/countries/?limit=20&offset=0" \
  -H "Authorization: Api-Key <partner_key>"
const res = await fetch("https://api.backend.traveln.ai/v1/countries/?limit=20&offset=0", {
  headers: { Authorization: "Api-Key <partner_key>" },
})
const data = await res.json()
import requests

res = requests.get(
    "https://api.backend.traveln.ai/v1/countries/",
    params={"limit": 20, "offset": 0},
    headers={"Authorization": "Api-Key <partner_key>"},
)
data = res.json()

Example response

{
    "count": 188,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": "e50e73e1-003a-4127-bacc-8e562662b332",
            "code": "lb",
            "name": "Lebanon",
            "phone_code": "+961",
            "supported": true,
            "flag": "https://s3.me-south-1.amazonaws.com/traveln.media.data/countries-flag/dummy_data/flags/lb.png"
        },
        {
            "id": "c3e7bb7a-2a01-4281-b9fa-b4c48032fce9",
            "code": "ae",
            "name": "United Arab Emirates",
            "phone_code": "+971",
            "supported": true,
            "flag": "https://s3.me-south-1.amazonaws.com/traveln.media.data/countries-flag/dummy_data/flags/ae.png"
        }
    ]
}

Error responses

  • 401 Unauthorized: missing/invalid Api-Key.
  • 403 Forbidden: key lacks permission.
  • 422 Validation Error: invalid query parameters.
  • 500 Server Error: unexpected error.