# ENV_MISMATCH

API key does not match NIF environment: use a live key for production NIFs and a test key for sandbox NIFs

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

## Example response

When this error occurs, the API returns a JSON response with the following shape:

```json
{
  "type": "https://docs.beel.es/errors/ENV_MISMATCH",
  "title": "ENV_MISMATCH",
  "detail": "API key does not match NIF environment: use a live key for production NIFs and a test key for sandbox NIFs",
  "instance": "/v1/<resource>",
  "errors": [],
  "success": false,
  "error": {
    "code": "ENV_MISMATCH",
    "message": "API key does not match NIF environment: use a live key for production NIFs and a test key for sandbox NIFs",
    "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">{"API key does not match NIF environment: use a live key for production NIFs and a test key for sandbox NIFs"}</Tab>
  <Tab value="Spanish">{"La API key no coincide con el entorno del NIF: usa una key de producción para NIFs reales y una key de test para NIFs de pruebas"}</Tab>
  <Tab value="Catalan">{"La clau d'API no coincideix amb l'entorn del NIF: utilitza una clau de producció per a NIFs reals i una clau de test per a NIFs de proves"}</Tab>
</Tabs>

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

## Other errors in this category

<div className="grid grid-cols-2 gap-3 not-prose">
  <Card title="ALREADY_DISABLED" description="VeriFactu is already disabled for this user" href="/errors/ALREADY_DISABLED" />
  <Card title="ALREADY_ENABLED" description="VeriFactu is already enabled for this user" href="/errors/ALREADY_ENABLED" />
  <Card title="ALREADY_REGISTERED" description="The NIF is already registered in VeriFactu" href="/errors/ALREADY_REGISTERED" />
  <Card title="API_COMMUNICATION_ERROR" description="Error communicating with the VeriFactu API" href="/errors/API_COMMUNICATION_ERROR" />
  <Card title="API_KEY_NOT_CONFIGURED" description="The VeriFactu API key has not been configured" href="/errors/API_KEY_NOT_CONFIGURED" />
</div>

## Keep exploring

<div className="grid grid-cols-2 gap-3 not-prose">
  <Card title="All VeriFactu errors" description="Every code in this category in one table." href="/errors/category/verifactu" />
  <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