You do not have the appropriate permissions

Trying to upload a file to a channel but gets:

{“id”:“api.context.permissions.app_error”,“message”:“You do not have the appropriate permissions.”,“detailed_error”:"",“request_id”:“9okgg18rkjnn3gc3o79cocpehc”,“status_code”:40

I am clearly missing something but can’t figure out what it is?

The call is this:

curl -s --location --request POST ‘’ --header ‘Authorization: Bearer yyyyyyyyy’ --header ‘Content-Type: multipart/form-data’ --form files=@test.txt

The test.txt are just a small test file.

Where xxxxx is the channel_id for town square and yyyy is the token from a newly created BOT.

Thanks and best

1 Like

I have the same problem :frowning:

Hi everbody,

this message usually appears when the bot is not a member of the team. I could reproduce that in my demo environment here, when you create a bot account using the Integrations page, the bot account will not be added to any team and then this message appears. As soon as you add it to the team this town-square channel belongs to, the file can be attached without any further issues.

To add the bot account to the team, either use the command line:

/opt/mattermost/bin/mmctl --local team users add your-team-name name-of-the-bot-account

or the GUI by using the invite option in the team dropdown.