# Set Theme Dynamically

**URL:** https://meta.discourse.org/t/set-theme-dynamically/250719
**Category:** Development
**Created:** [January 4, 2023, 3:51pm UTC](https://meta.discourse.org/t/set-theme-dynamically/250719 "2023-01-04T15:51:53Z")
**Posts on this page:** 1
**Showing post:** 3

<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: [January 5, 2023, 9:38pm UTC](https://meta.discourse.org/t/set-theme-dynamically/250719/3 "2023-01-05T21:38:42Z")

</div>

Sorry for the long wait. Busy day 🧑‍💻

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 such as:

This will disable the chosen theme/component. Video example with Insomnia:

---

_[View the full topic](https://meta.discourse.org/t/set-theme-dynamically/250719)._
