---
title: "Import a statement | Docs | Treasury by R&D Copilot"
description: "Send the lines of a statement file exported from your bank, read the suggestions it creates and see what it does to your payments."
canonical: "https://banking.rdcopilot.com/docs/guides/import-a-statement/"
language: en
updated: 2026-11-22
---

# Import a statement

Send the lines of a statement file exported from your bank, read the suggestions it creates and see what it does to your payments.

Treasury reads the statement file you export from your bank. You send its lines in one request; Treasury stores them, proposes a match for every new booked line and updates your payments. This guide follows one import from the first read of the account to the new suggestions.

## 1\. Read the account

[\`getAccount\`](https://banking.rdcopilot.com/docs/api-reference/accounts/#get-account) gives the balances before the import. `statementBalance` is the closing balance of the last statement; the new file must open at that amount.

curl

```bash
curl "$RDC_BASE_URL/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
    ],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 200

```json
{
  "id": "258f8664-ff43-4e53-b688-ad5a4a97ede6",
  "companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
  "name": "Operating account",
  "iban": "RO** **** **** **** **** 0000",
  "currency": "RON",
  "bookedBalance": "154289.67",
  "availableBalance": "153394.27",
  "statementBalance": "154289.67",
  "ledgerBalance": "156199.80",
  "difference": "-1910.13",
  "linesLeft": 8,
  "nonWorkingDays": [
    "2026-11-30",
    "2026-12-01"
  ]
}
```

## 2\. Build the body

Take the lines of the file you exported and send them with the period and the two balances. The opening balance plus the booked lines must equal the closing balance. Every amount is a signed decimal string: positive for a credit, negative for a debit.

| Field of a line | What to send |
| --- | --- |
| `bankReference` | The reference the bank gives the line. It is unique for the account. |
| `bookedOn, valueOn` | The day the bank booked the line and, when the file has one, its value date. `bookedOn` falls inside the period. |
| `counterparty, reference` | The other party and the details of the payment, as the bank prints them. |
| `amount` | The signed decimal string, for example `-15.00`. |
| `kind` | `transfer`, `card`, `direct_debit` or `fee`. |
| `status` | `pending` for a line the bank has not booked, `booked`, or `returned` for a line that returns a payment. |
| `returnOf, returnReason` | Only on a `returned` line: the `bankReference` of the line it returns and the reason the bank gives, as written. |

In the body below, the line `BK26112001` returns the payment line `BK26111802` with the reason “Beneficiary account closed”, and `BK26111902` books a line that an earlier statement held as `pending`.

## 3\. Send the statement

