# Unlist a topic via an API request

**URL:** https://meta.discourse.org/t/unlist-a-topic-via-an-api-request/94308
**Category:** Development
**Tags:** unlisting
**Created:** [August 9, 2018, 1:08pm UTC](https://meta.discourse.org/t/unlist-a-topic-via-an-api-request/94308 "2018-08-09T13:08:31Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![julienrusso](https://avatars.discourse-cdn.com/v4/letter/j/ea666f/32.png) [@julienrusso](https://meta.discourse.org/u/julienrusso)
#### Post date: [August 9, 2018, 1:08pm UTC](https://meta.discourse.org/t/unlist-a-topic-via-an-api-request/94308/1 "2018-08-09T13:08:31Z")

</div>

Hello, I have a question. I try to unlist a topic from a category using the API.

When I try to call this request:

```
{{base_url}}/t/my-super-topic/12/status?api_key={{api_key}}&api_username={{api_username}}

```

using a PUT request with the following form-data params:

```
status: visible, enabled: false

```

I got a 400 - Bad request error.

This is exactly the same request applied when I unlist the topic via the web interface.  
Is there any issue with the API call ?

Thanks !

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [August 9, 2018, 6:51pm UTC](https://meta.discourse.org/t/unlist-a-topic-via-an-api-request/94308/2 "2018-08-09T18:51:52Z")

</div>

Are you able to get any other PUT/POST requests to work on other endpoints? Possibly the content-type is not set to “multipart/form-data”?

I was able to get it to work with this curl request:

```plaintext
curl -X PUT "https://url/t/topic-title/17/status" \
-H "Content-Type: multipart/form-data;" \
-F "api_key=apikey" \
-F "api_username=username" \
-F "status=visible" \
-F "enabled=false"

```

---

<div class="post-metadata">

### Author: ![julienrusso](https://avatars.discourse-cdn.com/v4/letter/j/ea666f/32.png) [@julienrusso](https://meta.discourse.org/u/julienrusso)
#### Post date: [August 10, 2018, 7:43am UTC](https://meta.discourse.org/t/unlist-a-topic-via-an-api-request/94308/3 "2018-08-10T07:43:39Z")

</div>

Hello Blake and thank you for your answer.  
Yes, others queries work perfectly.  
To test the queries, I use postman and then I use a PHP API with curl.  
As this one didn’t work in postman, I didn’t try with curl, but if you tell me it works fine, I think the issue is fixed 🙂

I’m gonna try by myself and I’ll tell you if it’s okay.  
Thanks again !

---

<div class="post-metadata">

### Author: ![julienrusso](https://avatars.discourse-cdn.com/v4/letter/j/ea666f/32.png) [@julienrusso](https://meta.discourse.org/u/julienrusso)
#### Post date: [August 10, 2018, 12:24pm UTC](https://meta.discourse.org/t/unlist-a-topic-via-an-api-request/94308/4 "2018-08-10T12:24:10Z")

</div>

Hello Blake, it worked perfectly with curl, thanks you very much for you help !
