# Controlling Theme Components via API?

**URL:** https://meta.discourse.org/t/controlling-theme-components-via-api/256511
**Category:** Development
**Created:** [February 28, 2023, 4:16pm UTC](https://meta.discourse.org/t/controlling-theme-components-via-api/256511 "2023-02-28T16:16:05Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [March 1, 2023, 11:50pm UTC](https://meta.discourse.org/t/controlling-theme-components-via-api/256511/5 "2023-03-01T23:50:02Z")

</div>

> [@merefield](#):
>
> There’s no concept of “enabling” or “disabling” a Theme Component

The concept exists and the buttons are called “Enable” and “Disable” in Discourse’s interface 🙂

![image](https://global.discourse-cdn.com/meta/original/4X/f/2/a/f2a4cc6dfb971beedfe1d706021825f7c46dbbea.png)

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/d/3/dd39b91186d25af5fe49864e940e4cc9e8446bbe.png)

And it can be done through the API, of course:

> [@Set Theme Dynamically](https://meta.discourse.org/t/set-theme-dynamically/250719/3):
>
> Sorry for the long wait. Busy day technologist So, you can indeed enable or disable a theme or a component with a simple API request. You’ll have to create an API key with the right credentials and assign an admin user to it. in your Discourse: admin panel → API → + New API Key in the script you’ll use, as mentioned, do a PUT request on https://yourdiscourse.com/admin/themes/[id\_theme] with the proper headers (see the authentication part on [https://docs.discourse.org/](https://docs.discourse.org/)) and a JSON body …

I’m talking about both themes AND components in my post but apparently it’s a bit different for themes, so I should fix my solution.

---

_[View the full topic](https://meta.discourse.org/t/controlling-theme-components-via-api/256511)._
