Cuéntamo manualTools › Automatic bank import

Automatic bank import

Connect your bank with a script and let movements arrive on their own

What it's for

So your bank movements arrive in Cuéntamo without you having to download files or upload them manually. An external script reads the movements from your bank and sends them to Cuéntamo via its public API. You set up the script once and from then on, your accounts update themselves.

How it works

Cuéntamo doesn't connect directly to any bank and doesn't store your banking credentials. The connection works the other way round:

  1. You obtain (or generate with the help of an AI) a script that runs on your own computer.
  2. That script accesses your online banking and extracts recent movements.
  3. The script sends them to Cuéntamo through the import API.
  4. Cuéntamo passes them through the same engine as the manual bank import: detects duplicates, matches with your forecast movements (recurring items), applies the categorisation rules you've already taught it, and creates anything new.

All the banking side is handled by the script on your machine. Cuéntamo only receives the final result: the already-processed movements. And because it uses the same pipeline as the manual import, it categorises better over time: rules you teach during a manual import work for automatic ones too, and vice versa.

The import endpoint

The script sends the movements to POST /api/v1/bank-imports/push with a JSON like this:

{
  "accountRef": "7890",
  "transactions": [
    { "date": "2026-04-01", "concept": "MERCADONA", "amount": -45.80, "reference": "SEPA-20260401-001" },
    { "date": "2026-04-02", "concept": "NOMINA EMPRESA", "amount": 1850.00, "reference": "SEPA-20260402-002" }
  ],
  "autoApply": "matched"
}

Instead of accountRef you can use accountId with the account's UUID. With accountRef, Cuéntamo looks for the account whose bank reference (configurable per account) partially matches the value you send — for example, the last digits of the IBAN or card number.

The reference field is the unique transaction identifier at your bank (SEPA reference, internal ID, etc.). Include it whenever possible: Cuéntamo uses it to avoid duplicates even if you run the script multiple times.

With autoApply: "matched" (recommended for automatic scripts), Cuéntamo only applies movements it recognises with confidence. Those it doesn't recognise are saved as pending: next time you open the app you'll see a notice to review them. When reviewing, you can create categorisation rules that will make the next import recognise them automatically.

You can also use autoApply: true to apply everything without leaving anything pending, or autoApply: false for full review from the script.

The full API reference is in the API documentation.

Authentication

Authentication is done with a Personal Access Token (PAT). You generate one from Settings → API Tokens. The token has the format cmo_… and is sent in the Authorization: Bearer cmo_your_token header. It's only shown once when created, so store it somewhere safe.

Note: the public API and access tokens are only available to users with a Cuéntamo Más subscription.

How to get a script with AI

You don't need to know how to code. You can ask Claude, ChatGPT or any other AI to generate a custom script for your bank. Copy this prompt, change the bank name and country to yours, and paste it into the AI of your choice:

Escribe un script en Python que descargue mis movimientos bancarios recientes y los importe a Cuéntamo. Primero, lee la especificación OpenAPI de Cuéntamo en https://cuentamo.com/api/docs/openapi.json para conocer los endpoints disponibles y sus parámetros. La documentación legible está en https://cuentamo.com/api/docs. Necesito importar movimientos de todas mis cuentas: cuentas corrientes, cuentas de ahorro, depósitos y tarjetas de crédito. Ten en cuenta que la normativa europea PSD2 (open banking) solo cubre cuentas de pago (corrientes), pero NO incluye cuentas de ahorro, depósitos, tarjetas de crédito ni otros productos. Por eso necesito un script que acceda directamente a mi banca online y extraiga los movimientos de TODOS los productos, no solo los cubiertos por PSD2. El script debe: 1. Conectarse a mi banca online de [nombre de tu banco] ([país]) y obtener los movimientos recientes de todas las cuentas y tarjetas. 2. Para cada cuenta o tarjeta del banco, enviar los movimientos a Cuéntamo usando el endpoint bank-imports/push con autoApply: "matched". Para identificar la cuenta destino en Cuéntamo, usa el campo accountRef con el IBAN o número de tarjeta del banco — Cuéntamo emparejará automáticamente con la cuenta que tenga una referencia bancaria coincidente (puede ser parcial, como los últimos 4 dígitos). 3. Cada movimiento debe incluir un campo reference con el identificador único de la transacción en el banco (referencia SEPA, ID interno, etc.). Esto permite ejecutar el script varias veces sin crear duplicados. 4. Con autoApply: "matched", los movimientos que Cuéntamo no reconozca se guardarán como pendientes para que yo los revise manualmente desde la app. No es necesario que el script gestione los movimientos no reconocidos. El script debe leer el token de Cuéntamo (cmo_...) y el ID del libro de cuentas desde variables de entorno, NUNCA hardcodeados en el código. Lo mismo para las credenciales de acceso al banco. Mi banco es [nombre del banco] en [país].

The AI will return a script ready to run. Review it before running: make sure it understands your bank's format and that the fields match what Cuéntamo expects.

⚠ Never paste your Cuéntamo token or your banking credentials in the AI prompt. The script must read them from environment variables.

Important notice

The connection to the bank is managed by the script you run. Cuéntamo does not connect directly to any bank, does not store banking credentials and is not responsible for the functioning of the script or the availability of your bank's API. You have full control of the connection.

Tips

  • Schedule the script to run daily with a scheduled task (cron on Linux/Mac, Task Scheduler on Windows). You won't even have to remember.
  • Don't worry about duplicates: Cuéntamo automatically detects movements you already have and discards them. You can run the script multiple times without fear.
  • The more you use the bank import (manual or automatic), the better it categorises. Rules you teach Cuéntamo during a manual import apply equally to automatic ones.
  • If you have well-configured recurring items (mortgage, salary, subscriptions…), the automatic import recognises them and confirms them as real. No duplicates created.
  • Store the bank credentials in environment variables or a separate file, never directly in the script code.

Ready to try it?

Set up your balance forecast in a few minutes. Free.

Create a free account