[\`importStatement\`](https://banking.rdcopilot.com/docs/api-reference/statements/#import-statement) answers `202` with the operation result; `aggregateId` is the id of the new statement. Choose a new `operationId` for every file. Repeating the same request with the same `operationId` is safe.

curl

```bash
curl -X POST "$RDC_BASE_URL/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6/statements" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "80cd1346-fac0-457b-9c65-741c7d8c82f1",
  "periodFrom": "2026-11-20",
  "periodTo": "2026-11-22",
  "openingBalance": "154289.67",
  "closingBalance": "180250.47",
  "lines": [
    {
      "bankReference": "BK26112001",
      "bookedOn": "2026-11-20",
      "valueOn": "2026-11-20",
      "counterparty": "Moara Vadului SRL",
      "reference": "RETUR MV-2026-1187 PP-1002",
      "amount": "24102.50",
      "kind": "transfer",
      "status": "returned",
      "returnOf": "BK26111802",
      "returnReason": "Beneficiary account closed"
    },
    {
      "bankReference": "BK26111902",
      "bookedOn": "2026-11-20",
      "valueOn": "2026-11-20",
      "counterparty": "Silozurile Zănești SRL",
      "reference": "TRANSFER",
      "amount": "1873.30",
      "kind": "transfer",
      "status": "booked"
    },
    {
      "bankReference": "BK26112002",
      "bookedOn": "2026-11-20",
      "valueOn": "2026-11-20",
      "counterparty": "Bank fee",
      "reference": "COMISION OPERATIUNE RETUR",
      "amount": "-15.00",
      "kind": "fee",
      "status": "booked"
    }
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6/statements`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "80cd1346-fac0-457b-9c65-741c7d8c82f1",
    "periodFrom": "2026-11-20",
    "periodTo": "2026-11-22",
    "openingBalance": "154289.67",
    "closingBalance": "180250.47",
    "lines": [
      {
        "bankReference": "BK26112001",
        "bookedOn": "2026-11-20",
        "valueOn": "2026-11-20",
        "counterparty": "Moara Vadului SRL",
        "reference": "RETUR MV-2026-1187 PP-1002",
        "amount": "24102.50",
        "kind": "transfer",
        "status": "returned",
        "returnOf": "BK26111802",
        "returnReason": "Beneficiary account closed"
      },
      {
        "bankReference": "BK26111902",
        "bookedOn": "2026-11-20",
        "valueOn": "2026-11-20",
        "counterparty": "Silozurile Zănești SRL",
        "reference": "TRANSFER",
        "amount": "1873.30",
        "kind": "transfer",
        "status": "booked"
      },
      {
        "bankReference": "BK26112002",
        "bookedOn": "2026-11-20",
        "valueOn": "2026-11-20",
        "counterparty": "Bank fee",
        "reference": "COMISION OPERATIUNE RETUR",
        "amount": "-15.00",
        "kind": "fee",
        "status": "booked"
      }
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6/statements',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '80cd1346-fac0-457b-9c65-741c7d8c82f1',
        'periodFrom': '2026-11-20',
        'periodTo': '2026-11-22',
        'openingBalance': '154289.67',
        'closingBalance': '180250.47',
        'lines': [
            {
                'bankReference': 'BK26112001',
                'bookedOn': '2026-11-20',
                'valueOn': '2026-11-20',
                'counterparty': 'Moara Vadului SRL',
                'reference': 'RETUR MV-2026-1187 PP-1002',
                'amount': '24102.50',
                'kind': 'transfer',
                'status': 'returned',
                'returnOf': 'BK26111802',
                'returnReason': 'Beneficiary account closed',
            },
            {
                'bankReference': 'BK26111902',
                'bookedOn': '2026-11-20',
                'valueOn': '2026-11-20',
                'counterparty': 'Silozurile Zănești SRL',
                'reference': 'TRANSFER',
                'amount': '1873.30',
                'kind': 'transfer',
                'status': 'booked',
            },
            {
                'bankReference': 'BK26112002',
                'bookedOn': '2026-11-20',
                'valueOn': '2026-11-20',
                'counterparty': 'Bank fee',
                'reference': 'COMISION OPERATIUNE RETUR',
                'amount': '-15.00',
                'kind': 'fee',
                'status': 'booked',
            },
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "80cd1346-fac0-457b-9c65-741c7d8c82f1",
  "periodFrom": "2026-11-20",
  "periodTo": "2026-11-22",
  "openingBalance": "154289.67",
  "closingBalance": "180250.47",
  "lines": [
    {
      "bankReference": "BK26112001",
      "bookedOn": "2026-11-20",
      "valueOn": "2026-11-20",
      "counterparty": "Moara Vadului SRL",
      "reference": "RETUR MV-2026-1187 PP-1002",
      "amount": "24102.50",
      "kind": "transfer",
      "status": "returned",
      "returnOf": "BK26111802",
      "returnReason": "Beneficiary account closed"
    },
    {
      "bankReference": "BK26111902",
      "bookedOn": "2026-11-20",
      "valueOn": "2026-11-20",
      "counterparty": "Silozurile Zănești SRL",
      "reference": "TRANSFER",
      "amount": "1873.30",
      "kind": "transfer",
      "status": "booked"
    },
    {
      "bankReference": "BK26112002",
      "bookedOn": "2026-11-20",
      "valueOn": "2026-11-20",
      "counterparty": "Bank fee",
      "reference": "COMISION OPERATIUNE RETUR",
      "amount": "-15.00",
      "kind": "fee",
      "status": "booked"
    }
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6/statements');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6/statements");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "80cd1346-fac0-457b-9c65-741c7d8c82f1",
  "periodFrom": "2026-11-20",
  "periodTo": "2026-11-22",
  "openingBalance": "154289.67",
  "closingBalance": "180250.47",
  "lines": [
    {
      "bankReference": "BK26112001",
      "bookedOn": "2026-11-20",
      "valueOn": "2026-11-20",
      "counterparty": "Moara Vadului SRL",
      "reference": "RETUR MV-2026-1187 PP-1002",
      "amount": "24102.50",
      "kind": "transfer",
      "status": "returned",
      "returnOf": "BK26111802",
      "returnReason": "Beneficiary account closed"
    },
    {
      "bankReference": "BK26111902",
      "bookedOn": "2026-11-20",
      "valueOn": "2026-11-20",
      "counterparty": "Silozurile Zănești SRL",
      "reference": "TRANSFER",
      "amount": "1873.30",
      "kind": "transfer",
      "status": "booked"
    },
    {
      "bankReference": "BK26112002",
      "bookedOn": "2026-11-20",
      "valueOn": "2026-11-20",
      "counterparty": "Bank fee",
      "reference": "COMISION OPERATIUNE RETUR",
      "amount": "-15.00",
      "kind": "fee",
      "status": "booked"
    }
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "80cd1346-fac0-457b-9c65-741c7d8c82f1",
  "status": "accepted",
  "aggregateId": "f5b1321e-fbb0-4771-8393-9e4090091108",
  "aggregateRevision": 1
}
```

## 4\. Read the operation and the suggestions

[\`getOperation\`](https://banking.rdcopilot.com/docs/api-reference/operations/) returns the outcome by the `operationId` you sent. Then list the matches in the state `suggested`: every new booked line has one, with its method and its reason.

curl

```bash
curl "$RDC_BASE_URL/banking/v1/operations/80cd1346-fac0-457b-9c65-741c7d8c82f1" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/operations/80cd1346-fac0-457b-9c65-741c7d8c82f1`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/banking/v1/operations/80cd1346-fac0-457b-9c65-741c7d8c82f1',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/operations/80cd1346-fac0-457b-9c65-741c7d8c82f1');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
    ],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/banking/v1/operations/80cd1346-fac0-457b-9c65-741c7d8c82f1");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 200

```json
{
  "operationId": "80cd1346-fac0-457b-9c65-741c7d8c82f1",
  "status": "completed",
  "aggregateId": "f5b1321e-fbb0-4771-8393-9e4090091108",
  "aggregateRevision": 1
}
```

curl

```bash
curl "$RDC_BASE_URL/banking/v1/matches?accountId=258f8664-ff43-4e53-b688-ad5a4a97ede6&limit=20" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/matches?accountId=258f8664-ff43-4e53-b688-ad5a4a97ede6&limit=20`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/banking/v1/matches?accountId=258f8664-ff43-4e53-b688-ad5a4a97ede6&limit=20',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/matches?accountId=258f8664-ff43-4e53-b688-ad5a4a97ede6&limit=20');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
    ],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/banking/v1/matches?accountId=258f8664-ff43-4e53-b688-ad5a4a97ede6&limit=20");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 200

```json
{
  "items": [
    {
      "id": "d976e350-d423-4499-ac3d-207185a9bd4b",
      "transactionId": "0dea7dcc-e56e-4654-bdf3-95fbedf34baf",
      "state": "suggested",
      "method": "exact",
      "reason": {
        "code": "exact",
        "text": "The amount RON 3,168.42 equals FCT-2026-00418 and the reference names it."
      },
      "allocations": [
        {
          "kind": "item",
          "openItemId": "6023b97b-b8aa-40bf-bf95-706a76377739",
          "amount": "3168.42"
        }
      ],
      "remainder": "0.00",
      "note": null,
      "revision": 1
    },
    {
      "id": "d3c1d37c-0bf1-4603-b3e7-5c5c5361ad00",
      "transactionId": "4d285753-c13f-44e2-a3fb-ab6043e969d7",
      "state": "suggested",
      "method": "exact",
      "reason": {
        "code": "exact-sum",
        "text": "The amount RON 20,804.25 equals the sum of FCT-2026-00402 and FCT-2026-00409, and the reference names them."
      },
      "allocations": [
        {
          "kind": "item",
          "openItemId": "eebd7a30-2a6a-4a3b-a6f2-e40004cc707f",
          "amount": "12043.85"
        },
        {
          "kind": "item",
          "openItemId": "5be6df30-6bcb-4cbf-8ca7-fbb0549795ba",
          "amount": "8760.40"
        }
      ],
      "remainder": "0.00",
      "note": null,
      "revision": 1
    },
    {
      "id": "0a72c26f-af85-4602-857c-1b5a033e09f6",
      "transactionId": "eb7c7917-db20-48ad-a29f-f3b08206f633",
      "state": "suggested",
      "method": "partner",
      "reason": {
        "code": "partner-partial",
        "text": "Earlier lines of this partner were matched to its documents. The reference names FCT-2026-00396 and the amount is less than what it still owes, so it is paid in part."
      },
      "allocations": [
        {
          "kind": "item",
          "openItemId": "7658d7ee-a883-4138-a96a-eb531d7be739",
          "amount": "3000.00"
        }
      ],
      "remainder": "0.00",
      "note": null,
      "revision": 1
    }
  ],
  "nextCursor": null
}
```

Read the account again. `statementBalance` is the new closing balance, and `difference` and `linesLeft` count what the new lines add to the reconciliation.

curl

```bash
curl "$RDC_BASE_URL/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
    ],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/banking/v1/accounts/258f8664-ff43-4e53-b688-ad5a4a97ede6");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 200

```json
{
  "id": "258f8664-ff43-4e53-b688-ad5a4a97ede6",
  "companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
  "name": "Operating account",
  "iban": "RO** **** **** **** **** 0000",
  "currency": "RON",
  "bookedBalance": "180250.47",
  "availableBalance": "179355.07",
  "statementBalance": "180250.47",
  "ledgerBalance": "156199.80",
  "difference": "24050.67",
  "linesLeft": 11,
  "nonWorkingDays": [
    "2026-11-30",
    "2026-12-01"
  ]
}
```

## What the import does to payments

-   A booked debit that names an exported payment and equals its amount confirms the payment: its status becomes `confirmed`.
-   A `returned` line whose `returnOf` is the debit of a payment rejects the payment: its status becomes `rejected_by_bank` and `bankReason` holds the reason of the bank. The story is in [Handle a returned payment](https://banking.rdcopilot.com/docs/guides/handle-a-returned-payment/).
-   A `pending` line is stored without a match. When a later file books the same `bankReference`, the stored line is updated and gets its match; it is not added twice.

## When the import is refused

Nothing is stored when a file is refused. Correct the file, or import the missing statement first, and send it with a new `operationId`.

| Code | HTTP | Cause and what to do |
| --- | --- | --- |
| `statement_duplicate` | `422` | A statement of this account for the same period is already imported. Nothing to do: read the statement that is stored. |
| `statement_gap` | `422` | The opening balance of the file is not the closing balance of the last statement of the account. Import the statement that comes before it first. |
| `statement_unbalanced` | `422` | The opening balance plus the booked lines is not the closing balance of the file. Check that the file is complete and export it again from your bank. |
| `statement_out_of_period` | `422` | A line is dated outside the period of the statement. Export the statement again for the period you mean. |
| `statement_duplicate_line` | `422` | A bank reference appears twice in the file or is already stored for the account. Remove the repeated line or import only the days that are new. |

An unknown account answers `account_not_found`, and an `operationId` used with a different request answers `operation_reused`. All codes are in [Error codes](https://banking.rdcopilot.com/docs/reference/error-codes/).

Next: [Reconcile a month](https://banking.rdcopilot.com/docs/guides/reconcile-a-month/).
