Expose Tokens to pluggins

Hello there,

I am developing a plugin, and I need access to the design tokens present in the design file the plugin will be editing, please.

1 Like

Hello @lmtr0!

Sorry for the delay, but the plugin API freshly reads and edits tokens.
Here is the documentation: TokenCatalog | Penpot plugins API
You must mind to update the plugin types to avoid any TypeScript error if you are coding with it.

Hi,
until which version are the Token API available?

The Token API is available since the 2.14 version if I refer to the release note.

1 Like

Confirming the Plugin API for tokens works well in Penpot 2.14.4 (self-hosted Docker). The penpot.tokens API is straightforward for reading and writing token sets from a plugin.

Worth adding for anyone landing here from a search: the REST API also handles tokens in 2.14.4 — no plugin or browser session required. The working change types for update-file are set-token-set and set-token (upsert semantics). This is useful for headless automation and CI pipelines where you want to push token updates from scripts without a browser open.

Note: older API references show add-token/mod-token/del-token change types — those are from an older API version and do not work in 2.14.4. The current types use set-* naming.

1 Like