# Bank Accounts

## Create Bank Account

`print_mail.bank_accounts.create(BankAccountCreateParams**kwargs)  -> BankAccount`

**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.

### Parameters

- `account_number: str`

  The account number of the bank account.

- `bank_country_code: BankAccountCountryCode`

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

  - `"CA"`

  - `"US"`

- `bank_name: str`

  The name of the bank.

- `signature_text: str`

  The signature text of the bank account.

- `bank_primary_line: Optional[str]`

  The primary address line of the bank.

- `bank_secondary_line: Optional[str]`

  The secondary address line of the bank.

- `ca_designation_number: Optional[str]`

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

- `description: Optional[str]`

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

- `metadata: Optional[Dict[str, object]]`

  See the section on Metadata.

- `route_number: Optional[str]`

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

- `routing_number: Optional[str]`

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

- `transit_number: Optional[str]`

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

### Returns

- `class BankAccount: …`

  - `id: str`

    A unique ID prefixed with bank_account_

  - `account_number: str`

    The account number of the bank account.

  - `bank_country_code: BankAccountCountryCode`

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

    - `"CA"`

    - `"US"`

  - `bank_name: str`

    The name of the bank.

  - `created_at: datetime`

    The UTC time at which this resource was created.

  - `live: bool`

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

  - `object: Literal["bank_account"]`

    Always `bank_account`.

    - `"bank_account"`

  - `updated_at: datetime`

    The UTC time at which this resource was last updated.

  - `bank_primary_line: Optional[str]`

    The primary address line of the bank.

  - `bank_secondary_line: Optional[str]`

    The secondary address line of the bank.

  - `ca_designation_number: Optional[str]`

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

  - `description: Optional[str]`

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

  - `metadata: Optional[Dict[str, object]]`

    See the section on Metadata.

  - `route_number: Optional[str]`

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

  - `routing_number: Optional[str]`

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

  - `signature_image: Optional[str]`

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

  - `signature_text: Optional[str]`

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

  - `transit_number: Optional[str]`

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

### Example

```python
import os
from postgrid import PostGrid

client = PostGrid(
    print_mail_api_key=os.environ.get("POSTGRID_PRINT_MAIL_API_KEY"),  # This is the default and can be omitted
)
bank_account = client.print_mail.bank_accounts.create(
    account_number="1234567",
    bank_country_code="US",
    bank_name="Test Bank",
    signature_text="Example",
    bank_primary_line="145 mulberry st",
    bank_secondary_line="new york ny 10013",
    routing_number="123456789",
)
print(bank_account.id)
```

#### 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

`print_mail.bank_accounts.list(BankAccountListParams**kwargs)  -> SyncSkipLimit[BankAccount]`

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

Get a list of bank accounts.

### Parameters

- `limit: Optional[int]`

- `search: Optional[str]`

  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[int]`

### Returns

- `class BankAccount: …`

  - `id: str`

    A unique ID prefixed with bank_account_

  - `account_number: str`

    The account number of the bank account.

  - `bank_country_code: BankAccountCountryCode`

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

    - `"CA"`

    - `"US"`

  - `bank_name: str`

    The name of the bank.

  - `created_at: datetime`

    The UTC time at which this resource was created.

  - `live: bool`

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

  - `object: Literal["bank_account"]`

    Always `bank_account`.

    - `"bank_account"`

  - `updated_at: datetime`

    The UTC time at which this resource was last updated.

  - `bank_primary_line: Optional[str]`

    The primary address line of the bank.

  - `bank_secondary_line: Optional[str]`

    The secondary address line of the bank.

  - `ca_designation_number: Optional[str]`

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

  - `description: Optional[str]`

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

  - `metadata: Optional[Dict[str, object]]`

    See the section on Metadata.

  - `route_number: Optional[str]`

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

  - `routing_number: Optional[str]`

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

  - `signature_image: Optional[str]`

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

  - `signature_text: Optional[str]`

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

  - `transit_number: Optional[str]`

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

### Example

```python
import os
from postgrid import PostGrid

