How to upload image using Discourse API

The parameter for file needs to be called files[]. See this response for an example using Postman: