# API tải thông tin giao dịch

## &#x20;Lấy thông tin giao dịch ngân hàng &#x20;

<mark style="color:blue;">`GET`</mark> `https://oauth.casso.vn/v1/transactions`

API này cho phép lấy toàn bộ thông tin giao dịch ngân hàng theo `Query Parameters`

#### Query Parameters

| Name     | Type    | Description                                                                             |
| -------- | ------- | --------------------------------------------------------------------------------------- |
| sort     | string  | Sắp xếp tăng hoặc giảm dần dựa theo thời gian của giao dịch. Mặc định là ASC(tăng dần). |
| pageSize | string  | Kích thước của trang                                                                    |
| page     | integer | Số thứ tự trang                                                                         |
| fromDate | string  | Lấy giao dịch bắt đầu từ ngày. Định dạng: YYYY-MM-                                      |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Access-Token |

{% tabs %}
{% tab title="200 Response chi tiết các giao dịch ngân hàng" %}
{% tabs %}
{% tab title="Response giao dịch" %}

```
{
    "error": 0,
    "message": "success",
    "data": [
        {
            "id": 3267,
            "tid": "TF210403249039850",
            "description": "refund",
            "amount": 70000000,
            "cusum_balance": 7303904,
            "when": "2021-04-03"
        },
        {
            "id": 3268,
            "tid": "TF210403249040659",
            "description": "chuyen tien tro T4",
            "amount": 1767000,
            "cusum_balance": 5536904,
            "when": "2021-04-03"
        },
    ]
}
```

{% endtab %}

{% tab title="Response theo page" %}

```
{
    "error": 0,
    "message": "success",
    "data": {
        "page": 4,
        "pageSize": 10,
        "nextPage": 5,
        "prevPage": 3,
        "totalPages": 35,
        "totalRecords": 341,
        "records": [
            {
                "id": 5789,
                "tid": "TF210415239581402",
                "description": "chuyen tien",
                "amount": -193000,
                "cusum_balance": 1070904,
                "when": "2021-04-15"
            },
            {
                "id": 5790,
                "tid": "TF210415299602811",
                "description": "Chuyen tien nap momo",
                "amount": -350000,
                "cusum_balance": 720904,
                "when": "2021-04-15"
            },
        ]
    }
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="401 Access-Token không đúng hoặc đã hết hạn" %}

```
{
    "error": 401,
    "message": "Unauthorized Access",
    "data": null
}
```

{% endtab %}
{% endtabs %}

#### Chi tiết các tham số

| Tham số        | Mô tả                                                                                    | Gá trị mặc định |
| -------------- | ---------------------------------------------------------------------------------------- | --------------- |
| ***fromDate*** | Thời gian bắt đầu bạn muốn lấy giao                                                     | 7 ngày gần nhất |
| ***page***     | Số thứ tự trang                                                                          | 1               |
| ***pageSize*** | Số item trên một trang                                                                   | 10              |
| ***sort***     | Sắp xếp giao dịch, các giá trị gồm: ASC, DESC. Với ASC là tăng dần còn DESC là giảm dần. | ASC             |

{% hint style="info" %}
Nếu tham số nào không tồn tại thì sẽ lấy giá trị mặc định.
{% endhint %}

```
curl --location --request GET 'https://oauth.casso.vn/v1/transactions?fromDate=2021-04-01&page=4&pageSize=20&sort=ASC' \
--header 'Authorization: Access token'
```

## Lấy chi tiết thông tin giao dịch theo id giao dịch

<mark style="color:blue;">`GET`</mark> `https://oauth.casso.vn/v1/transactions/:id`

#### Path Parameters

| Name | Type   | Description                      |
| ---- | ------ | -------------------------------- |
| id   | number | `id của giao dịch trên hệ thống` |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Access-Token |

{% tabs %}
{% tab title="200 Thông tin chi tiết của 1 giao dịch" %}

```
{
    "error": 0,
    "message": "success",
    "data": {
        "id": 314344,
        "tid": "TF210702253136879",
        "description": "DH220",
        "amount": -10000,
        "cusumBalance": 389460,
        "when": "2021-07-02",
        "bankSubAccId": "8007041023848"
    }
}
```

{% endtab %}

{% tab title="401 " %}

```
{
    "error": 401,
    "message": "Unauthorized Access",
    "data": null
}
```

{% endtab %}
{% endtabs %}

```
curl --location --request GET 'https://oauth.casso.vn/v1/transactions/123 \
--header 'Authorization: Access token'
```


---

# 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://developer.casso.vn/v1/danh-sach-api/api-tai-thong-tin-giao-dich.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.