client = PostGrid(
    print_mail_api_key=os.environ.get("POSTGRID_PRINT_MAIL_API_KEY"),  # This is the default and can be omitted
)
page = client.print_mail.bank_accounts.list()
page = page.data[0]
print(page.id)
```

#### 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

`print_mail.bank_accounts.retrieve(strid)  -> BankAccount`

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

Retrieve a bank account by ID.

### Parameters

- `id: str`

### Returns

- `class BankAccount: …`

  - `id: str`

    A unique ID prefixed with bank_account_

  - `account_number: str`

    The account number of the bank account.

  - `bank_country_code: BankAccountCountryCode`

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

    - `"CA"`

    - `"US"`

  - `bank_name: str`

    The name of the bank.

  - `created_at: datetime`

    The UTC time at which this resource was created.

  - `live: bool`

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

  - `object: Literal["bank_account"]`

    Always `bank_account`.

    - `"bank_account"`

  - `updated_at: datetime`

    The UTC time at which this resource was last updated.

  - `bank_primary_line: Optional[str]`

    The primary address line of the bank.

  - `bank_secondary_line: Optional[str]`

    The secondary address line of the bank.

  - `ca_designation_number: Optional[str]`

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

  - `description: Optional[str]`

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

  - `metadata: Optional[Dict[str, object]]`

    See the section on Metadata.

  - `route_number: Optional[str]`

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

  - `routing_number: Optional[str]`

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

  - `signature_image: Optional[str]`

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

  - `signature_text: Optional[str]`

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

  - `transit_number: Optional[str]`

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

### Example

```python
import os
from postgrid import PostGrid

client = PostGrid(
    print_mail_api_key=os.environ.get("POSTGRID_PRINT_MAIL_API_KEY"),  # This is the default and can be omitted
)
bank_account = client.print_mail.bank_accounts.retrieve(
    "id",
)
print(bank_account.id)
```

#### 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

`print_mail.bank_accounts.delete(strid)  -> BankAccountDeleteResponse`

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

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

### Parameters

- `id: str`

### Returns

- `class BankAccountDeleteResponse: …`

  - `id: str`

    A unique ID prefixed with bank_account_

  - `deleted: Literal[true]`

    - `true`

  - `object: Literal["bank_account"]`

    Always `bank_account`.

    - `"bank_account"`

### Example

```python
import os
from postgrid import PostGrid

client = PostGrid(
    print_mail_api_key=os.environ.get("POSTGRID_PRINT_MAIL_API_KEY"),  # This is the default and can be omitted
)
bank_account = client.print_mail.bank_accounts.delete(
    "id",
)
print(bank_account.id)
```

#### Response

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

## Domain Types

### Bank Account

- `class BankAccount: …`

  - `id: str`

    A unique ID prefixed with bank_account_

  - `account_number: str`

    The account number of the bank account.

  - `bank_country_code: BankAccountCountryCode`

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

    - `"CA"`

    - `"US"`

  - `bank_name: str`

    The name of the bank.

  - `created_at: datetime`

    The UTC time at which this resource was created.

  - `live: bool`

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

  - `object: Literal["bank_account"]`

    Always `bank_account`.

    - `"bank_account"`

  - `updated_at: datetime`

    The UTC time at which this resource was last updated.

  - `bank_primary_line: Optional[str]`

    The primary address line of the bank.

  - `bank_secondary_line: Optional[str]`

    The secondary address line of the bank.

  - `ca_designation_number: Optional[str]`

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

  - `description: Optional[str]`

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

  - `metadata: Optional[Dict[str, object]]`

    See the section on Metadata.

  - `route_number: Optional[str]`

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

  - `routing_number: Optional[str]`

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

  - `signature_image: Optional[str]`

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

  - `signature_text: Optional[str]`

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

  - `transit_number: Optional[str]`

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

### Bank Account Country Code

- `Literal["CA", "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

- `class BankAccountDeleteResponse: …`

  - `id: str`

    A unique ID prefixed with bank_account_

  - `deleted: Literal[true]`

    - `true`

  - `object: Literal["bank_account"]`

    Always `bank_account`.

    - `"bank_account"`
