Slack error invalid_post_type: Unsupported Content-Type on POST
Last verified against Slack API reference - chat.postMessage errors
The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.What error invalid_post_type means
The Content-Type on your POST is not one Slack's Web API accepts. The docs list exactly four valid types: application/json, application/x-www-form-urlencoded, multipart/form-data and text/plain. Anything else, such as application/xml, application/octet-stream or a vendor type like application/vnd.api+json, fails here.
This differs from missing_post_type (no header at all) and invalid_charset (right type, wrong charset parameter). It shows up most in generic HTTP connectors, low-code tools and webhook relays that default to a binary or custom media type, and in file upload code that sends raw bytes to a Web API method instead of to the upload URL returned by files.getUploadURLExternal.
Nothing about your arguments has been evaluated yet. Correct the header and resend the same body; no other change is needed.
What it looks like
POST /api/chat.postMessage
Content-type: application/octet-stream
{"ok": false, "error": "invalid_post_type"}Why it happens
- A generic HTTP connector defaulted to application/octet-stream or another unsupported type.
- A vendor or XML media type was carried over from another API's configuration.
- File bytes were posted to a Web API method rather than to the upload_url from files.getUploadURLExternal.
- A typo in the header value (application/jsn, application/x-www-form-urlencode).
How to fix Slack error invalid_post_type
- 1Print the outgoing Content-Type header as the server receives it.
- 2Set it to application/json for JSON bodies, or application/x-www-form-urlencoded for key=value bodies.
- 3For uploads, call files.getUploadURLExternal, POST the bytes to the returned upload_url, then call files.completeUploadExternal.
- 4In low-code tools, switch the request body mode to JSON so the header is set correctly.
How to stop it recurring
Route all Slack calls through a client that fixes the Content-Type per method instead of inheriting connector defaults. When integrating through a no-code platform, test one call per action type during setup, because each action may carry its own body mode and header settings.
Official reference: Slack API reference - chat.postMessage errors. See all Slack error codes or the Slack limits and quotas.
Related codes
- missing_post_type: POST body sent without a Content-Type headerThe method was called via a POST request and included a data payload, but the…
- invalid_charset: Invalid charset in Content-Type headerThe method was called via a POST request, but the charset specified in the…
- invalid_form_data: Form data missing or syntactically invalidThe method was called via a POST request with Content-Type…
- file_upload_size_restricted: File too large for workspace upload policyThe size of provided file is too large, as the team has restricted uploads of…
Error invalid_post_type - quick answers
What does Slack error invalid_post_type mean?
The Content-Type on your POST is not one Slack's Web API accepts. The docs list exactly four valid types: application/json , application/x-www-form-urlencoded , multipart/form-data and text/plain . Anything else, such as application/xml , application/octet-stream or a vendor type like application/vnd.api+json , fails here.
How do I fix Slack error invalid_post_type?
1. Print the outgoing Content-Type header as the server receives it. 2. Set it to application/json for JSON bodies, or application/x-www-form-urlencoded for key=value bodies. 3. For uploads, call files.getUploadURLExternal, POST the bytes to the returned upload_url, then call files.completeUploadExternal. 4. In low-code tools, switch the request body mode to JSON so the header is set correctly.
Should I retry after error invalid_post_type?
No. Retrying the same request produces the same error; the condition has to be fixed first. Treat it as a permanent failure for that message and surface it, rather than looping.
Stop debugging Slack by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.