> For the complete documentation index, see [llms.txt](https://apidocs.pepperi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.pepperi.com/retrieving-data-1/retrieving-user-defined-tables.md).

# Retrieving User Defined Tables

### Data Retrieval Methods

#### Get Single Value from User Defined Table

* **Description:** Retrieves a single value from a UDT using the get function,&#x20;
* **Syntax:**

  ```javascript
  pepperi.api.userDefinedTables.get({
    table: "<tableName>",
    mainKey: "<mainKey>",
    secondaryKey: "<secondaryKey>"
  });
  ```
* **Example:**

  ```javascript
  pepperi.api.userDefinedTables.get({
    table: "myTable",
    mainKey: "Item123",
    secondaryKey: "Category124"
  });
  ```
* **Returns:**

  ```json
  {
    "success": true,
    "value": "1"
  }
  ```

{% hint style="warning" %}
Requiring both **mainKey** and **secondaryKey** parameters.
{% endhint %}

#### Get List of Values from User Defined Table

* **Description:** Retrieves a list of values from a UDT using the getList function, available from CPI 15.70.&#x20;
  * The currentAccountScope parameter defaults to true (limits to current account scope); set to false to load all data from disk.
* **Syntax:**

  ```javascript
  pepperi.api.userDefinedTables.getList({
    table: "<tableName>",
    mainKey: "<mainKey>" (optional),
    secondaryKey: "<secondaryKey>" (optional),
    currentAccountScope: <boolean>
  });
  ```
* **Example:**

  ```javascript
  pepperi.api.userDefinedTables.getList({
    table: "myTable",
    mainKey: "Item123",
    currentAccountScope: true
  });
  ```
* **Returns:**

  ```json
  {
    "success": true,
    "objects": [
      { "mainKey": "ABCD12", "secondaryKey": "GFT4", "value": "23.5" },
      { "mainKey": "ABCD12", "secondaryKey": "GFT5", "value": "5656.5" }
    ]
  }
  ```

{% hint style="warning" %}
Requires at least **tableName. mainKey** and **secondaryKey** are optional.&#x20;
{% endhint %}

{% hint style="warning" %}
**Note:** Availale only from CPI 15.70.
{% endhint %}


---

# 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://apidocs.pepperi.com/retrieving-data-1/retrieving-user-defined-tables.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.
