# COUNTRY_CODE_REQUIRED

The country '‹value›' is not valid. Send the country's ISO 3166-1 alpha-2 code in country_code (for example, GB for the United Kingdom).

<Callout type="info">
**Category:** [Customers](/errors/category/cliente)
</Callout>

| | |
|---|---|
| HTTP status | `422` Unprocessable Content |
| Retry | After fixing the cause |

## When it happens

An address carries a `country` that is neither a real ISO 3166-1 alpha-2 code nor the official name of a country in Spanish, English or Catalan (for example `UK`), or a `country_code` that is not a real code.

## How to fix it

Send `country_code` with the ISO code (`GB`, not `UK`).

## Retry

Not as is: the same request fails the same way. Fix the cause described above, then send the request again, under a new `Idempotency-Key` if the body changed.

## Returned by

The operations where this code is most likely. The list is not exhaustive.

- [`POST /v1/companies/{company_id}/customers`](/customers/createCompanyCustomer)
- [`PATCH /v1/companies/{company_id}/customers/{customer_id}`](/customers/patchCompanyCustomer)
- [`POST /v1/companies/{company_id}/invoices`](/invoices/createCompanyInvoice)
- [`PATCH /v1/companies/{company_id}/invoices/{invoice_id}`](/invoices/patchCompanyInvoice)
- [`POST /v1/accounts/{account_id}/companies`](/companies/createCompany)

## Example response

When this error occurs, the API answers `422` Unprocessable Content with a JSON body of this shape:

```json
{
  "type": "https://docs.beel.es/errors/COUNTRY_CODE_REQUIRED",
  "title": "COUNTRY_CODE_REQUIRED",
  "detail": "The country '‹value›' is not valid. Send the country's ISO 3166-1 alpha-2 code in country_code (for example, GB for the United Kingdom).",
  "instance": "/v1/<resource>",
  "errors": [],
  "success": false,
  "error": {
    "code": "COUNTRY_CODE_REQUIRED",
    "message": "The country '‹value›' is not valid. Send the country's ISO 3166-1 alpha-2 code in country_code (for example, GB for the United Kingdom).",
    "details": {}
  },
  "meta": {
    "timestamp": "2026-05-21T10:00:00Z",
    "request_id": "4bf92f3577b34da6a3ce929d0e0e4736"
  }
}
```

The `type` URI is stable and always resolves to this page.

## Message

<Tabs items={["English", "Spanish", "Catalan"]}>
  <Tab value="English">{"The country '‹value›' is not valid. Send the country's ISO 3166-1 alpha-2 code in country_code (for example, GB for the United Kingdom)."}</Tab>
  <Tab value="Spanish">{"El país '‹value›' no es válido. Indica el código ISO 3166-1 alfa-2 del país en country_code (por ejemplo, GB para Reino Unido)."}</Tab>
  <Tab value="Catalan">{"El país '‹value›' no és vàlid. Indica el codi ISO 3166-1 alfa-2 del país a country_code (per exemple, GB per al Regne Unit)."}</Tab>
</Tabs>

Send the request with `Accept-Language: <es|en|ca>` to receive the message in your preferred language.

> Placeholders like `‹value›` are filled in at runtime with the actual values of your request.

## Other errors in this category

<div className="grid grid-cols-2 gap-3 not-prose">
  <Card title="ALTERNATIVE_ID_AND_NIF_EXCLUSIVE" description="The customer cannot carry both a NIF and an alternative identifier. Use only one" href="/errors/ALTERNATIVE_ID_AND_NIF_EXCLUSIVE" />
  <Card title="ALTERNATIVE_ID_COUNTRY_REQUIRED" description="The country of the alternative identifier is missing (alternative_id.country_code). It is required except for the PASSPORT and NOT_REGISTERED types, which are taken as Spanish when it is omitted." href="/errors/ALTERNATIVE_ID_COUNTRY_REQUIRED" />
  <Card title="ALTERNATIVE_ID_INVALID" description="The alternative identifier is not valid" href="/errors/ALTERNATIVE_ID_INVALID" />
  <Card title="ALTERNATIVE_ID_REQUIRES_SPAIN" description="Type NOT_REGISTERED (07) is only valid for Spain; received country: '‹value›'" href="/errors/ALTERNATIVE_ID_REQUIRES_SPAIN" />
  <Card title="ALTERNATIVE_ID_SPAIN_INVALID_TYPE" description="For customers with country ES only types PASSPORT (03) or NOT_REGISTERED (07) are allowed" href="/errors/ALTERNATIVE_ID_SPAIN_INVALID_TYPE" />
</div>

## Keep exploring

<div className="grid grid-cols-2 gap-3 not-prose">
  <Card title="All Customers errors" description="Every code in this category in one table." href="/errors/category/cliente" />
  <Card title="Error reference home" description="Browse every category or jump to the handling guide." href="/errors" />
</div>

---

Full OpenAPI spec: https://docs.beel.es/api/openapi