# States

The States API provides a list of all states of the countries enabled for you.

### **Get states in a country**

#### `GET /countries/{{countryCode}}/states`

{% tabs %}
{% tab title="Details" %}

|              |              |          |                                  |
| ------------ | ------------ | -------- | -------------------------------- |
| **Name**     | **Required** | **Type** | **Description**                  |
| countryCode  | Yes          | String   | Two char ISO code of the country |
| {% endtab %} |              |          |                                  |

{% tab title="Request Sample" %}

```
curl --location --request GET '{{url}}/{{countryCode}}/states' \
--header 'X-Client-Id: {{client_id}}' \
--header 'X-Client-Secret: {{client_secret}}' \
--header 'Content-Type: application/json'
```

{% endtab %}

{% tab title="Response Sample" %}

```
[
   {
       "code": "CA",
       "country": "US",
       "name": "California"
   }
]
```

{% endtab %}
{% endtabs %}

### **Get states by code**

#### `GET /countries/{{countryCode}}/states`**/{{stateCode}}**

{% tabs %}
{% tab title="Details" %}

|              |              |          |                                  |
| ------------ | ------------ | -------- | -------------------------------- |
| **Name**     | **Required** | **Type** | **Description**                  |
| countryCode  | Yes          | String   | Two char ISO code of the country |
| stateCode    | Yes          | String   | State code                       |
| {% endtab %} |              |          |                                  |

{% tab title="Request Sample" %}

```
curl --location --request GET 'https://v4test.machpay.com/v4/countries/{{countryCode}}/states/{{stateCode}}' \
--header 'X-Client-Id: {{client_id}}' \
--header 'X-Client-Secret: {{client_secret}}' \
--header 'Content-Type: application/json'
```

{% endtab %}

{% tab title="Response Sample" %}

```
{
   "code": "CA",
   "country": "US",
   "name": "California"
}
```

{% endtab %}
{% endtabs %}
