# Counterparties

#### **Guide to Counterparty Management in AurixPay**

This guide explains how to view, register, and manage counterparties (customers, suppliers, or partners) and their bank accounts in the AurixPay system, using clear and non-technical language.

***

### **1. View an Existing Counterparty**

**Purpose:** Retrieve detailed information about a registered counterparty.

**How to do it:**

* You’ll need the counterparty’s **unique ID** (e.g., `5d2811d0-c016-4bc9-bc53-848b1d0bc0c6`).
* The system will return:
  * **Name** of the counterparty.
  * **Tax ID (CPF/CNPJ)** (without punctuation).
  * **Creation and update dates**.

**Possible errors:**

* **Access denied:** Check your authentication key.
* **Counterparty not found:** Verify the ID.

***

### **2. Register or Search for a Counterparty**

**Purpose:** Register a new counterparty or find an existing one using their name and tax ID (CPF/CNPJ).

**How to do it:**

* Submit the **name** and **tax ID (CPF/CNPJ)** (without punctuation).
* If the counterparty already exists, the system will return their current details.
* If not, they will be registered automatically.

**Returned data:**

* Unique ID, name, tax ID, and registration dates.

**Possible errors:**

* **Invalid tax ID:** Check the entered number.
* **Permission denied:** Your API key may be incorrect.

***

### **3. Register a Bank Account for a Counterparty**

**Purpose:** Link a new bank account to an existing counterparty.

**How to do it:**

* Provide:
  * **Branch number** (without digit, e.g., `0001`).
  * **Branch digit** (optional).
  * **Account number** (no hyphens).
  * **Account type** (`checking` for checking account or `savings` for savings account).
  * **Bank ISPB code** (8 digits, available on the Central Bank’s website).
  * **Bank name**.

**Returned data:**

* Account ID, bank details, and link to the counterparty.

**Possible errors:**

* **Incomplete data:** Fill in all required fields.
* **Counterparty does not exist:** Check the provided ID.

***

### **4. View All Bank Accounts of a Counterparty**

**Purpose:** List all registered bank accounts for a counterparty.

**How to do it:**

* Provide the **counterparty’s ID**.
* The system will return a list with:
  * **Branch and account numbers**.
  * **Account type** (checking/savings).
  * **Bank details** (name and ISPB code).

**Possible errors:**

* **No accounts registered:** The counterparty has no linked accounts yet.
* **Invalid ID:** Verify the counterparty’s ID.

***

### **5. View a Specific Bank Account**

**Purpose:** Check detailed information for a specific bank account linked to a counterparty.

**How to do it:**

* Provide the **counterparty’s ID** and the **bank account ID**.
* The system will return:
  * **Branch and account numbers**.
  * **Account type**.
  * **Bank details** (ISPB code and name).

**Possible errors:**

* **Account not found:** Verify the provided IDs.
* **Access denied:** Your API key may be incorrect.

***

#### **Summary of Operations**

| Action                           | When to Use                                 |
| -------------------------------- | ------------------------------------------- |
| **View counterparty**            | Check a customer/supplier’s details.        |
| **Register/Search counterparty** | Avoid duplicate registrations.              |
| **Update financial limit**       | Set maximum transaction amounts.            |
| **Register bank account**        | Link a new account to a counterparty.       |
| **List bank accounts**           | View all accounts linked to a counterparty. |
| **View specific bank account**   | Validate details before a transfer.         |

***

#### **Important Tips**

* **Tax ID (CPF/CNPJ):** Always submit without punctuation.
* **Monetary values:** Use cents (e.g., R$ 100.00 = `10000`).
* **ISPB code:** Check the Central Bank’s website.

For questions, consult the official documentation or contact support.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aurixpay.com/developers/counterparties.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
