# Bank Accounts

## Create Bank Account

**post** `/print-mail/v1/bank_accounts`

Create a bank account. A US bank account is created by setting `bankCountryCode` to `US` and providing `accountNumber` and `routingNumber`. A canadian bank account can be created by specifying `bankCountryCode` as `CA` and setting `accountNumber`, `routeNumber`, and `transitNumber` accordingly.

You must specify _either_ `signatureImage` or `signatureText`. The image can be supplied as either a URL or a multipart file upload.

### Body Parameters

- `body: object { accountNumber, bankCountryCode, bankName, 9 more }  or object { accountNumber, bankCountryCode, bankName, 9 more }  or object { accountNumber, bankCountryCode, bankName, 9 more }`

  - `BankAccountCreateSignatureText object { accountNumber, bankCountryCode, bankName, 9 more }`

    - `accountNumber: string`

      The account number of the bank account.

    - `bankCountryCode: BankAccountCountryCode`

      Countries typically have different bank account formats and standards. These are the countries
      which PostGrid's bank accounts API supports.

      - `"CA"`

      - `"US"`

    - `bankName: string`

      The name of the bank.

    - `signatureText: string`

      The signature text of the bank account.

    - `bankPrimaryLine: optional string`

      The primary address line of the bank.

    - `bankSecondaryLine: optional string`

      The secondary address line of the bank.

    - `caDesignationNumber: optional string`

      The designation number of the bank account (for CA).

    - `description: optional string`

      An optional string describing this resource. Will be visible in the API and the dashboard.

    - `metadata: optional map[unknown]`

      See the section on Metadata.

    - `routeNumber: optional string`

      The route number of the bank account (for CA).

    - `routingNumber: optional string`

      The routing number of the bank account (for US).

    - `transitNumber: optional string`

      The transit number of the bank account (for CA).

  - `BankAccountCreateSignatureImageURL object { accountNumber, bankCountryCode, bankName, 9 more }`

    - `accountNumber: string`

      The account number of the bank account.

    - `bankCountryCode: BankAccountCountryCode`

      Countries typically have different bank account formats and standards. These are the countries
      which PostGrid's bank accounts API supports.

    - `bankName: string`

      The name of the bank.

    - `signatureImage: string`

      Link to signature image which PostGrid will download and apply to cheques created with this bank account.

    - `bankPrimaryLine: optional string`

      The primary address line of the bank.

    - `bankSecondaryLine: optional string`

      The secondary address line of the bank.

    - `caDesignationNumber: optional string`

      The designation number of the bank account (for CA).

    - `description: optional string`

      An optional string describing this resource. Will be visible in the API and the dashboard.

    - `metadata: optional map[unknown]`

      See the section on Metadata.

    - `routeNumber: optional string`

      The route number of the bank account (for CA).

    - `routingNumber: optional string`

      The routing number of the bank account (for US).

    - `transitNumber: optional string`

      The transit number of the bank account (for CA).

  - `BankAccountCreateSignatureImageFile object { accountNumber, bankCountryCode, bankName, 9 more }`

    - `accountNumber: string`

      The account number of the bank account.

    - `bankCountryCode: BankAccountCountryCode`

      Countries typically have different bank account formats and standards. These are the countries
      which PostGrid's bank accounts API supports.

    - `bankName: string`

      The name of the bank.

    - `signatureImage: string`

      A PNG or JPEG file which PostGrid will apply to checks created with this bank account.

    - `bankPrimaryLine: optional string`

      The primary address line of the bank.

    - `bankSecondaryLine: optional string`

      The secondary address line of the bank.

    - `caDesignationNumber: optional string`

      The designation number of the bank account (for CA).

    - `description: optional string`

      An optional string describing this resource. Will be visible in the API and the dashboard.

    - `metadata: optional map[unknown]`

      See the section on Metadata.

    - `routeNumber: optional string`

      The route number of the bank account (for CA).

    - `routingNumber: optional string`

      The routing number of the bank account (for US).

    - `transitNumber: optional string`

      The transit number of the bank account (for CA).

### Returns

