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

# Authentication

> How to authenticate your requests to the ParseRouter API.

ParseRouter authenticates requests with an **API key** sent as a bearer token. Every request to the API must include a valid key.

## API keys

API keys are created and managed from your [dashboard](https://platform.parserouter.com/dashboard). Each key:

* Begins with the prefix `sk-pr-`.
* Belongs to your **organization** – usage and credits are shared across all of your organization's keys.
* Is shown **only once**, at creation. ParseRouter stores a hash, not the key itself, so it can't be recovered later.

<Warning>
  Your API key carries the ability to spend your credits. Keep it secret: store it in an environment variable or secrets manager, never commit it to source control, and never expose it in browser or mobile client code. Call ParseRouter from your backend.
</Warning>

## Making an authenticated request

Pass your key in the `Authorization` header using the `Bearer` scheme:

```text theme={null}
Authorization: Bearer sk-pr-...
```

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.parserouter.com/v1/mineru/parse \
    -H "Authorization: Bearer sk-pr-..." \
    -F "file=@invoice.pdf"
  ```

  ```python Python theme={null}
  import os
  import requests

  resp = requests.post(
      "https://api.parserouter.com/v1/mineru/parse",
      headers={"Authorization": f"Bearer {os.environ['PARSEROUTER_API_KEY']}"},
      files={"file": open("invoice.pdf", "rb")},
      timeout=600,
  )
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch("https://api.parserouter.com/v1/mineru/parse", {
    method: "POST",
    headers: { Authorization: `Bearer ${process.env.PARSEROUTER_API_KEY}` },
    body: form,
  });
  ```
</CodeGroup>

## Rotating and revoking keys

You can create multiple keys and revoke any of them at any time from the dashboard – useful for rotating a key or isolating different environments (for example, separate keys for staging and production).

Revoking a key takes effect immediately: any request using it will be rejected. To rotate without downtime, create the new key first, deploy it, then revoke the old one.

## Authentication errors

<ResponseField name="401 Unauthorized" type="error">
  The `Authorization` header is missing, malformed, or the key is invalid or revoked. Check that you're sending `Authorization: Bearer sk-pr-...` with a current key.
</ResponseField>
