The Flags API provides access to country and territory information, including flag images, capitals, regions, populations, languages, currencies and the Flag of the Day (OTD).
/api/flags/[action]/[object]
| Part | Description |
|---|---|
action |
The operation to perform. |
object |
Optional value used by the selected action. |
| Endpoint | Description |
|---|---|
/api/flags |
List countries and territories. |
/api/flags/random |
Return a random country. |
/api/flags/otd |
Return the current Flag of the Day. |
/api/flags/id/{id} |
Lookup by internal ID. |
/api/flags/code/{code} |
Lookup by ISO code. |
/api/flags/name/{name} |
Lookup by country name. |
/api/flags/search/{query} |
Search by name, capital or ISO code. |
/api/flags/continent/{continent} |
Countries in a continent. |
/api/flags/region/{region} |
Countries in a region. |
/api/flags/subregion/{subregion} |
Countries in a subregion. |
/api/flags/continents |
List continents with counts. |
/api/flags/regions |
List regions with counts. |
/api/flags/count |
Flag database statistics. |
| Parameter | Example | Description |
|---|---|---|
limit |
25 | Maximum number of results returned. |
continent |
Europe | Filter countries by continent. |
region |
Caribbean | Filter countries by region. |
subregion |
Lesser Antilles | Filter countries by subregion. |
GET /api/flags
GET /api/flags?limit=50
GET /api/flags/random
GET /api/flags/random?continent=Europe
GET /api/flags/otd
GET /api/flags/id/5
GET /api/flags/code/GB
GET /api/flags/code/US
GET /api/flags/name/France
GET /api/flags/search/ang
GET /api/flags/continent/Europe
GET /api/flags/region/Caribbean
GET /api/flags/subregion/Lesser Antilles
GET /api/flags/continents
GET /api/flags/regions
GET /api/flags/count
otd value, it is returned.otd field is set to the current date.Every country response includes image URLs generated from the ISO country code.
"images": {
"100": "https://jarvisbot.uk/media/flags/png100px/gb.png",
"250": "https://jarvisbot.uk/media/flags/png250px/gb.png",
"1000": "https://jarvisbot.uk/media/flags/png1000px/gb.png",
"svg": "https://jarvisbot.uk/media/flags/svg/gb.svg"
}
{
"id": 5,
"code": "AI",
"name": "Anguilla",
"capital": "The Valley",
"continent": "North America",
"region": "Caribbean",
"subregion": "Lesser Antilles",
"population": "15000",
"area_km2": "91",
"currency": "East Caribbean Dollar (XCD)",
"languages": [
"English"
],
"calling_code": "+1-264",
"timezones": [
"UTC−4"
],
"independent": "no",
"government": "British Overseas Territory",
"major_cities": [
"The Valley",
"Blowing Point",
"Sandy Ground"
],
"description": "Anguilla is a small British territory known for its pristine beaches, turquoise waters, and luxury tourism.",
"otd": null,
"images": {
"100": "https://jarvisbot.uk/media/flags/png100px/ai.png",
"250": "https://jarvisbot.uk/media/flags/png250px/ai.png",
"1000": "https://jarvisbot.uk/media/flags/png1000px/ai.png",
"svg": "https://jarvisbot.uk/media/flags/svg/ai.svg"
}
}
[
{
"continent": "Africa",
"count": 54
},
{
"continent": "Europe",
"count": 44
},
{
"continent": "North America",
"count": 41
}
]
{
"total": 249,
"continents": 7,
"regions": 23,
"otd_used": 156
}
All Jarvis APIs require a valid API token. Tokens are issued through the Jarvis Developer Portal and are associated with an account plan which determines access levels and request limits.
Every request must include a valid API token. Requests made without a token or with an invalid token will be rejected.
Authorization: YOUR_API_TOKEN
X-API-Token: YOUR_API_TOKEN
GET /api/flags/random?token=YOUR_API_TOKEN
curl \
-H "Authorization: YOUR_API_TOKEN" \
https://jarvisbot.uk/api/flags/random
fetch("https://jarvisbot.uk/api/jokes/random", {
headers: {
"Authorization": "YOUR_API_TOKEN"
}
})
.then(r => r.json())
.then(console.log);
$response = file_get_contents(
"https://jarvisbot.uk/api/questions/random",
false,
stream_context_create([
'http' => [
'header' => [
'Authorization: YOUR_API_TOKEN'
]
]
])
);
$data = json_decode($response, true);
| Plan | Daily Requests | API Access |
|---|---|---|
| Free | 100 Requests | Basic APIs |
| Premium | 10,000 Requests | All APIs |
| Enterprise | Unlimited | All APIs + Priority Support |
API usage is automatically monitored based on your account type. Once your limit is reached, requests will be temporarily blocked until your allowance resets.
| Plan | Limit | Window |
|---|---|---|
| Free | 100 Requests | 24 Hours |
| Premium | 10,000 Requests | 24 Hours |
| Enterprise | Unlimited | No Restriction |
{
"success": false,
"error": "invalidToken",
"msg": "API token required"
}
{
"success": false,
"error": "invalidToken",
"msg": "Invalid API token"
}
{
"success": false,
"error": "rateLimit",
"msg": "API limit exceeded",
"plan": "free",
"limit": 100
}