## Transactions API examples

### View 2 most recent card transactions.

REQUEST

* `GET` "https://api.brex.com/v2/transactions/card/primary?limit=2"
* Requires `transactions.card.readonly` scope


RESPONSE


```json
{
    "next_cursor": "eyJsaW1pdCI6Miwib2Zmc2V0IjoyfQ==",
    "items": [
        {
            "id": "pste_ckuxu8f0j07jn0ddg6bjofzde",
            "description": "Payment – Thank you!",
            "amount": {
                "amount": -63600,
                "currency": "USD"
            },
            "posted_at_date": "2021-10-19",
            "type": "COLLECTION"
        },
        {
            "id": "pste_ckuwiblvv1tn101l3zvscxis8",
            "card_id": "ncard_ckrz3n9b9013i01h5hgdyz7jh",
            "description": "Chili's",
            "amount": {
                "amount": 12900,
                "currency": "USD"
            },
            "posted_at_date": "2021-10-18",
            "type": "PURCHASE"
        }
    ]
}
```

### Bulk fetch recent card transactions with pagination.

To bulk fetch card transactions, you will need to paginate through the results with the `cursor` parameter.

For example, let's say there are 200 transactions available. After making the first call to the endpoint, you will get details about the 100 transactions and there will also be a field called `next_cursor` in the response. To get the next 100 results in your second call to the endpoint, you will set the `cursor` parameter to the value returned in the `next_cursor` field from your first API call. You will continue this pattern to get all the available results.

More details about how pagination works in the Brex API are [documented here](https://developer.brex.com/docs/pagination).

REQUEST

* `GET` "https://api.brex.com/v2/transactions/card/primary?limit=100&cursor=eyJsaW1pdCI6Miwib2Zmc2V0IjoyfQ=="
* Requires `transactions.card.readonly` scope


RESPONSE


```json
{
    "next_cursor": "ayKsaW2pdCI7Miwib4Zmc3V0IjdyfQ==",
    "items": [
        {
            "id": "pste_ckuxu8f0j07jn0ddg6bjofzde",
            "description": "Payment – Thank you!",
            "amount": {
                "amount": -63600,
                "currency": "USD"
            },
            "posted_at_date": "2021-10-19",
            "type": "COLLECTION"
        },
        {
            "id": "pste_ckuwiblvv1tn101l3zvscxis8",
            "card_id": "ncard_ckrz3n9b9013i01h5hgdyz7jh",
            "description": "Chili's",
            "amount": {
                "amount": 12900,
                "currency": "USD"
            },
            "posted_at_date": "2021-10-18",
            "type": "PURCHASE"
        }
    ]
}
```