# 🔑 Autenticación

## 🔑 Autenticación

Todas las peticiones a la API requieren autenticación obligatoria.

No existen endpoints públicos.

### Header requerido

Envía siempre el header `x-api-key` en cada petición.

| Header      | Tipo   | Obligatorio | Descripción                                         |
| ----------- | ------ | ----------- | --------------------------------------------------- |
| `x-api-key` | string | Sí          | Clave global de autorización para acceder a la API. |

### Ejemplo

```http
POST /v1/semovi/licenses HTTP/1.1
Host: api.mxrp.example
x-api-key: tu_clave_privada
Content-Type: application/json
```

### Gestión de claves

Las claves de autorización global deben solicitarse a la administración del servidor.

Cada clave identifica y autoriza a un cliente concreto.

{% hint style="warning" %}
Mantén tu `x-api-key` en secreto. No la expongas en clientes públicos, repositorios, capturas ni logs.
{% endhint %}

### Recomendaciones

* Guarda la clave en variables de entorno.
* Rota la clave si sospechas una filtración.
* No compartas la misma clave entre servicios sin necesidad.

### Respuesta ante claves inválidas

Si la clave no existe, es inválida o fue revocada, la API responde con `401 No Autorizado`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://scarlet-2.gitbook.io/docs.mxrp/informacion-api/autenticacion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
