> ## Documentation Index
> Fetch the complete documentation index at: https://docs.matil.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Autenticación

> Como autenticar tus peticiónes a la API de Matil.

Todas las peticiónes requieren una API key en la cabecera `x-api-key`:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
x-api-key: tu-api-key
```

## Obtener tu API key

1. Inicia sesión en el [Dashboard de Matil](https://admin.matil.ai)
2. Ve a **Settings > API Keys**
3. Haz clic en **Create New Key** y copiala inmediatamente — no se mostrará de nuevo

## Ejemplo de petición

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X POST "https://api.matil.ai/v3/deployments/{deployment_id}" \
    -H "x-api-key: tu-api-key" \
    -H "Content-Type: application/json" \
    -d '{"documents": [{"type": "url", "url": "https://ejemplo.com/factura.pdf"}]}'
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import os
  import requests

  response = requests.post(
      f"https://api.matil.ai/v3/deployments/{deployment_id}",
      headers={
          "x-api-key": os.environ["MATIL_API_KEY"],
          "Content-Type": "application/json"
      },
      json={"documents": [{"type": "url", "url": "https://ejemplo.com/factura.pdf"}]}
  )
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await fetch(
    `https://api.matil.ai/v3/deployments/${deploymentId}`,
    {
      method: "POST",
      headers: {
        "x-api-key": process.env.MATIL_API_KEY,
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        documents: [{ type: "url", url: "https://ejemplo.com/factura.pdf" }]
      })
    }
  );
  ```
</CodeGroup>

<Warning>
  Guarda tu API key en una varíable de entorno. Nunca la escribas directamente en el código fuente ni la subas a control de versiones.
</Warning>
