# Counterparties on bank statements

> One contact behind every name a vendor or customer appears under on bank and card statements: aliases, the names learned from confirmed matches, and "same as …" on the Bank page.

Source: /help/en/contacts/counterparties

A bank statement spells the same vendor many ways: **DEWA**, **D.E.W.A**, **Dubai Electricity**. Alya Books keeps one **counterparty** behind all of them: the contact, with the other names it appears under as **aliases**. Every bank transaction carries the contact it resolved to, so the Bank page, reports and the matcher all see the same vendor.

## How a name is resolved

When a statement is imported (a CSV upload, a bank feed, `POST /bank/import`), each row's **statement name** (the counterparty or payee column when the bank gives one, else the description) is **normalised** (lower case, "&" read as "and", dots dropped, punctuation and legal suffixes such as LLC, FZE, L.L.C removed) and looked up:

1. an **alias** you recorded on a contact,
2. a contact whose **name, trading name or Arabic name** normalises to the same text,
3. a name **learned** from a confirmed bank match.

A match sets the transaction's counterparty at once. A name nobody knows stays open and shows on the Bank page in the **Counterparty** column as *Same as …?* with the contacts it looks like.

## Same as … on the Bank page

**Bank → Counterparty column.** For an open name the button offers the closest contact (*Same as Dubai Electricity & Water Authority?*); open it to see up to three candidates with a score (100 % the same name once normalised, 90 % one is the start of the other, else the share of words in common), every other contact, and **Create vendor**.

- Choosing a contact records the name as its alias and attaches **every open transaction** under that name, now and in later imports.
- **Create vendor** opens the contact form with the statement name filled in; saving it records the alias and attaches the transactions in one go.

## Learning from matches

Confirming a bank match (a customer's payment on an invoice, a payment of a supplier's bill) attaches the invoice's customer or the bill's supplier to the transaction and **learns the statement name** as an alias of that contact, unless the name is already an alias of another contact. Later statements under that name resolve on import.

## The Aliases card

**Contacts → open the contact → Additional → Names on bank statements.** The card lists the aliases with how each was recorded (*added*, *learned*, *imported*) and how many transactions carry it. **Add name** records another spelling (and attaches the open transactions under it); the bin removes one (transactions already attached stay attached). The contact's row also carries the aliases, so a search for "DEWA" finds the authority.

## Inline vendor creation

The bill editor, the expense editor and the recurring profile dialog carry a **Create vendor** button beside the supplier field: the contact form opens over the editor, and the new vendor is selected when you save it.

## API and MCP

`GET /counterparties/suggestions` lists the open names with their candidates; `POST /customers/{id}/aliases { alias }` records an alias and answers how many transactions were attached; `GET` and `DELETE /customers/{id}/aliases/{aliasId}` list and remove them. Bank transactions carry `contactId`. MCP: `list_counterparty_suggestions`, `merge_counterparty_alias`, `list_contact_aliases`, `remove_counterparty_alias`.

## Walkthrough: DEWA three ways

1. Create the vendor **Dubai Electricity & Water Authority**. Open it, **Additional → Names on bank statements**, add **DEWA**.
2. **Bank → Upload statement** with three debits whose counterparty columns (or, as in most exports, whose descriptions) read *DEWA*, *D.E.W.A* and *Dubai Electricity*.
3. The first two show the authority in the **Counterparty** column at once (the alias covers both spellings). The third shows *Same as Dubai Electricity & Water Authority?*; choose it.
4. The contact's Aliases card now lists **DEWA** (added) and **Dubai Electricity** (added), each with its transaction count. Upload the next month's statement: all three spellings resolve on import.
5. Confirm a match of a *CAREEM NETWORKS FZ LLC* debit against a Careem bill: the transaction gets the vendor, and the Aliases card of Careem shows the name as *learned*.
