Skip to content
DocsGet started

Onboard with AI

Your coding assistant can write the whole integration. Give it the documentation, paste the prompt below, and review what it writes.

1. Create a key#

Open the console. Put the live key in STATEMENTBEAR_KEY and the test key in STATEMENTBEAR_TEST_KEY, in your environment or secret store. Do not paste either key into the chat.

2. Give it the documentation#

Connect the documentation MCP server so the assistant can search these pages while it works. Without MCP, the prompt points it at /docs/llms-full.txt, which is the whole documentation in one file.

3. Paste the prompt#

Works in Claude Code, Cursor, Codex, Copilot or any assistant that can read a URL and edit your project.

Prompt
Integrate the StatementBear bank statement parsing API into this project.

Read the documentation first: https://statementbear.com/docs/llms-full.txt
If the StatementBear docs MCP server (https://statementbear.com/api/mcp) is connected, use it to look things up instead.

Requirements:
- POST each statement file (PDF, JPEG or PNG photo, or CSV/OFX/QIF export) to https://statementbear.com/api/v1/documents as the raw body with its Content-Type, e.g. application/pdf.
- Read the API key from the STATEMENTBEAR_KEY environment variable. Never hardcode or commit a key.
- Send an Idempotency-Key header with every request: one unique value per document, reused on every retry of that document.
- Set a client timeout of at least 180 seconds. For files over 60 pages, send ?async=true and collect the result from the document.succeeded webhook or GET /api/v1/documents/{id}.
- If webhooks are used, verify the StatementBear-Signature header before trusting an event.
- Retry 429, 5xx and 409 idempotency_key_in_use responses with exponential backoff, reusing the same Idempotency-Key. Do not retry any other error.
- Only count credits as income on accounts with type "bank".
- When verification.reconciled is false or authenticity.risk is "high", send the document to manual review instead of using its totals.
- Write tests that call the API with a test key from STATEMENTBEAR_TEST_KEY, using the X-Test-Scenario header to cover credit_card, multi_account, unreconciled, suspicious and the error scenarios. Test calls are free.

Follow this project's existing conventions for HTTP clients, configuration and tests. When you are done, list what you changed and what I need to configure.

4. Review the result#

  • No key in the code. Search the diff for sb_live_, sb_test_ and whsec_.
  • Income only from bank accounts. Credits on a credit_card account are repayments and refunds. See Amounts and directions.
  • A review path for unreconciled and suspicious documents. Run the tests with the unreconciled and suspicious scenarios and check where each document ends up. See Verification and Authenticity signals.
  • One idempotency key per document. A new key on every retry means a timeout can be charged twice. See Idempotency and retries.
  • Webhook signatures checked against the raw body, if it used webhooks. See Webhooks.

Then work through Going live before real customers' statements reach it.

Something wrong or missing on this page? [email protected]