# Low-level API for saving and loading

## Overview

The low-level API is recommended when you want to use save/load UI elements that are not part of the TradingView UI.
With the low-level API, you can save and load [chart layouts] and [indicator templates].
Note that the low-level API methods are meant to be called directly by your JavaScript code.

:::info

This approach does not support saving [chart templates].
Consider implementing the [API handlers] instead.

:::

## How to implement

To access the chart layout content directly, use the [`save`] and [`load`] methods.
These methods are defined in the [`IChartingLibraryWidget`] interface and allow controlling the `widget` object.

```js
// Function to store the chart layout
function storeChartLayout(layout) {
    // Implement your logic here
};

const widget = new TradingView.widget(/* Widget properties */);
widget.save().then((layout) => { storeChartLayout(layout) }); // Save the layout using the save() method

widget.load(storedLayout); // Later in your code, you can load the stored layout
```

To access the indicator templates, use the [`createStudyTemplate`] and [`applyStudyTemplate`] methods.
Note that you can access these methods through the [`chart`] or [`activeChart`] widget methods.

```js
widget.chartReady().then(() => {
    const options = { saveSymbol: true, saveInterval: true };
    const template = widget.activeChart().createStudyTemplate(options);

    widget.activeChart().applyStudyTemplate(template);
});
```

The content is saved as a JSON object which you can save where you wish.
For example, you can embed it in your saved pages or in the user's working area.

## Hide save/load layout buttons

You can disable the [`header_saveload`] featureset to hide the built-in *Save layout* and *Load layout* buttons from the header toolbar.

[`activeChart`]: https://charting-library-docs.xstaging.tv/latest/configuration/widget-methods.md#activechart
[API handlers]: https://charting-library-docs.xstaging.tv/latest/saving_loading/save-load-adapter.md
[`applyStudyTemplate`]: https://charting-library-docs.xstaging.tv/latest/api/interfaces/Charting_Library.IChartWidgetApi#applystudytemplate
[`chart`]: https://charting-library-docs.xstaging.tv/latest/configuration/widget-methods.md#chart
[chart layouts]: https://charting-library-docs.xstaging.tv/latest/saving_loading.md#chart-layouts
[chart templates]: https://charting-library-docs.xstaging.tv/latest/saving_loading.md#chart-templates
[`createStudyTemplate`]: https://charting-library-docs.xstaging.tv/latest/api/interfaces/Charting_Library.IChartWidgetApi#createstudytemplate
[`header_saveload`]: https://charting-library-docs.xstaging.tv/latest/customization/Featuresets.md#header_saveload
[`IChartingLibraryWidget`]: https://charting-library-docs.xstaging.tv/latest/api/interfaces/Charting_Library.IChartingLibraryWidget
[indicator templates]: https://charting-library-docs.xstaging.tv/latest/saving_loading.md#indicator-templates
[`load`]: https://charting-library-docs.xstaging.tv/latest/api/interfaces/Charting_Library.IChartingLibraryWidget#load
[`save`]: https://charting-library-docs.xstaging.tv/latest/api/interfaces/Charting_Library.IChartingLibraryWidget#save

---

## Sitemap

- [All documentation pages](https://charting-library-docs.xstaging.tv/llms.txt)
- [Full page map with headings](https://charting-library-docs.xstaging.tv/docs_map.md)
