# Plugin Data API

No matter how many customizations we add to plugins, there will always be good reasons to add more. Instead of cluttering our interface, TRMNL offers a "data only" mode.

{% hint style="info" %}
For more context on this feature, go [here](https://trmnl.com/blog/calendar-hackathon). For live examples, [go here](https://trmnl.com/blog/introducing-data-mode).
{% endhint %}

### Looking for the old way?

[Go here](https://github.com/usetrmnl/api-docs/blob/4ce6efd395d26bfecc4d7e271ed758ebaa02283b/private-api/fetch-plugin-content.md) to set up a Data Mode plugin the ~~old~~ hard way.

### How it works

First, set up + hide an instance of the plugin you want to modify.

1. Connect a plugin, for example the Weather, Stock Prices, Calendar, etc
2. Navigate to Playlists and "hide" the plugin (click the eyeball icon), assuming you don't want to see its native form on your device. **This is important** because only plugins on a Playlist will sync fresh data.

Next, build a Private Plugin.

1. Navigate to Plugins > Private Plugin, select "Plugin Merge" as the Strategy
2. Click Edit Markup

<figure><img src="https://1607647240-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXhDs1PQJ2VX7ppA91eY%2Fuploads%2Fgit-blob-87032648dd9510753e89d4d056ea5218388358c8%2Ftrmnl-data-mode-edit-markup.png?alt=media" alt=""><figcaption><p>Private Plugin > Edit Markup</p></figcaption></figure>

Parsed data will appear inside a `<plugin_keyname>_<plugin_setting_id>` node of the "Merge Variables" dropdown. You may need to click "Force Refresh" from the private plugin settings view to ensure data has been fetched.

<figure><img src="https://1607647240-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnXhDs1PQJ2VX7ppA91eY%2Fuploads%2Fgit-blob-fd99757164d53d105e525762acd124b034a9ef36%2FTRMNL-data-mode-example-node.png?alt=media" alt=""><figcaption><p>Example - Outlook Calendar events JSON</p></figcaption></figure>

Reference as many connected plugins as you'd like. When TRMNL refreshes those plugins per your [Playlist Schedule](https://help.trmnl.com/en/articles/11663305-playlist-scheduler), updated values will map over to your private plugin with the Plugin Merge strategy.

### Markup Quickstart

If you only want to make small changes to the TRMNL native design, steal that markup here:

* <https://github.com/usetrmnl/plugins/> (raw inside `lib`, let us know what else you need)
* <https://trmnl.com/plugins/demo> (rendered output, requires login)

In the raw/GitHub option, note that native plugins leverage the ERB templating language, so markup `<% variable %>` references will need to be replaced with Liquid `{{ variable }}` and so forth.

In the `/demo` option, click the plugin you're rebuilding and all layouts will appear with sample data. If you've connected a plugin natively, your latest cached JSON will be embedded instead of demo data.

Another tip on the `/demo` option is to add `?data=true` to the URL, for example `https://trmnl.com/plugins/google_calendar?data=true` to see how TRMNL combines your own JSON data with our native ERB markup. If you have multiple instances that you'd like to check out, also append `&plugin_setting_id=<id-here>` to render a specific plugin instance on the demo page.


---

# 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://docs.trmnl.com/go/private-api/plugin-data.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.
