Skip to main content

List Countries

Retrieves a list of all countries.

HTTP Request

GET/api/locations/countries

Authorization

Authorization

  • Required: Yes
  • Permission: Admin or Staff
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Query Parameters

ParameterTypeDefaultDescription
limitinteger10Number of results to return per page
offsetinteger0Number of results to skip before returning results
searchstringSearch term to filter results by `id`, `name`, or `code`
orderingstringField to order results by (`id`, `active`, `name`, `code`)

Example Requests

1import requests
2
3response = requests.get('http://www.example.com/api/locations/countries', 
4  params={
5      'limit': 5,
6      'ordering': 'name',
7      'search': 'Iran'
8  },
9  headers={'Authorization': 'Token <your_api_key>'}
10)
11print(response.json())

Status Codes

CodeDescription
200List retrieved successfully
400Bad request — invalid input
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the country
nameStringName of the country
codeStringISO code of the country (e.g., "IR")