> For the complete documentation index, see [llms.txt](https://api-docs.everreal.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.everreal.co/endpoints/bank-accounts.md).

# Bank Accounts

Read, create and change the bank accounts of your partner.

## Introduction

A bank account belongs to one [company](https://api-docs.everreal.co/key-concepts.md#company). It can be linked to properties, units, property groups, owners and tenants.

**Endpoint:** `POST https://{subdomain}.everreal.co/api/reporting/graphql`

**Auth:** [Bearer token](https://api-docs.everreal.co/key-concepts.md#access-token) of a [user](https://api-docs.everreal.co/key-concepts.md#user-and-member) of the company.

## Query

```graphql
type Query {
  bankAccounts(input: BankAccountFilterListPaging): [BankAccount]
  bankAccount(id: String!): BankAccount
}
```

* `bankAccounts` returns the bank accounts of all companies of your [partner](https://api-docs.everreal.co/key-concepts.md#partner).
* `companyId` in the filter narrows the answer to one company of your partner. A `companyId` of another partner gives an empty list. See [Access model](https://api-docs.everreal.co/master/access-model.md).
* `iban`, `bic`, `bankName` and `accountHolderName` find a part of the value, and ignore upper and lower case.
* Use `paging` to read more items (see [Pagination](https://api-docs.everreal.co/helpers/pagination.md)).

### Schema

```graphql
type BankAccount {
  id: String
  name: String
  iban: String
  bic: String
  bankName: String
  accountHolderName: String
  bankAccountReferenceNumber: String
  types: [BANK_ACCOUNT_TYPE]
  createdAt: DateTime
  updatedAt: DateTime
  links: [BankAccountLinkedEntity]
}

type BankAccountLinkedEntity {
  linkedId: String!
  linkedType: BANK_ACCOUNT_LINKED_ENTITY_TYPE!
}

enum BANK_ACCOUNT_TYPE {
  DEPOSIT
  RENT
  GENERIC
}

enum BANK_ACCOUNT_LINKED_ENTITY_TYPE {
  PROPERTY
  UNIT
  PROPERTY_GROUP
  OWNER
  TENANT
}

input BankAccountFilterListPaging {
  filter: BankAccountFilter
  paging: GraphPaging
  sort: GraphSorting
}

input BankAccountFilter {
  id: String
  iban: String
  companyId: String
  bic: String
  bankName: String
  accountHolderName: String
  fullSearch: String
}
```

### Example

```graphql
query {
  bankAccounts(
    input: {
      filter: { companyId: "2f0c6d1a-8b34-4a57-9e10-6c7d3b5a9f21" }
      paging: { skip: 0, take: 50 }
    }
  ) {
    id
    name
    iban
    accountHolderName
    types
    links {
      linkedId
      linkedType
    }
  }
}
```

## Mutations

```graphql
type Mutation {
  upsertBankAccount(bankAccount: BankAccountInput!): BankAccount!
  deleteBankAccount(id: String!): Boolean!
}

input BankAccountInput {
  id: String
  name: String
  iban: String
  bic: String
  bankName: String
  accountHolderName: String
  bankAccountReferenceNumber: String
  types: [BANK_ACCOUNT_TYPE]
  links: [LinkedEntityInput]
}

input LinkedEntityInput {
  linkedId: String!
  linkedType: BANK_ACCOUNT_LINKED_ENTITY_TYPE!
}
```

* `upsertBankAccount` writes in the company of your token. `iban` and `accountHolderName` are required. Without them, the call fails with `INVALID_BANK_ACCOUNT_DATA`.
* EverReal looks for a bank account of your partner with the same IBAN, account holder name and reference number. If it finds one, it updates it. If not, it creates a new one. The `id` of the input does not select the bank account.
* `links` links the bank account to records. `linkedId` is the EverReal id of the record.
* `deleteBankAccount` deletes a bank account of your partner. A bank account that an integration manages cannot be deleted (`BANK_ACCOUNT_PROVIDER_MANAGED`).

### Example

```graphql
mutation {
  upsertBankAccount(
    bankAccount: {
      name: "Rent account"
      iban: "DE89370400440532013000"
      bic: "COBADEFFXXX"
      bankName: "Example Bank"
      accountHolderName: "Example GmbH"
      types: [RENT]
      links: [{ linkedId: "b8559500-bb35-11ec-a64e-4b00ff3d25d5", linkedType: OWNER }]
    }
  ) {
    id
    iban
    links {
      linkedId
      linkedType
    }
  }
}
```
