# Bank

> Markdown edition of https://api.fiz.co/docs/api/bank. Português: https://api.fiz.co/docs/api/bank.md?lang=pt. Index: https://api.fiz.co/llms.txt

The bank connections of the company and their transactions. Read-only, with an API key. 2 operations.

## List bank connections

GET `/bank/connections`

Returns the account's bank connections (open banking). Use the "id" field as connectionId when listing transactions.

Authentication: an API key (`x-api-key`).

**curl**

```shell
curl 'https://api.fiz.co/bank/connections' \
  --header "x-api-key: $FIZ_API_KEY"
```

**TypeScript**

```ts
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.bank.connections();
```

**Python**

```python
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.bank.connections()
```

**PHP**

```php
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->bank->connections();
```

### Response `200`

List of connections returned successfully

| Field | Type | Description |
| --- | --- | --- |
| `[].id` | string |  |
| `[].providerName` | string |  |
| `[].countryCode` | string |  |
| `[].status` | string |  |
| `[].createdAt` | string (date-time) |  |
| `[].updatedAt` | string (date-time) |  |
| `[].maskedIbans` | string\[\] |  |

### Errors

-   `401` Unauthorized - API key missing or invalid
-   `403` No access to the bookkeeping feature

## List bank transactions

GET `/bank/transactions`

Returns the bank transactions (open banking) of a connection. The connectionId parameter is required — get it from GET /bank/connections.

Authentication: an API key (`x-api-key`).

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `connectionId` **required** | query | string | Bank connection identifier (obtained from GET /bank/connections) |
| `page` | query | number | Page number (starts at 1) |
| `pageSize` | query | number | Maximum number of records per page |
| `fromDate` | query | string | Filter from this date (ISO 8601 with timezone) |
| `toDate` | query | string | Filter up to this date (ISO 8601 with timezone) |
| `searchString` | query | string | Global search term (description, merchant, etc.) |
| `direction` | query | string | Filter by direction (incoming/outgoing) — One of: `Income`, `Expense` |
| `types` | query | string\[\] | Filter by transaction types |
| `language` | query | string | Language for category names (pt or en) — One of: `pt`, `en` |

**curl**

```shell
curl 'https://api.fiz.co/bank/transactions?connectionId=a1b2c3d4-0000-0000-0000-000000000000' \
  --header "x-api-key: $FIZ_API_KEY"
```

**TypeScript**

```ts
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.bank.transactions({
  connectionId: 'a1b2c3d4-0000-0000-0000-000000000000',
});
```

**Python**

```python
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.bank.transactions({
    "connectionId": "a1b2c3d4-0000-0000-0000-000000000000",
})
```

**PHP**

```php
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->bank->transactions([
    'connectionId' => 'a1b2c3d4-0000-0000-0000-000000000000',
]);
```

### Response `200`

List of transactions returned successfully

| Field | Type | Description |
| --- | --- | --- |
| `[].id` | string | The transaction's identifier at the open banking provider, unique within the connection. It stays the same across refreshes and consent renewals of the same connection. Pending transactions are replaced on every sync and may come back with a different id once settled. To deduplicate, use connectionId + id of transactions with isPending = false. |
| `[].connectionId` | string |  |
| `[].amount` | number | Signed amount: negative is money out |
| `[].currency` | string |  |
| `[].transactionDate` | string (date-time) |  |
| `[].description` | string |  |
| `[].payer` | string · can be null |  |
| `[].payee` | string · can be null |  |
| `[].note` | string · can be null | The user's note on the transaction, if any |
| `[].merchantName` | string |  |
| `[].merchantCategoryName` | string · can be null |  |
| `[].accountingCategoryName` | string |  |
| `[].statusCode` | string | Accepted while the transaction is pending (isPending = true), Cleared once it has settled — One of: `Accepted`, `Cleared` |
| `[].type` | string · can be null | Display name of the transaction type, in the language of the language parameter (for example Compra in pt, Purchase in en). It is not the value of the types filter. |
| `[].isPending` | boolean | true while the transaction is pending. Only transactions with isPending = false are final. |

### Errors

-   `400` Invalid parameters (e.g. missing connectionId)
-   `401` Unauthorized - API key missing or invalid
-   `403` No access to the bookkeeping feature

## Errors

Errors share one shape: `statusCode`, `message`, `code` and `error`, with the request id in the `X-Request-Id` header.

## All resources

-   [Company](https://api.fiz.co/docs/api/company) ([Markdown](https://api.fiz.co/docs/api/company.md))
-   [Customers](https://api.fiz.co/docs/api/customers) ([Markdown](https://api.fiz.co/docs/api/customers.md))
-   [Items](https://api.fiz.co/docs/api/items) ([Markdown](https://api.fiz.co/docs/api/items.md))
-   [Invoices](https://api.fiz.co/docs/api/invoices) ([Markdown](https://api.fiz.co/docs/api/invoices.md))
-   [Recurring invoices](https://api.fiz.co/docs/api/recurring-invoices) ([Markdown](https://api.fiz.co/docs/api/recurring-invoices.md))
-   [Pro formas](https://api.fiz.co/docs/api/pro-formas) ([Markdown](https://api.fiz.co/docs/api/pro-formas.md))
-   [Transport documents](https://api.fiz.co/docs/api/transport-documents) ([Markdown](https://api.fiz.co/docs/api/transport-documents.md))
-   [Series](https://api.fiz.co/docs/api/series) ([Markdown](https://api.fiz.co/docs/api/series.md))
-   [PDF templates](https://api.fiz.co/docs/api/pdf-templates) ([Markdown](https://api.fiz.co/docs/api/pdf-templates.md))
-   [Exports](https://api.fiz.co/docs/api/exports) ([Markdown](https://api.fiz.co/docs/api/exports.md))
-   [Expenses](https://api.fiz.co/docs/api/expenses) ([Markdown](https://api.fiz.co/docs/api/expenses.md))
-   [VAT](https://api.fiz.co/docs/api/vat) ([Markdown](https://api.fiz.co/docs/api/vat.md))
-   [Bank](https://api.fiz.co/docs/api/bank) ([Markdown](https://api.fiz.co/docs/api/bank.md))
