> For the complete documentation index, see [llms.txt](https://docs.xyb.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xyb.co/xyb-platform-1/xyb-ledger/integrate-with-xyb-ledger/understanding-the-ledger-structure-charts-accounts-wallets/set-up-your-chart-structure.md).

# Set Up Your Chart Structure

Setting up your chart structure includes the following steps:

1. [**Create a Chart**](#id-1.-create-a-chart)
2. [**Add Accounts to the Chart**](#add-accounts-to-a-chart)
3. [**Add Wallets to Accounts**](#id-3.-add-wallets-to-accounts)
4. [**Test and Validate**](#id-5.-test-and-validate-your-chart)

{% hint style="info" %}
**When to use APIs/CLIs**

* **APIs:**
  * Ideal for bulk account creation or integration with other tools and workflows.
  * Enables automated updates and setup for multiple accounts.
* **CLI:** Suitable for manual configuration or quick additions during testing and development.
  {% endhint %}

### 1. Create a Chart

You can create a chart using either APIs for programmatic setup or the `luca` CLI for manual or scripted operations.

**a) Using APIs:** The Chart Management API allows you to create charts programmatically, making it ideal for automation and integration into workflows.

**Refer to the**[ **Chart Management API Reference**](/xyb-platform-1/xyb-ledger/api-reference-guides/ledger-setup-and-configuration-apis/chart-management-apis.md) **to create a chart.**

**b) Using the `luca` CLI:** The `luca` CLI provides a straightforward way to create charts manually or through shell scripts.

**Command**

```bash
./luca write-chart <chart_name>
```

**Example**

```bash
./luca write-chart CHART_US
```

***

### 2. Add Accounts to a Chart

Accounts are essential components of a chart, representing specific financial entities or groups, such as operational accounts or customer accounts. [Learn more about accounts in detail,](/xyb-platform-1/xyb-ledger/integrate-with-xyb-ledger/understanding-the-ledger-structure-charts-accounts-wallets/understanding-and-creating-accounts-in-the-ledger.md) besides the summary provided below.&#x20;

#### **a) Using APIs:** Refer to the [Account Management API Reference guide ](/xyb-platform-1/xyb-ledger/api-reference-guides/ledger-setup-and-configuration-apis/account-management-apis.md)here.

#### **b) Using the `luca` CLI:** Use the following command to add accounts to charts manually or through shell scripts.

**Command**

<pre class="language-bash"><code class="lang-bash"><strong>./luca write-chart-account &#x3C;chart_name> &#x3C;account_ref> --create-parent
</strong></code></pre>

**Example**

```bash
./luca write-chart-account CHART_US MAIN_ACCOUNT --create-parent
```

{% hint style="info" %}
Accounts are initialized in a "suspended state," meaning they cannot move money until they are opened. Wallets do not require activation and are valid by default. They open and close with the account.
{% endhint %}

Learn more about [creating accounts, types, features, states, and metadata](/xyb-platform-1/xyb-ledger/integrate-with-xyb-ledger/understanding-the-ledger-structure-charts-accounts-wallets/understanding-and-creating-accounts-in-the-ledger.md).

### 3. Add Wallets to Accounts

Associate wallets with accounts to handle specific currencies or assets.

**a) Using APIs:** The Wallet Management API allows you to create wallets programmatically, making it ideal for automation and integration into workflows.

**Refer to the** [**Wallet Management API Reference guide**](/xyb-platform-1/xyb-ledger/api-reference-guides/ledger-setup-and-configuration-apis/wallet-management-apis.md) **to create a chart.**

**b) Using the `luca` CLI:** Use the following command to add wallets to accounts manually or through shell scripts.

**Command**

```bash
./luca write-chart-wallet <chart_name> <account_ref> <wallet_name> <currency> <type> --create-parent
```

**Example**

<pre class="language-bash"><code class="lang-bash"><strong>./luca write-chart-wallet CHART_US MAIN_ACCOUNT DEFAULT USD ASSET --create-parent
</strong></code></pre>

Learn more about [wallets and its attributes](/xyb-platform-1/xyb-ledger/integrate-with-xyb-ledger/understanding-the-ledger-structure-charts-accounts-wallets/how-to-create-wallets-in-the-ledger-system.md).

#### **Summary of APIs for Chart Management**

Here’s a quick reference for the key API endpoints:

| **Action**     | **Endpoint**                                                   | **Purpose**                        |
| -------------- | -------------------------------------------------------------- | ---------------------------------- |
| Create a Chart | `POST /ledger/charts`                                          | Add a new chart                    |
| Add an Account | `POST /ledger/charts/{chart_id}/accounts`                      | Add an account to a chart          |
| Add a Wallet   | `POST /ledger/charts/{chart_id}/accounts/{account_id}/wallets` | Associate a wallet with an account |

For more details, refer to our [Chart Management APIs](/xyb-platform-1/xyb-ledger/api-reference-guides/ledger-setup-and-configuration-apis/chart-management-apis.md).


---

# 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://docs.xyb.co/xyb-platform-1/xyb-ledger/integrate-with-xyb-ledger/understanding-the-ledger-structure-charts-accounts-wallets/set-up-your-chart-structure.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.
