Error 403 when i try to do a POST Request

I’m trying to make a POST request to pause synching, but when I run it return me 403 error code

this is the code

import requests

data = {"X-API-Key": "key"}

url = "http://localhost:8384/rest/system/pause"

response = requests.post("http://localhost:8384/rest/system/pause", data)

print(response)

It looks like you’re sending the API key as body data, while it should be a header.

1 Like

sorry for the ignorance, concretely how can I do that? s

You should refer to the documentation of the library you are using, as the question has nothing todo with syncthing, but usage of the library.

requests has been deprecated for a while and shouldn’t be used anymore. None the less: docs

Never mind, looked like node.js to me (after a quick look)

This looks like python, and I don’t think that is deprecated.

No, but request (without the ending s) has been deprecated. OP wrote requests though.