Remote file tagging problem (CSRF check failed)


I would like to tag my files remotely after they were uploaded to the server by means of a curl script. The upload works like a charm. Only when I try to set the tag with

curl -H “Content-Type: application/json” -X POST -d “{ ‘tags’ : [ ‘xxx’ ] }” http://localhost:4080/nextcloud/index.php/apps/files/api/v1/files/user/test/test.pdf -u user:pw

I get the following error message:

{“message”:“CSRF check failed”}%

I suppose the requesttoken is responsible for this problem, but even when I am setting it, I get the same error message. Would you have a tip for me what went wrong. What would be the right way to set a proper requesttoken (with curl) in the first place?

Thank you very much for your help and kind regards,



I have now implemented a small tagging microservice in python which I’d like to share with you: