# Retrieving Transaction Lines

### Data Retrieval Methods

#### Get Single Transaction Line by Unique Key

* **Description:** Retrieves a single Transaction Line using the get function, with Line UUID as the only supported key.
* **Syntax:**

  ```javascript
  pepperi.api.transactionLines.get({
    key: { UUID: "<UUID>" },
    fields: [<string array of relevant field names>]
  });
  ```
* **Example:**

  ```javascript
  pepperi.api.transactionLines.get({
    key: { UUID: "aefb523e-74ac-4041-8bb1-a76a3b5e78d8" },
    fields: ["UnitsQuantity", "Item.ExternalID"]
  });
  ```
* **Returns:**

  ```json
  {
    "success": true,
    "object": {
      "UUID": "aefb523e-74ac-4041-8bb1-a76a3b5e78d8",
      "UnitsQuantity": 34,
      "Item.ExternalID": "ABCD123"
    }
  }
  ```

#### Search List of Transaction Lines by Filter

* **Description:** Retrieves multiple Transaction Lines using the search function with a filter, sorting, page size, and page number.
* **Syntax:**

  ```javascript
  pepperi.api.transactionLines.search({
    fields: [<string array of relevant field names>],
    filter: { <filter object> },
    sorting: [{ Field: "<fieldName>", Ascending: <boolean> }],
    pageSize: <number>,
    page: <number>
  });
  ```
* **Example:**

  ```javascript
  pepperi.api.transactionLines.search({
    fields: ["Transaction.UUID", "ExternalID", "MyTSA"],
    filter: {
      "Operation": "AND",
      "LeftNode": { "ApiName": "APIName1", "Operation": ">", "Values": ["7"] },
      "RightNode": { "ApiName": "ApiName2", "Operation": "InTheLast", "Values": ["4", "Weeks"] }
    },
    sorting: [{ "Field": "MyTSA", "Ascending": true }, { "Field": "MyTSA2", "Ascending": true }],
    pageSize: 1000,
    page: 1
  });
  ```
* **Returns:**

  ```json
  {
    "success": true,
    "objects": [
      {
        "UUID": "aefb523e-74ac-4041-8bb1-a76a3b5e78d8",
        "ExternalID": "abc123",
        "MyTSA": 12.8
      },
      {
        "UUID": "aefb5346-74ac-4041-8bb1-a76a3b5e734h",
        "ExternalID": "abc456",
        "MyTSA": 34.5
      }
    ]
  }
  ```

#### Search List of Transaction Lines by Transaction Filter and Transaction Lines Filter

* **Description:** Retrieves Transaction Lines from transactions not yet loaded into memory using the search function with separate transactionFilter and filter parameters.
* **Purpose:** Enables fetching lines from unloaded transactions efficiently.
* **Syntax:**

  ```javascript
  pepperi.api.transactionLines.search({
    fields: [<string array of relevant field names>],
    transactionFilter: { <filter object> },
    filter: { <filter object> },
    sort: [{ Field: "<fieldName>", Ascending: <boolean> }],
    pageSize: <number>,
    page: <number>
  });
  ```
* **Example:**

  ```javascript
  pepperi.api.transactionLines.search({
    fields: ["UUID", "ExternalID", "MyTSA"],
    transactionFilter: {
      "Operation": "AND",
      "LeftNode": { "ApiName": "APIName1", "Operation": ">", "Values": ["7"] },
      "RightNode": { "ApiName": "ApiName2", "Operation": "InTheLast", "Values": ["4", "Weeks"] }
    },
    filter: {
      "Operation": "AND",
      "LeftNode": { "ApiName": "APIName1", "Operation": ">", "Values": ["7"] },
      "RightNode": { "ApiName": "ApiName2", "Operation": "InTheLast", "Values": ["4", "Weeks"] }
    },
    sort: [{ "Field": "MyTSA", "Ascending": true }, { "Field": "MyTSA2", "Ascending": true }],
    pageSize: 1000,
    page: 1
  });
  ```
* **Returns:**

  ```json
  {
    "success": true,
    "objects": [
      {
        "UUID": "aefb523e-74ac-4041-8bb1-a76a3b5e78d8",
        "ExternalID": "abc123",
        "MyTSA": 12.8
      },
      {
        "UUID": "aefb5346-74ac-4041-8bb1-a76a3b5e734h",
        "ExternalID": "abc456",
        "MyTSA": 34.5
      }
    ]
  }
  ```


---

# 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://apidocs.pepperi.com/retrieving-data-1/retrieving-transaction-lines.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.
