LINE error 413: Payload Too Large (request over 2MB)
Last verified against LINE Developers - Messaging API reference (error responses)
Request exceeds the max size of 2MB. Make the request smaller than 2MB and try again.What error 413 means
The status codes table is unusually prescriptive here: "Request exceeds the max size of 2MB. Make the request smaller than 2MB and try again." Two megabytes is the ceiling for the request you POST to the Messaging API, and it's evaluated on the wire - the serialized bytes, headers aside - not on your in-memory object model. Anything can push you over: a huge multicast to array, a Flex carousel stuffed with base64-looking data URIs, thousands of user IDs in an audience JSON body, or an oversized rich menu image upload.
The important mental model: LINE's message architecture is reference-based, not payload-based. Images, video, and audio are never embedded in the request - message objects carry HTTPS URLs (originalContentUrl up to 2,000 characters) and LINE's clients fetch the media, with the size limits living on the hosted files (10 MB images, 200 MB video/audio; see media limits). So a correctly built send request is small: five message objects with URLs, some text under its own character caps, quick replies, and structure. Requests that approach 2 MB almost always mean content that should have been hosted got inlined, or a bulk operation should have been split.
Structured caps also kick in long before 2 MB for specific objects - a Flex bubble is capped at 30 KB of JSON and a carousel at 50 KB, enforced as validation errors rather than 413. When you do hit 413, the request was rejected whole: nothing sent, nothing charged, and the same payload will fail deterministically until it shrinks.
For genuinely large inputs LINE gives dedicated paths: audience creation by file upload accepts up to 1,500,000 user IDs (versus 10,000 by JSON), and the data endpoints live on api-data.line.me, the domain the docs describe as "for sending and receiving large amounts of data." Use the bulk-shaped endpoint instead of inflating a JSON body.
What it looks like
HTTP/1.1 413 Payload Too Large
{
"message": "Request exceeds the max size of 2MB. Make the request smaller than 2MB and try again."
}Why it happens
- Media embedded as data URIs or base64 strings inside message JSON instead of hosted HTTPS URLs.
- An audience JSON body carrying far more user IDs than the 10,000-ID JSON path is meant for.
- A multicast request assembled with a massive recipient list plus five rich message objects, crossing 2MB combined.
- A rich menu image over the upload limit posted to the content endpoint.
- Duplicated or unminified Flex JSON repeated across bubbles, inflating the messages array.
How to fix LINE error 413
- 1Measure the serialized request body size before sending; log byte counts on anything above a few hundred kilobytes.
- 2Host media on your own HTTPS (TLS 1.2+) storage and reference it via originalContentUrl / previewImageUrl - never inline file bytes into message JSON.
- 3Split bulk sends: multicast accepts up to 500 user IDs per request, so chunk recipient lists and iterate.
- 4For audiences beyond 10,000 IDs, switch to the create-by-file endpoint (up to 1,500,000 IDs) on api-data.line.me.
- 5Deduplicate and minify Flex JSON, and check the per-container caps (30 KB bubble / 50 KB carousel) which bite earlier than 2MB.
How to stop it recurring
Enforce a soft byte budget in your sending layer - warn at 1 MB, block at 1.8 MB - and make hosting-then-referencing the only code path for media. Chunk every bulk operation at its documented cap (500 multicast recipients, 10,000 JSON audience IDs) rather than at 2 MB, and reserve the file-based endpoints for real bulk data. The request-size ceiling then becomes unreachable by construction; see sending caps.
Official reference: LINE Developers - Messaging API reference (error responses). See all LINE error codes or the LINE limits and quotas.
Related codes
Error 413 - quick answers
What does LINE error 413 mean?
The status codes table is unusually prescriptive here: "Request exceeds the max size of 2MB. Make the request smaller than 2MB and try again." Two megabytes is the ceiling for the request you POST to the Messaging API, and it's evaluated on the wire - the serialized bytes, headers aside - not on your in-memory object model.
How do I fix LINE error 413?
1. Measure the serialized request body size before sending; log byte counts on anything above a few hundred kilobytes. 2. Host media on your own HTTPS (TLS 1.2+) storage and reference it via originalContentUrl / previewImageUrl - never inline file bytes into message JSON. 3. Split bulk sends: multicast accepts up to 500 user IDs per request, so chunk recipient lists and iterate. 4. For audiences beyond 10,000 IDs, switch to the create-by-file endpoint (up to 1,500,000 IDs)…
Should I retry after error 413?
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 LINE by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.