LINE Messaging API · error code

LINE error 400: The content type, XXX, is not supported

ConfigurationHTTP 400400 / 409 / 413: request body, tokens and payload

Last verified against LINE Developers - Messaging API reference (error responses)

What LINE returns
The content type, XXX, is not supported <detail varies>

What error 400 means

The reference documents this message as: "A content type not supported by the API is requested." The XXX is replaced with the Content-Type header value you actually sent. Messaging API endpoints that accept a JSON body list Content-Type: application/json as a required request header; send text/plain, application/x-www-form-urlencoded, or nothing at all, and LINE refuses to interpret the body and answers with this 400 before any validation happens.

The most common sources are HTTP clients with surprising defaults. Some libraries default POST bodies to form encoding unless you use their JSON-specific parameter (classic example: passing data= instead of json= in Python requests). Proxies and API gateways occasionally strip or rewrite the header. And a handful of LINE endpoints legitimately want something else - uploading a rich menu image posts the raw bytes with an image content type to api-data.line.me, and the OAuth-style token endpoints take application/x-www-form-urlencoded - so copying headers between endpoint families breaks in both directions.

A related but distinct failure is 415 Unsupported Media Type, which the status table reserves for uploads where the file's media type is unsupported. This 400 is about the request header on JSON endpoints; the 415 is about the file you tried to upload.

What it looks like

{
  "message": "The content type, text/plain, is not supported"
}

Why it happens

  • The HTTP client defaulted to application/x-www-form-urlencoded or multipart because the body was passed as form data instead of JSON.
  • The Content-Type header was omitted entirely, or spelled with a wrong value like text/json.
  • Headers copied from a different endpoint family - e.g. the form-encoded token endpoints - onto a JSON messaging endpoint, or vice versa.
  • A proxy, gateway, or serverless wrapper rewrote or dropped the header in transit.
  • A charset or boundary suffix produced a value the endpoint doesn't accept.

How to fix LINE error 400

  1. 1Print the literal header from the error message - the XXX tells you exactly what LINE received.
  2. 2Set Content-Type: application/json explicitly on every JSON endpoint call; don't rely on client defaults.
  3. 3Use your client's JSON body parameter (json= in requests, res.json in fetch wrappers) so serialization and header stay in sync.
  4. 4For rich menu image upload, send the raw image bytes with image/jpeg or image/png to api-data.line.me - not JSON, and not multipart.
  5. 5Capture the outbound request with a local proxy to confirm nothing between your code and api.line.me rewrites the header.

How to stop it recurring

Centralize LINE calls in one client that hardcodes the right header per endpoint family: JSON for messaging and settings endpoints, raw image bytes for rich menu upload, form encoding for the token endpoints. The official SDKs already encode these differences, which is the simplest way to never see this error (the upload specs live at rich menu limits). Add a contract test that asserts the header on every outbound request template.

Official reference: LINE Developers - Messaging API reference (error responses). See all LINE error codes or the LINE limits and quotas.

Related codes

Error 400 - quick answers

What does LINE error 400 mean?

The reference documents this message as: "A content type not supported by the API is requested." The XXX is replaced with the Content-Type header value you actually sent.

How do I fix LINE error 400?

1. Print the literal header from the error message - the XXX tells you exactly what LINE received. 2. Set Content-Type: application/json explicitly on every JSON endpoint call; don't rely on client defaults. 3. Use your client's JSON body parameter (json= in requests, res.json in fetch wrappers) so serialization and header stay in sync. 4. For rich menu image upload, send the raw image bytes with image/jpeg or image/png to api-data.line.me - not JSON, and not multipart. 5.…

Stop debugging LINE by hand

Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.