API Reference - Countries
Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108120
← Back to API Reference | Getting Started
Countries
The Countries table is a global reference list of country codes and names used throughout the platform for member location fields, search filtering, and geographic data validation. This is a read-only reference table; while CRUD endpoints are available, typical usage is GET operations only to look up valid country codes and names.
list_countries — DB table: list_countriesThe Country Object
| Field | Type | Description |
|---|---|---|
country_id | integer | Unique country ID (primary key, read-only) |
country_code | string | ISO 3166-1 alpha-2 country code (EG US, CA, GB); 2 characters |
country_name | string | Full country name (EG United States); max 255 characters |
active | integer | Whether this country is active in the platform; 1 = active, 0 = inactive |
List Countries
Returns a paginated list of country records.
Example Request
curl -X GET "https://www.yourdomain.com/api/v2/list_countries/get?limit=25" \ -H "X-Api-Key: your-api-key-here"
Example Response
{
"status": "success",
"message": [
{
"country_id": "1",
"country_code": "AF",
"country_name": "Afghanistan",
"active": "1"
},
{
"country_id": "236",
"country_code": "US",
"country_name": "United States",
"active": "1"
}
],
"total": "250",
"current_page": 1,
"total_pages": 10,
"next_page": "MipfKjI="
}Retrieve a Country Record
Example Request
curl -X GET "https://www.yourdomain.com/api/v2/list_countries/get/236" \ -H "X-Api-Key: your-api-key-here"
Example Response
{
"status": "success",
"message": [
{
"country_id": "236",
"country_code": "US",
"country_name": "United States",
"active": "1"
}
],
"total": "1",
"current_page": 1,
"total_pages": 1
}Create a Country Record
Creates a new country record. This endpoint is available but not typically needed as the platform ships with a complete country list.
Example Request
curl -X POST "https://www.yourdomain.com/api/v2/list_countries/create" \ -H "X-Api-Key: your-api-key-here" \ -d "country_code=XX" \ -d "country_name=Example Country" \ -d "active=1"
Example Response
{
"status": "success",
"message": {
"country_id": "251",
"country_code": "XX",
"country_name": "Example Country",
"active": "1"
}
}Update a Country Record
Example Request
curl -X PUT "https://www.yourdomain.com/api/v2/list_countries/update" \ -H "X-Api-Key: your-api-key-here" \ -d "country_id=251" \ -d "active=0"
Example Response
{
"status": "success",
"message": {
"country_id": "251",
"country_code": "XX",
"country_name": "Example Country",
"active": "0"
}
}Delete a Country Record
Example Request
curl -X DELETE "https://www.yourdomain.com/api/v2/list_countries/delete" \ -H "X-Api-Key: your-api-key-here" \ -d "country_id=251"
Example Response
{
"status": "success",
"message": "list_countries record was deleted"
}