List Country States

This API lists the states of a specific country.

Endpoint Information

Property Value
URL {{APP_URL}}/api/v1/countries/{country_id}/states
HTTP Method GET
Content Type application/json
Authentication APIKEY header

Request Parameters

URL Parameters

Parameter Name Parameter Type Required Description
country_id Integer Required Country ID

Example Usage

API Request

Below is an example HTTP raw request for the API request.

GET {{APP_URL}}/api/v1/countries/1/states
Content-Type: application/json
APIKEY: {{APIKEY}}

API Response

On a successful request, the API will return a response like the following:

{
    "status": true,
    "message": null,
    "data": [
        {
            "id": 1,
            "name": "Badakhshan",
            "stateCode": "BDS"
        },
        {
            "id": 2,
            "name": "Badghis",
            "stateCode": "BDG"
        },
        {
            "id": 3,
            "name": "Baghlan",
            "stateCode": "BGL"
        },
        {
            "id": 4,
            "name": "Balkh",
            "stateCode": "BAL"
        },
        {
            "id": 5,
            "name": "Bamyan",
            "stateCode": "BAM"
        }
    ]
}

Error Responses

If the API request fails, the API will return an error response like the following:

{
    "status": false,
    "errors": [
        {
            "message": "Country not found"
        }
    ]
}