# Link an account at the connected bank to a bank account in the books

`POST /accounting/bank/accounts/link` · Rivier · accounting

Link an account at the connected bank to a bank account in the books.

- Scope: accounting:admin
- Sdk: accounting.bank.link
- Cli: accounting bank link

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "externalRef": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "an account the connected bank offers"
    },
    "bankAccountId": {
      "type": "string",
      "format": "uuid",
      "description": "an existing bank account to link; without it a new one is made"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "ledgerAccount": {
      "type": "string",
      "minLength": 1,
      "maxLength": 40,
      "description": "the ledger account a new bank account is kept on"
    }
  },
  "required": [
    "externalRef"
  ],
  "additionalProperties": false
}
```

## Responses

- `201`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/accounting/bank/accounts/link' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "externalRef": "string"
}'
```
