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

# Authentication

> Authenticate Manka API requests with a Bearer token.

The Manka API uses **Bearer token authentication**. Every authenticated endpoint requires an `Authorization` header of the form:

```http theme={null}
Authorization: Bearer <your_api_token>
```

## Generating a token

<Steps>
  <Step title="Log in">
    Sign in to the [Manka Dashboard](https://www.manka.tz/dashboard).
  </Step>

  <Step title="Open Access Tokens">
    Go to **Settings → Access Tokens** (or open [Developer Tools](https://www.manka.tz/dashboard/api-keys) directly).
  </Step>

  <Step title="Create a key">
    Click **Add an API Key**, give it a label, and copy the token shown — it is displayed only once.
  </Step>
</Steps>

<Warning>
  Treat API tokens like passwords. Store them in a secrets manager and never commit them to version control.
</Warning>

## Example request

<CodeGroup>
  ```bash cURL theme={null}
  curl https://gateway.manka.tz/v1/api/transactions \
    -X POST \
    -H "Authorization: Bearer $MANKA_API_TOKEN" \
    -F "file=@statement.pdf"
  ```

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

  with open("statement.pdf", "rb") as f:
      r = requests.post(
          "https://gateway.manka.tz/v1/api/transactions",
          headers={"Authorization": f"Bearer {token}"},
          files={"file": f},
      )

  print(r.json())
  ```

  ```javascript Node.js theme={null}
  import fs from "node:fs";
  import FormData from "form-data";
  import fetch from "node-fetch";

  const form = new FormData();
  form.append("file", fs.createReadStream("statement.pdf"));

  const r = await fetch("https://gateway.manka.tz/v1/api/transactions", {
    method: "POST",
    headers: { Authorization: `Bearer ${process.env.MANKA_API_TOKEN}` },
    body: form,
  });

  console.log(await r.json());
  ```
</CodeGroup>

## Authentication errors

| Status | Meaning                                                |
| ------ | ------------------------------------------------------ |
| `401`  | Missing or invalid token                               |
| `402`  | Token is valid but the account has no analysis credits |

Need help? Email [hello@manka.tz](mailto:hello@manka.tz).
