Fetch Countries
Search or list countries with dial codes and abbreviations. Returns up to 10 results.
POST
/tools/countries
Description
This endpoint retrieves countries with names in English and Spanish, dial codes, and abbreviations. Search by any field or retrieve all (up to 10).
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
search | String | No | Search term (name, dial code, or abbreviation) |
Code Examples
curl -X POST "https://api-v3.sweeppea.com/tools/countries" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"search": "Spain"}'
Response
200 OK
{
"Response": true,
"Data": {
"TotalResults": 1,
"Countries": [
{
"NameEnglish": "Spain",
"NameSpanish": "EspaƱa",
"DialCode": "+34",
"Abbreviation": "ES"
}
]
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
NameEnglish | String | Country name in English |
NameSpanish | String | Country name in Spanish |
DialCode | String | International dial code (e.g., "+34") |
Abbreviation | String | ISO country code (e.g., "ES") |
Notes
- Optional Search: Omit
searchto retrieve all countries (max 10). - Maximum Results: Returns up to 10 results per request.
- Bilingual: Includes names in both English and Spanish.
- Search Fields: Searches across all fields (names, dial code, abbreviation).