# Changing topic status via api to pinned-global does not work

**URL:** <https://meta.discourse.org/t/changing-topic-status-via-api-to-pinned-global-does-not-work/133705>\
**Category:** Bug\
**Created:** [November 18, 2019, 4:43pm UTC](https://meta.discourse.org/t/changing-topic-status-via-api-to-pinned-global-does-not-work/133705 "2019-11-18T16:43:59Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![marcozambi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marcozambi/32/119505_2.png) [@marcozambi](https://meta.discourse.org/u/marcozambi)\
**Post date:** [November 18, 2019, 4:43pm UTC](https://meta.discourse.org/t/changing-topic-status-via-api-to-pinned-global-does-not-work/133705/1 "2019-11-18T16:43:59Z")

</div>

I’m working on a python script that uses discourse API to set the status of a post to ‘ **pinned-globally** ’, following [the API documentation](https://docs.discourse.org/#tag/Topics/paths/~1t~1%7Bid%7D~1status/put).

The request for ‘pinned-globally’ fails with return code 400, whereas the request with status parameter set to ‘ **pinned** ’ works perfectly (i.e. I can see the post locally pinned).  
This is the snippet of my code:

```plaintext
apiWebsite = '<my_website_URL>'
apiKey = '<secret>'
apiUsername = '<secret>'

headers = {
    'Api-Key': apiKey,
    'Api-Username': apiUsername
}

# This request works OK
# Pin the same post locally
payload = {
    'status': 'pinned',
    'enabled': 'true',
    'until': '2019-11-25T08:00:00'
}
u = requests.put(apiWebsite + '/t/29082/status', headers=headers, data=payload)
print(u.status_code)

```

After having set the pinned status back to false, I try to pin it globally like this.

```plaintext
# This request DOES NOT WORK
# Pin the same topic globally
payload = {
    'status': 'pinned-globally',
    'enabled': 'true',
    'until': '2019-11-25T08:00:00'
}
u = requests.put(apiWebsite + '/t/29082/status', headers=headers, data=payload)
print(u.status_code)

```

Am I missing something obvious or is it a genuine bug?

P.S. The user has sufficient privileges.

---

_[View the full topic](https://meta.discourse.org/t/changing-topic-status-via-api-to-pinned-global-does-not-work/133705)._
