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

# Submit Statement for Analysis

> Submit a bank statement PDF for asynchronous analysis.

Submits a bank statement PDF for asynchronous analysis. The endpoint returns a `task_id` immediately. Results are delivered via the optional `callback_url` and/or by polling [`GET /analysis/:task_id`](/api-reference/analysis/poll).

<Note>
  Request body must be `multipart/form-data`. One analysis credit is deducted on successful submission.
</Note>

### Request body

<ParamField body="file" type="file" required>
  Bank statement PDF.
</ParamField>

<ParamField body="password" type="string">
  Password for protected PDFs. Required if the file is encrypted.
</ParamField>

<ParamField body="callback_url" type="string">
  URL to receive the final result payload when analysis completes. See [Callback payload](/api-reference/analysis/callback).
</ParamField>

### Response

<ResponseField name="status" type="string" required>
  Always `"processing"` on initial submission.
</ResponseField>

<ResponseField name="task_id" type="string" required>
  Identifier for the analysis job. Use it to poll for results or correlate the callback payload.
</ResponseField>

<ResponseExample>
  ```json 202 Accepted theme={null}
  {
    "status": "processing",
    "task_id": "3f7a1c2e-8b4d-4e9f-a1b2-c3d4e5f60718"
  }
  ```
</ResponseExample>

### Error responses

| Status | Reason                                                 |
| ------ | ------------------------------------------------------ |
| `400`  | PDF is password-protected but no password was provided |
| `401`  | Missing or invalid API token                           |
| `402`  | Insufficient analysis credits                          |

### Example

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

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

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

  task_id = r.json()["task_id"]
  ```

  ```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"));
  form.append("callback_url", "https://example.com/manka/webhook");

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

  const { task_id } = await r.json();
  ```
</CodeGroup>
