# Countries

Resource class for interacting with the GunSpec Countries API. Wraps all `/v1/countries` endpoints. Instantiated internally by the GunSpec client and exposed as `client.countries`.

Source: https://docs.gunspec.io/en/sdk/countries

## client.countries.list()

`GET /v1/countries`

Auth: API key required  
Tier: Explorer+

List all countries that have adopted at least one firearm.

### Response 200 (application/json)

| Field | Type | Description |
| --- | --- | --- |
| `data` | object[] | The response payload. |
| `data[].code` | string | ISO 3166-1 alpha-2 country code. |
| `data[].firearm_count` | integer | Distinct catalogued firearms this country operates. |

```json
{
  "success": true,
  "data": [
    {
      "code": "US",
      "firearm_count": 214
    }
  ]
}
```

### Errors

| Status | Code | Message |
| --- | --- | --- |
| 400 | `VALIDATION_ERROR` | Validation error |
| 401 | `UNAUTHORIZED` | API key required |
| 403 | `FORBIDDEN` | Valid key, not permitted |
| 429 | `RATE_LIMITED` | Rate limit exceeded |
| 500 | `INTERNAL_ERROR` | Unexpected server error |

### Example

```bash
curl --request GET \
  --url 'https://api.gunspec.io/v1/countries' \
  --header 'X-API-Key: your_key'
```

## client.countries.getArsenal()

`GET /v1/countries/{code}/arsenal`

Auth: API key required  
Tier: Builder+

Get the full firearm arsenal for a specific country. Returns all firearms adopted by the country, grouped by usage type (military, law enforcement, etc.).

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | yes | ISO 3166-1 alpha-2 country code |

### Response 200 (application/json)

| Field | Type | Description |
| --- | --- | --- |
| `data` | object | The country arsenal, keyed by operator type. |
| `data.countryCode` | string | ISO 3166-1 alpha-2 code of the country, echoing the path parameter. |
| `data.arsenal` | object | Operator type -> the firearms that type operates. Keys are dynamic; entries missing a type are grouped under "unknown". |

```json
{
  "success": true,
  "data": {
    "countryCode": "AU",
    "arsenal": {}
  }
}
```

### Errors

| Status | Code | Message |
| --- | --- | --- |
| 400 | `VALIDATION_ERROR` | Validation error |
| 401 | `UNAUTHORIZED` | API key required |
| 403 | `FORBIDDEN` | Valid key, not permitted |
| 429 | `RATE_LIMITED` | Rate limit exceeded |
| 500 | `INTERNAL_ERROR` | Unexpected server error |

### Example

```bash
curl --request GET \
  --url 'https://api.gunspec.io/v1/countries/AU/arsenal' \
  --header 'X-API-Key: your_key'
```
