# Transactions

<figure><img src="/files/mzmF9NfbQBHlEuYvwYqX" alt=""><figcaption></figcaption></figure>

### Endpoints

## List and filter your transactions

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

#### Query Parameters

| Name          | Type    | Description                                                                                                        |
| ------------- | ------- | ------------------------------------------------------------------------------------------------------------------ |
| page          | integer | Page number.                                                                                                       |
| include       | string  | <p>You can add one or multiple of category, bankAccount and bankAccount.bank.</p><p></p><p>Separated by comma.</p> |
| filter\[text] | string  | Filter transaction by concept or notes.                                                                            |
| base-fiat     | string  | In which currency do you want the transactions.                                                                    |
| per-page      | integer | <p>Number of items per page. </p><p>Max value, it's 30.</p>                                                        |

#### Headers

| Name          | Type   | Description                                                                                                            |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------------------------- |
| authorization | string | <p>Bearer token of the user.</p><p></p><p><strong>Example:</strong> </p><p>Bearer eyJ0eXAiOiJK…abJfpQc07c\_eig-Eok</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": [],
      "concept": "Any random concept 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": "http://monse.test/v1/transactions?include=category%2CbankAccount%2CbankAccount.bank&per-page=1&page=1",
  "from": 1,
  "last_page": 32,
  "last_page_url": "http://monse.test/v1/transactions?include=category%2CbankAccount%2CbankAccount.bank&per-page=1&page=32",
  "links": [
    {
      "url": null,
      "label": "&laquo; Previous",
      "active": false
    },
    {
      "url": "http://monse.test/v1/transactions?include=category%2CbankAccount%2CbankAccount.bank&per-page=1&page=1",
      "label": "1",
      "active": true
    },
    {
      "url": "http://monse.test/v1/transactions?include=category%2CbankAccount%2CbankAccount.bank&per-page=1&page=2",
      "label": "2",
      "active": false
    },
    
    // ...
    
    {
      "url": "http://monse.test/v1/transactions?include=category%2CbankAccount%2CbankAccount.bank&per-page=1&page=2",
      "label": "Next &raquo;",
      "active": false
    }
  ],
  "next_page_url": "http://monse.test/v1/transactions?include=category%2CbankAccount%2CbankAccount.bank&per-page=1&page=2",
  "path": "http://monse.test/v1/transactions",
  "per_page": 30,
  "prev_page_url": null,
  "to": 1,
  "total": 32
}
```

{% endtab %}

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

{% endtab %}
{% endtabs %}

## Create a new transaction

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

You can only create transactions for manual accounts.

#### Request Body

| Name                                                | Type    | Description                                             |
| --------------------------------------------------- | ------- | ------------------------------------------------------- |
| amount<mark style="color:red;">\*</mark>            | Integer | In cents                                                |
| bank\_account\_id<mark style="color:red;">\*</mark> | Integer | The ID of the bank account.                             |
| booked\_at<mark style="color:red;">\*</mark>        | String  | Booked at date in Y-m-d format.                         |
| concept<mark style="color:red;">\*</mark>           | String  | A description of the transaction.                       |
| notes                                               | String  |                                                         |
| category\_id                                        | Integer |                                                         |
| currency                                            | String  | Currency code. Inherited from bank account if no value. |

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

```javascript
{
    'id': 9
}
```

{% endtab %}

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

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

{% endtab %}

{% tab title="400: Bad Request Missing or invalid fields" %}

```javascript
{
    "amount": [
        "The amount field is required."
    ],
    "bank_account_id": [
        "The bank account id field is required."
    ],
    "booked_at": [
        "The booked at field is required."
    ],
    "concept": [
        "The concept field is required."
    ]
}
```

{% endtab %}
{% endtabs %}

## Update a transaction

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

#### Path Parameters

| Name | Type    | Description    |
| ---- | ------- | -------------- |
|      | 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://monse.app/v1/transactions/{id}`

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

#### Query Parameters

| Name | Type    | Description    |
| ---- | ------- | -------------- |
|      | 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: 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://monse.gitbook.io/monse/reference/transactions.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.
