List States
Retrieve a list of all states with optional filtering by country and other criteria.
HTTP Request
GET/api/locations/states
Authorization
Authorization
- Required: Yes
- Permission: Admin or Staff
- Authentication: Token-based (Authorization: Token <your_api_key>)
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | integer | — | Number of results to return per page |
| offset | integer | — | Number of results to skip before returning results |
| search | string | — | Search term to filter results by `id`, `name` and `code` |
| ordering | string | — | Field to order results by (`id`, `active`, `name`, `code`, `country`) |
| country_id | integer | — | Filter states by country ID |
| country_in | string | — | Filter states by comma-separated list of country IDs |
| active | boolean | — | Filter states by active status (true or false) |
Status Codes
| Code | Description |
|---|---|
| 200 | Successfully retrieved states list |
| 400 | Invalid query parameters |
| 401 | Authentication required |
| 403 | Insufficient permissions |
| 500 | Server error occurred |
Response Fields
| Field | Type | Description |
|---|---|---|
| id | integer | Unique state identifier |
| name | string | State name |
| code | string | State code |
| country | object | Country information |
Country Object Fields:
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the country |
| name | String | Name of the country |
| code | String | ISO code of the country (e.g., "US") |