> For the complete documentation index, see [llms.txt](https://nexafin.gitbook.io/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nexafin.gitbook.io/api/public-api/transactions.md).

# Transactions

<figure><img src="/files/vB5jiCH0Aga2hh76psew" alt="Transactions list in Nexafin"><figcaption></figcaption></figure>

{% hint style="warning" %}
All API requests must include `Accept: application/json` and `Content-Type: application/json` headers. Without the `Accept` header, error responses will return HTML instead of JSON.
{% endhint %}

### Endpoints

## List and filter your transactions

<mark style="color:blue;">`GET`</mark> `https://app.nexafin.com/v1/transactions`

Returns both `booked` and `pending` transactions. Use the `status` field in the response to distinguish between them.

#### Query Parameters

| Name                       | Type    | Description                                                                                                 |
| -------------------------- | ------- | ----------------------------------------------------------------------------------------------------------- |
| page                       | integer | Page number.                                                                                                |
| per-page                   | integer | <p>Number of items per page.</p><p>Max value is 30.</p>                                                     |
| include                    | string  | <p>You can add one or multiple of category, bankAccount and bankAccount.bank.</p><p>Separated by comma.</p> |
| filter\[text]              | string  | Filter transactions by description or merchant name.                                                        |
| filter\[bank\_account\_id] | integer | Filter transactions by bank account ID.                                                                     |
| filter\[type]              | string  | Filter by transaction type: `income` or `expense`.                                                          |
| filter\[category]          | integer | Filter by category ID.                                                                                      |
| base-fiat                  | string  | In which currency do you want the transactions.                                                             |

#### Headers

| Name          | Type   | Description                                                                                    |
| ------------- | ------ | ---------------------------------------------------------------------------------------------- |
| authorization | string | <p>Bearer token or API key.</p><p><strong>Example:</strong></p><p>Bearer nxfn\_sk\_xxxx...</p> |

{% tabs %}
{% tab title="200 List of transactions" %}

```javascript
{
  "current_page": 1,
  "data": [
    {
      "id": 1,
      "bank_account_id": 1,
      "category_id": 20,
      "status": "booked",
      "type": "expense",
      "from": [],
      "to": [],
      "description": "Any random description for a transaction",
      "notes": null,
      "amount": -73640,
      "currency": "USD",
      "booked_at": "2022-08-14T00:00:00.000000Z",
      "created_at": "2022-08-14T22:13:58.000000Z",
      "updated_at": "2022-08-14T22:13:58.000000Z",
      "deleted_at": null,
      "category": {
        "id": 20,
        "parent_id": 17,
        "type": "expense",
        "level": 1,
        "accountable": 1,
        "slug": "transportation-expenses-expense",
        "icon": "emoji_transportation",
        "name": "Transportation expenses",
        "description": "All transactions that are recognized as payments for public transportation, taxi, toll roads, department of motor vehicles and car inspections",
        "created_at": "2022-08-14T22:13:56.000000Z",
        "updated_at": "2022-08-14T22:13:56.000000Z"
      },

      // ...
    }
  ],
  "first_page_url": "https://app.nexafin.com/v1/transactions?page=1",
  "from": 1,
  "last_page": 32,
  "last_page_url": "https://app.nexafin.com/v1/transactions?page=32",
  "links": [
    {
      "url": null,
      "label": "&laquo; Previous",
      "active": false
    },
    {
      "url": "https://app.nexafin.com/v1/transactions?page=1",
      "label": "1",
      "active": true
    },

    // ...

    {
      "url": "https://app.nexafin.com/v1/transactions?page=2",
      "label": "Next &raquo;",
      "active": false
    }
  ],
  "next_page_url": "https://app.nexafin.com/v1/transactions?page=2",
  "path": "https://app.nexafin.com/v1/transactions",
  "per_page": 30,
  "prev_page_url": null,
  "to": 1,
  "total": 32
}
```

{% endtab %}

{% tab title="401 Permission denied" %}

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Example request**

```bash
curl -X GET "https://app.nexafin.com/v1/transactions?include=category,bankAccount&per-page=10" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
```

{% endhint %}

## Create a new transaction

<mark style="color:green;">`POST`</mark> `https://app.nexafin.com/v1/transactions`

You can only create transactions for manual accounts.

#### Request Body

| Name                                                | Type    | Description                                                                           |
| --------------------------------------------------- | ------- | ------------------------------------------------------------------------------------- |
| amount<mark style="color:red;">\*</mark>            | Integer | In cents. Negative for expenses, positive for income (e.g., -5000 = -$50.00).         |
| bank\_account\_id<mark style="color:red;">\*</mark> | Integer | The ID of the bank account. Must be a manual account owned by the authenticated user. |
| booked\_at<mark style="color:red;">\*</mark>        | String  | Booked at date in Y-m-d format (e.g., `2026-03-16`).                                  |
| description<mark style="color:red;">\*</mark>       | String  | A description of the transaction.                                                     |
| currency                                            | String  | Currency code (e.g., `USD`, `EUR`). Inherited from bank account if not provided.      |
| notes                                               | String  | Optional notes for the transaction.                                                   |
| category\_id                                        | Integer | Category ID. Use `GET /v1/transaction-categories` to list available categories.       |

{% tabs %}
{% tab title="201: Created Transaction created" %}

```javascript
{
    "id": 9
}
```

{% endtab %}

{% tab title="422: Unprocessable Entity Missing or invalid fields" %}

```javascript
{
    "message": "The description field is required. (and 3 more errors)",
    "errors": {
        "amount": [
            "The amount field is required."
        ],
        "bank_account_id": [
            "The bank account id field is required."
        ],
        "booked_at": [
            "The booked at field is required."
        ],
        "description": [
            "The description field is required."
        ]
    }
}
```

{% endtab %}

{% tab title="400: Bad Request Account is not manual" %}

```javascript
{
    "message": "You can't create a transaction for a non-manual account."
}
```

{% endtab %}

{% tab title="401: Unauthorized Permission denied" %}

```javascript
{
    "message": "Unauthenticated."
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Example request**

```bash
curl -X POST https://app.nexafin.com/v1/transactions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "amount": -5000,
    "bank_account_id": 1,
    "booked_at": "2026-03-16",
    "description": "Monthly subscription",
    "currency": "USD",
    "notes": "Auto-billed",
    "category_id": 42
  }'