- `BankAccount object { id, accountNumber, bankCountryCode, 15 more }`

  - `id: string`

    A unique ID prefixed with bank_account_

  - `accountNumber: string`

    The account number of the bank account.

  - `bankCountryCode: BankAccountCountryCode`

    Countries typically have different bank account formats and standards. These are the countries
    which PostGrid's bank accounts API supports.

    - `"CA"`

    - `"US"`

  - `bankName: string`

    The name of the bank.

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "bank_account"`

    Always `bank_account`.

    - `"bank_account"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `bankPrimaryLine: optional string`

    The primary address line of the bank.

  - `bankSecondaryLine: optional string`

    The secondary address line of the bank.

  - `caDesignationNumber: optional string`

    The designation number of the bank account (for CA).

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `routeNumber: optional string`

    The route number of the bank account (for CA).

  - `routingNumber: optional string`

    The routing number of the bank account (for US).

  - `signatureImage: optional string`

    A signed link to the signature image uploaded when this bank account was created. This is omitted if `signatureText` is present.

  - `signatureText: optional string`

    The signature text PostGrid uses to generate a signature for cheques created using this bank account. This is omitted if `signatureImage` is present.

  - `transitNumber: optional string`

    The transit number of the bank account (for CA).

### Example

```http
curl https://api.postgrid.com/print-mail/v1/bank_accounts \
    -H 'Content-Type: application/json' \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY" \
    -d '{
          "accountNumber": "accountNumber",
          "bankCountryCode": "CA",
          "bankName": "bankName",
          "signatureText": "signatureText"
        }'
```

#### Response

```json
{
  "id": "bank_account_12345",
  "object": "bank_account",
  "live": false,
  "bankName": "Test Bank",
  "bankPrimaryLine": "145 mulberry st",
  "bankSecondaryLine": "new york ny 10013",
  "bankCountryCode": "US",
  "accountNumber": "1234567",
  "routingNumber": "123456789",
  "signatureText": "Signature",
  "createdAt": "2020-11-12T23:23:47.974Z",
  "updatedAt": "2020-11-12T23:23:47.974Z"
}
```

## List Bank Accounts

**get** `/print-mail/v1/bank_accounts`

Get a list of bank accounts.

### Query Parameters

- `limit: optional number`

- `search: optional string`

  You can supply any string to help narrow down the list of resources. For example, if you pass `"New York"` (quoted), it will return resources that have that string present somewhere in their response. Alternatively, you can supply a structured search query. See the documentation on `StructuredSearchQuery` for more details.

- `skip: optional number`

### Returns

- `data: array of BankAccount`

  - `id: string`

    A unique ID prefixed with bank_account_

  - `accountNumber: string`

    The account number of the bank account.

  - `bankCountryCode: BankAccountCountryCode`

    Countries typically have different bank account formats and standards. These are the countries
    which PostGrid's bank accounts API supports.

    - `"CA"`

    - `"US"`

  - `bankName: string`

    The name of the bank.

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "bank_account"`

    Always `bank_account`.

    - `"bank_account"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `bankPrimaryLine: optional string`

    The primary address line of the bank.

  - `bankSecondaryLine: optional string`

    The secondary address line of the bank.

  - `caDesignationNumber: optional string`

    The designation number of the bank account (for CA).

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `routeNumber: optional string`

    The route number of the bank account (for CA).

  - `routingNumber: optional string`

    The routing number of the bank account (for US).

  - `signatureImage: optional string`

    A signed link to the signature image uploaded when this bank account was created. This is omitted if `signatureText` is present.

  - `signatureText: optional string`

    The signature text PostGrid uses to generate a signature for cheques created using this bank account. This is omitted if `signatureImage` is present.

  - `transitNumber: optional string`

    The transit number of the bank account (for CA).

- `limit: number`

- `object: "list"`

  - `"list"`

- `skip: number`

- `totalCount: number`

### Example

```http
curl https://api.postgrid.com/print-mail/v1/bank_accounts \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY"
```

#### Response

```json
{
  "object": "list",
  "limit": 10,
  "skip": 0,
  "totalCount": 1,
  "data": [
    {
      "id": "bank_account_12345",
      "object": "bank_account",
      "live": false,
      "bankName": "Test Bank",
      "bankPrimaryLine": "145 mulberry st",
      "bankSecondaryLine": "new york ny 10013",
      "bankCountryCode": "US",
      "accountNumber": "1234567",
      "routingNumber": "123456789",
      "signatureText": "Signature",
      "createdAt": "2020-11-12T23:23:47.974Z",
      "updatedAt": "2020-11-12T23:23:47.974Z"
    }
  ]
}
```

## Get Bank Account

**get** `/print-mail/v1/bank_accounts/{id}`

Retrieve a bank account by ID.

### Path Parameters

