Can't verify CSRF token authenticity while creating topics

My curl looks as follows:

curl -X POST 'https://example.com/posts' \
-H "Content-Type: multipart/form-data;" \
--form 'Api-Key="redacted"' \
--form 'Api-Username="redacted"' \
--form 'title="Test topic"' \
--form 'raw="Hey this is a topic."'

I get a [“BAD CSRF”] reply and the production logs say Can’t verify CSRF token authenticity. I checked this topic https://meta.discourse.org/t/bad-csrf-on-creating-new-topic-via-api/89345 but it is basically caused by a typo so I guess there is something different here. I double checked the api-key and the username and they are still active on the website. I would appreciate any suggestions that you may have. Thanks!

Hi, Your Curl request is giving 403 BAD CSRF error because Api-Key and Api-Username are not passed in the header along with Content-Type. Do this change and it will work.

Thanks
GT