# Is het mogelijk om de tijdstempel van een onderwerp te wijzigen?

**URL:** https://meta.discourse.org/t/possible-to-change-a-topics-timestamp/329509
**Category:** Support
**Created:** [5 oktober 2024 om 23:42 UTC](https://meta.discourse.org/t/possible-to-change-a-topics-timestamp/329509 "2024-10-05T23:42:18Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![fbpbdmin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fbpbdmin/32/300893_2.png) [@fbpbdmin](https://meta.discourse.org/u/fbpbdmin)
#### Post date: [5 oktober 2024 om 23:42 UTC](https://meta.discourse.org/t/possible-to-change-a-topics-timestamp/329509/1 "2024-10-05T23:42:18Z")

</div>

I’d like to change a topic’s time stamp, found this API

> **[Discourse API Docs](https://docs.discourse.org/#tag/Topics/operation/updateTopicTimestamp)**

while, it got an error with “Bad CSRF”, could someone give a hint ? thanks

```plaintext
import requests

# incorrect headers
headers = {
    "Authorization": f"Apikey {api_key}",
    "User-Agent": api_username
}

# correct
headers = {"Content-Type": "application/json; charset=utf-8", "Api-Key": api_key, "Api-Username": api_username }

# Modify the post date
created_at = "1701417600"
update_data = {"timestamp": created_at}
response = requests.put(f"https://www.mysite.com/t/6532/change-timestamp.json", json=update_data, headers=headers)

print(response.status_code) # 403
print(response.text) # '["BAD CSRF"]'
print(response.json()) # ['BAD CSRF']

```

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [6 oktober 2024 om 03:19 UTC](https://meta.discourse.org/t/possible-to-change-a-topics-timestamp/329509/2 "2024-10-06T03:19:13Z")

</div>

> [@fbpbdmin](#):
>
> ```plaintext
> headers = {
> "Authorization": f"Apikey {api_key}",
> "User-Agent": api_username
> }
> 
> ```

Those aren’t the right headers:

 ![This image shows a computer screen displaying text, specifically a list of API keys and some API requests with corresponding HTTP verb and URL. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/c/9/8/c98f7482b6c7d1518fb242731350653c549faca1.png)

> Once you have your API Key you can pass it in along with your API Username as an HTTP header like this:
> 
> ```bash
> curl -X GET "http://127.0.0.1:3000/admin/users/list/active.json" \
> -H "Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \
> -H "Api-Username: system"
> 
> ```
> 
> and this is how POST requests will look:
> 
> ```bash
> curl -X POST "http://127.0.0.1:3000/categories" \
> -H "Content-Type: multipart/form-data;" \
> -H "Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \
> -H "Api-Username: system" \
> -F "name=89853c20-4409-e91a-a8ea-f6cdff96aaaa" \
> -F "color=49d9e9" \
> -F "text_color=f0fcfd"
> 
> ```

---

<div class="post-metadata">

### Author: ![fbpbdmin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fbpbdmin/32/300893_2.png) [@fbpbdmin](https://meta.discourse.org/u/fbpbdmin)
#### Post date: [6 oktober 2024 om 11:47 UTC](https://meta.discourse.org/t/possible-to-change-a-topics-timestamp/329509/3 "2024-10-06T11:47:57Z")

</div>

thanks @Firepup650  
my bad, yes, that is incorrect headers, posted the correct one above, it works.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [5 november 2024 om 11:48 UTC](https://meta.discourse.org/t/possible-to-change-a-topics-timestamp/329509/4 "2024-11-05T11:48:34Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
