# Entries

Entries (*entry*) are financial movements between registered balances in the form of double-entry bookkeeping (a debit and a credit) at the time of transaction execution.

Each Entry represents a specific event and in a transaction. One or more Entries can be atomically recorded, such as the principal amount of a transaction along with a specific fee.

Along with the Entries, the system records - atomically during the transaction - the Statements (*journal*) of each involved account, both for debits and credits.

Entries capture all the necessary information for the analysis of the transaction history:

| Field                       | Description                                                                        |
| --------------------------- | ---------------------------------------------------------------------------------- |
| *id*                        | Unique identifier of the entry                                                     |
| *external\_id*              | User-defined identifier for the entry at the time of transaction creation          |
| *parent\_transaction\_id*   | User-defined identifier for a prior transaction related to the current transaction |
| *transaction\_id*           | Transaction identifier                                                             |
| *transaction\_type*         | Transaction type used                                                              |
| *entry\_order*              | Order of creation of the entry as determined in the *setup*                        |
| *entry\_type*               | User-defined identifier name for the current entry                                 |
| *currency*                  | Currency used in the entry                                                         |
| *amount*                    | Value of the entry                                                                 |
| *debit\_balance\_id*        | Identifier of the debited balance                                                  |
| *debit\_balance\_after*     | Balance amount after the debit                                                     |
| *debit\_balance\_seq\_num*  | Sequential value movement of the debited balance                                   |
| *credit\_account\_id*       | Identifier of the credited balance                                                 |
| *credit\_balance\_after*    | Balance amount after the credit                                                    |
| *credit\_balance\_seq\_num* | Sequential value movement of the credited balance                                  |
| *created\_at*               | Creation datetime of the transaction                                               |
| *settled\_at*               | Reference date of the transaction (optionally provided)                            |

## Entries Query <a href="#entries-query" id="entries-query"></a>

The Entries can be queried using the GET /transaction/{id}/entry method, using parameters as shown in the following example.

Example of Entry query:

```json
GET /transaction/96296a5c-0cf4-4025-dbc4-1a53f0a3afc6/entry
```

Response example:

```json
{
  "entries": [
    {
      "id": "ea355ff5-6a2e-a57e-708c-7ab94e79c7f6",
      "external_id": "our id 1234",
      "parent_transaction_id": "ea355ff5-6a2e-a57e-708c-7ab94e79c7f6",
      "transaction_id": "96296a5c-0cf4-4025-dbc4-1a53f0a3afc6",
      "transaction_type": "card_purchase",
      "entry_order": 1,
      "entry_type": "main_amount",
      "currency": "brl",
      "amount": 10000,
      "debit_balance_id": "a8f5f167-f44f-4964-e6c9-98dee827110c",
      "debit_balance_after": 300,
      "debit_balance_seq_num": 345,
      "credit_balance_id": "3634bee6-1e59-f282-4f76-d61db9007f70",
      "credit_balance_after": 10000,
      "credit_balance_seq_num": 12361,
      "created_at": "2023-06-05T11:26:17.325Z",
      "settled_at": "2023-06-05",
      "metadata": {
        "key": "value"  
      }
    }
  ]
}
```


---

# 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://ledgera.gitbook.io/api/core/transactions/entries.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.