- `id: string`

### Returns

- `BankAccount object { id, accountNumber, bankCountryCode, 15 more }`

  - `id: string`

    A unique ID prefixed with bank_account_

  - `accountNumber: string`

    The account number of the bank account.

  - `bankCountryCode: BankAccountCountryCode`

    Countries typically have different bank account formats and standards. These are the countries
    which PostGrid's bank accounts API supports.

    - `"CA"`

    - `"US"`

  - `bankName: string`

    The name of the bank.

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "bank_account"`

    Always `bank_account`.

    - `"bank_account"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `bankPrimaryLine: optional string`

    The primary address line of the bank.

  - `bankSecondaryLine: optional string`

    The secondary address line of the bank.

  - `caDesignationNumber: optional string`

    The designation number of the bank account (for CA).

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `routeNumber: optional string`

    The route number of the bank account (for CA).

  - `routingNumber: optional string`

    The routing number of the bank account (for US).

  - `signatureImage: optional string`

    A signed link to the signature image uploaded when this bank account was created. This is omitted if `signatureText` is present.

  - `signatureText: optional string`

    The signature text PostGrid uses to generate a signature for cheques created using this bank account. This is omitted if `signatureImage` is present.

  - `transitNumber: optional string`

    The transit number of the bank account (for CA).

### Example

```http
curl https://api.postgrid.com/print-mail/v1/bank_accounts/$ID \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY"
```

#### Response

```json
{
  "id": "bank_account_12345",
  "object": "bank_account",
  "live": false,
  "bankName": "Test Bank",
  "bankPrimaryLine": "145 mulberry st",
  "bankSecondaryLine": "new york ny 10013",
  "bankCountryCode": "US",
  "accountNumber": "1234567",
  "routingNumber": "123456789",
  "signatureText": "Signature",
  "createdAt": "2020-11-12T23:23:47.974Z",
  "updatedAt": "2020-11-12T23:23:47.974Z"
}
```

## Delete Bank Account

**delete** `/print-mail/v1/bank_accounts/{id}`

Delete a bank account by ID. Note that this operation cannot be undone.

### Path Parameters

- `id: string`

### Returns

- `id: string`

  A unique ID prefixed with bank_account_

- `deleted: true`

  - `true`

- `object: "bank_account"`

  Always `bank_account`.

  - `"bank_account"`

### Example

```http
curl https://api.postgrid.com/print-mail/v1/bank_accounts/$ID \
    -X DELETE \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY"
```

#### Response

```json
{
  "id": "bank_account_sqF12lZ1VlBb",
  "deleted": true,
  "object": "bank_account"
}
```

## Domain Types

### Bank Account

- `BankAccount object { id, accountNumber, bankCountryCode, 15 more }`

  - `id: string`

    A unique ID prefixed with bank_account_

  - `accountNumber: string`

    The account number of the bank account.

  - `bankCountryCode: BankAccountCountryCode`

    Countries typically have different bank account formats and standards. These are the countries
    which PostGrid's bank accounts API supports.

    - `"CA"`

    - `"US"`

  - `bankName: string`

    The name of the bank.

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "bank_account"`

    Always `bank_account`.

    - `"bank_account"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `bankPrimaryLine: optional string`

    The primary address line of the bank.

  - `bankSecondaryLine: optional string`

    The secondary address line of the bank.

  - `caDesignationNumber: optional string`

    The designation number of the bank account (for CA).

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `routeNumber: optional string`

    The route number of the bank account (for CA).

  - `routingNumber: optional string`

    The routing number of the bank account (for US).

  - `signatureImage: optional string`

    A signed link to the signature image uploaded when this bank account was created. This is omitted if `signatureText` is present.

  - `signatureText: optional string`

    The signature text PostGrid uses to generate a signature for cheques created using this bank account. This is omitted if `signatureImage` is present.

  - `transitNumber: optional string`

    The transit number of the bank account (for CA).

### Bank Account Country Code

- `BankAccountCountryCode = "CA" or "US"`

  Countries typically have different bank account formats and standards. These are the countries
  which PostGrid's bank accounts API supports.

  - `"CA"`

  - `"US"`

### Bank Account Delete Response

- `BankAccountDeleteResponse object { id, deleted, object }`

  - `id: string`

    A unique ID prefixed with bank_account_

  - `deleted: true`

    - `true`

  - `object: "bank_account"`

    Always `bank_account`.

    - `"bank_account"`
