States by Country API
This API provides an endpoint to retrieve all states within a specific country.
1. List States by Country
Endpoint
- URL:
/api/v1/core/<str:country_id>/states/ - Method:
GET - Permission Required:
AllowAny
Description
Retrieve a list of all states belonging to a specific country.
Path Parameters
country_id(Required): The ID of the country to retrieve states for.
Request Payload
This endpoint does not require any request payload.
Response Examples
Success
[
{
"id": 1,
"name": "California",
"code": "CA"
},
{
"id": 2,
"name": "Texas",
"code": "TX"
},
{
"id": 3,
"name": "New York",
"code": "NY"
}
]
Error
{
"error": "Country not found"
}