# AIS

### How does it work?

Upon your user consent, TransactionLink connects to their bank to download their data.

More about this service you can find [here](https://www.transactionlink.io/integrations/transactionlink-2)

<figure><img src="https://files.readme.io/c5b7a3a-Group_1521.png" alt=""><figcaption></figcaption></figure>

### Configuration: Redirect and embedded

The AIS app can be configured to follow two different flows.\
Every flow returns different data, and it's up to you to decide which one suits your use-case.

#### The redirect flow

In this flow the user is redirected to the bank's website, where he consents for the data download.\
This flow is the most common choice as it provides more robustness.\
However, it doesn't provide detailed personal data like personal identity number, so it's KYC capabilities are limited.

#### The embedded flow

In this flow all the interactions happen within TransactionLink's widget.\
The data download happens only once and transactions history is limited to three months.\
On the other hand you're able to get more of the personal data for example identity number.

#### Supported banks

To check the list of supported banks please go to [this section](/docs/v1/integrations/ais/data-fields-availability-across-banks.md).

### Response Content

**AIS**:

| Field  | Type   | Description                                                                                                                                                                                                                                                                                                                 |
| ------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| status | String | <p>Integration result status:<br><br>One of possible values:<br></p><ul><li><code>COMPLETE</code> - completed with success</li><li><code>TIMEDOUT</code> - timeout occured due to no user activity on widget</li><li><code>OMITTED</code> - user selected that his bank is not available and AIS task was omitted</li></ul> |
| code   | String | <p>Code related with status: <br><br>One of possible values:</p><ul><li><code>bank.notFound</code> - User bank was not found on available bank list</li></ul>                                                                                                                                                               |

**Identity**:

| Field                  | Type   | Description                            |
| ---------------------- | ------ | -------------------------------------- |
| firstName              | String | First name of the person               |
| lastName               | String | Last name of the person                |
| personalIdentityNumber | String | Personal Identity Number of the person |
| personAddresses        | Object | Object containing person's addresses   |
| citizenship            | String | Citizenship of the person              |
| gender                 | String | Gender of the person                   |
| birthDate              | String | Date of birth of the person            |
| resourceType           | String | Type of the resource                   |

**PersonAddresses**:

| Field    | Type   | Description                        |
| -------- | ------ | ---------------------------------- |
| registry | Object | Object containing registry address |

**Registry**:

| Field      | Type   | Description            |
| ---------- | ------ | ---------------------- |
| city       | String | City name              |
| country    | String | Country name           |
| postalCode | String | Postal code            |
| street     | String | Street name and number |

**Accounts:**

| Field            | Type   | Description                                                 |
| ---------------- | ------ | ----------------------------------------------------------- |
| id               | String | Unique identifier of the account.                           |
| number           | String | Account number.                                             |
| name             | String | Account name.                                               |
| openedAt         | String | Date when the account was opened.                           |
| currency         | String | Currency of the account.                                    |
| availableBalance | Number | Available balance in the account.                           |
| bookingBalance   | Number | Booking balance in the account.                             |
| overdraftLimit   | Number | Overdraft limit of the account.                             |
| bic              | String | Bank Identifier Code of the bank where the account is held. |
| bankName         | String | Name of the bank where the account is held.                 |
| transactions     | Array  | List of transactions associated with the account.           |

**Transactions**

| Field                  | Type   | Description                                                       |
| ---------------------- | ------ | ----------------------------------------------------------------- |
| id                     | String | Unique identifier of the transaction.                             |
| accountId              | String | Unique identifier of the account associated with the transaction. |
| amount                 | Number | Amount of the transaction.                                        |
| currency               | String | Currency of the transaction.                                      |
| title                  | String | Title of the transaction.                                         |
| tradedAt               | String | Date and time when the transaction was made.                      |
| status                 | String | Status of the transaction.                                        |
| accountNumber          | String | Account number of the counterparty.                               |
| description            | String | Description of the transaction.                                   |
| bookedAt               | String | Date and time when the transaction was booked.                    |
| counterpartyAccount    | String | Account number of the counterparty.                               |
| counterpartyName       | String | Name of the counterparty.                                         |
| counterpartyBic        | String | Bank Identifier Code of the counterparty.                         |
| counterpartyBankName   | String | Name of the counterparty bank.                                    |
| category               | String | Category of the transaction.                                      |
| postTransactionBalance | Number | Balance after the transaction was made.                           |

#### Example response

```json
{
    "ais": {
        "status": "COMPLETED",
        "identity": {
            "firstName": "Anna",
            "lastName": "Nowak",
            "personalIdentityNumber": "81021118350",
            "personAddresses": {
                "registry": {
                    "city": "Pcim",
                    "country": "Poland",
                    "postalCode": "32-432",
                    "street": "Pcim 143"
                }
            },
            "citizenship": "Poland",
            "gender": "M",
            "birthDate": "1981-02-11",
            "resourceType": "PERSON"
        },
        "accounts": [
            {
                "id": "ad09b363-8614-4b4a-820a-e9f325043932",
                "number": "PL28114020040000330279698727",
                "name": "Konto Firmowe",
                "openedAt": "2017-10-15T15:26:26.752Z",
                "currency": "PLN",
                "availableBalance": 18965887,
                "bookingBalance": 18965887,
                "overdraftLimit": 0,
                "bic": "IEEAPLPAXXX",
                "bankName": "Idea Bank S.A.",
                "transactions": [
                    {
                        "id": "e2867fc8-fddf-4157-ab64-aba306e9674e",
                        "accountId": "ad09b363-8614-4b4a-820a-e9f325043932",
                        "amount": 7795,
                        "currency": "PLN",
                        "title": "Faktura za wynajem",
                        "tradedAt": "2022-04-20T19:47:12.966Z",
                        "status": "DONE",
                        "accountNumber": "PL28114020040000330279698727",
                        "description": "additional info",
                        "bookedAt": "2022-04-20T19:47:12.966Z",
                        "counterpartyAccount": "PL23116022600319418058981335",
                        "counterpartyName": "Sklep Alexander",
                        "counterpartyBic": "IEEAPLPAXXX",
                        "counterpartyBankName": "Bank Millenium SA",
                        "category": "TRANSFER",
                        "postTransactionBalance": 6613.29
                    },
                ]
            }
        ]
    }
}
```


---

# 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.transactionlink.io/docs/v1/integrations/ais.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.
