> ## 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.

# Authentication

> How to authenticate your requests to the Matil API.

All requests require an API key in the `x-api-key` header:

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

## Getting your API key

1. Log in to the [Matil Dashboard](https://admin.matil.ai)
2. Go to **Settings > API Keys**
3. Click **Create New Key** and copy it immediately — it won't be shown again

## Example request

<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: your-api-key" \
    -H "Content-Type: application/json" \
    -d '{"documents": [{"type": "url", "url": "https://example.com/invoice.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://example.com/invoice.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://example.com/invoice.pdf" }]
      })
    }
  );
  ```
</CodeGroup>

<Warning>
  Store your API key in an environment variable. Never hardcode it in source code or commit it to version control.
</Warning>
