# Managing site customization via API

**URL:** https://meta.discourse.org/t/managing-site-customization-via-api/59431
**Category:** Development
**Created:** [March 18, 2017, 6:19pm UTC](https://meta.discourse.org/t/managing-site-customization-via-api/59431 "2017-03-18T18:19:04Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![iamntz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamntz/32/114670_2.png) [@iamntz](https://meta.discourse.org/u/iamntz)
#### Post date: [March 18, 2017, 6:19pm UTC](https://meta.discourse.org/t/managing-site-customization-via-api/59431/1 "2017-03-18T18:19:04Z")

</div>

Hey guys, I was wondering if there is a way of managing CSS/HTML customization via API. This means to fetch/update items here: `admin/customize/css_html/`

I’ve read [this](https://meta.discourse.org/t/discourse-api-documentation/22706) and didn’t had too much luck:

- `GET`ting this in POSTMAN `{{base_url}}/admin/site_customizations/22?api_key={{api_key}}&api_username={{api_username}}` returns nothing;
- `GET`ting this in POSTMAN `{{base_url}}/admin/site_customizations/` will return `Oops! That page doesn’t exist or is private.`

Thanks!

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 19, 2017, 2:46pm UTC](https://meta.discourse.org/t/managing-site-customization-via-api/59431/2 "2017-03-19T14:46:46Z")

</div>

Are you using the system api key?

---

<div class="post-metadata">

### Author: ![iamntz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamntz/32/114670_2.png) [@iamntz](https://meta.discourse.org/u/iamntz)
#### Post date: [March 19, 2017, 2:54pm UTC](https://meta.discourse.org/t/managing-site-customization-via-api/59431/3 "2017-03-19T14:54:48Z")

</div>

Yeah, i did, but now i tried with an (admin) user API key and still not working.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 20, 2017, 1:54pm UTC](https://meta.discourse.org/t/managing-site-customization-via-api/59431/4 "2017-03-20T13:54:31Z")

</div>

devtools says this is working:

![](https://global.discourse-cdn.com/meta/optimized/3X/4/1/41a355bc5a45903e24eddc6e495032ab1d168ecb_2_690x48.png)

```plaintext
curl 'https://meta.discourse.org/admin/site_customizations'

```

My guess is you have issues with your api keys or something.

---

<div class="post-metadata">

### Author: ![iamntz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamntz/32/114670_2.png) [@iamntz](https://meta.discourse.org/u/iamntz)
#### Post date: [March 20, 2017, 3:23pm UTC](https://meta.discourse.org/t/managing-site-customization-via-api/59431/5 "2017-03-20T15:23:14Z")

</div>

I feel dumb today 😃 Can you please give me a full curl sample?

My Postman cURL looks like this

```plaintext
curl -X GET 
-H "Cache-Control: no-cache" -H "Postman-Token: xxx" 
"https://my-site/admin/site_customizations/?api_key=my-api-taken-from-my-user-admin-page&api_username=my-username"

```

And the response looks like this:

 ![](https://global.discourse-cdn.com/meta/original/3X/6/6/6627f5db914e7b47615fa80ec0be10bf818ab993.jpg)

(The username has administrator rights)

* * *

If i use postman to make a request that requires auth, it works:

```plaintext
{{base_url}}/admin/users/list/suspended.json?api_key={{api_key}}&api_username={{api_username}}

```

Works just fine.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 20, 2017, 4:29pm UTC](https://meta.discourse.org/t/managing-site-customization-via-api/59431/6 "2017-03-20T16:29:24Z")

</div>

My guess is that the controller is checking for XHR, maybe try adding:

`x-requested-with:XMLHttpRequest`

---

<div class="post-metadata">

### Author: ![iamntz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamntz/32/114670_2.png) [@iamntz](https://meta.discourse.org/u/iamntz)
#### Post date: [March 20, 2017, 4:47pm UTC](https://meta.discourse.org/t/managing-site-customization-via-api/59431/7 "2017-03-20T16:47:17Z")

</div>

That was it! Thanks! (mark as solved? :D)