```

**Notes:**

* `amount` is in cents (e.g., -5000 = -$50.00). Negative for expenses, positive for income.
* `bank_account_id` must be a **manual** account you own. Use `GET /v1/bank-accounts` to find your account IDs.
* `booked_at` format: `YYYY-MM-DD`
* `currency` is optional — defaults to the bank account's currency.
  {% endhint %}

## Update a transaction

<mark style="color:orange;">`PUT`</mark> `https://app.nexafin.com/v1/transactions/{id}`

#### Path Parameters

| Name | Type    | Description    |
| ---- | ------- | -------------- |
| id   | Integer | Transaction ID |

#### Request Body

| Name         | Type    | Description              |
| ------------ | ------- | ------------------------ |
| category\_id | Integer | New transaction category |
| notes        | String  | New transaction notes    |

{% tabs %}
{% tab title="204: No Content Transaction updated successfully" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized Permission denied" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## Delete a transaction

<mark style="color:red;">`DELETE`</mark> `https://app.nexafin.com/v1/transactions/{id}`

The transaction will be marked as deleted and this action can't be undone.

#### Path Parameters

| Name | Type    | Description    |
| ---- | ------- | -------------- |
| id   | Integer | Transaction ID |

{% tabs %}
{% tab title="204: No Content Transaction deleted" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized Permission denied" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://nexafin.gitbook.io/api/public-api/transactions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
