LINE Messaging API · error code

LINE error 400: Invalid markAsReadToken

Permanent - do not retryHTTP 400400 / 409 / 413: request body, tokens and payload

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

What LINE returns
Invalid markAsReadToken. Tokens must be used by the bot that received them via Webhook.

What error 400 means

The mark-as-read endpoint (POST /v2/bot/chat/markAsRead) rejected the value you passed in markAsReadToken. The error table has a single row, "An invalid read token has been specified," and the message itself gives the rule: tokens must be used by the bot that received them via webhook.

The read token arrives in the markAsReadToken property of a message event's message object. The Mark messages as read guide states that "Read tokens have no expiration date," so unlike a reply token, age isn't the problem. What breaks is provenance: a token from another channel, a token pulled from a different field (people confuse it with the quoteToken or the reply token that sit nearby in the same event), or a value that got truncated on the way to storage.

One related behavior is not an error at all. Marking messages as read through the API only makes sense when Chat is turned on in the LINE Official Account Manager response settings. If Chat is off, LINE marks user messages as read automatically, so your call has nothing visible to do.

What it looks like

// If an invalid read token is specified (400 Bad Request)
{
  "message": "Invalid markAsReadToken. Tokens must be used by the bot that received them via Webhook."
}

Why it happens

  • The token came from a webhook received by a different channel (another bot or another environment).
  • Your code sent the quoteToken or replyToken instead of message.markAsReadToken.
  • The token was truncated or altered when stored in a database or queue.
  • The token was hand-written or reused from documentation examples during testing.

How to fix LINE error 400

  1. 1Log the event's message object and confirm you are reading message.markAsReadToken specifically.
  2. 2Verify the channel access token you call markAsRead with belongs to the same channel that received the webhook.
  3. 3Check the stored token length against the original webhook payload to rule out truncation.
  4. 4Retry the call with a fresh token from a new message event to confirm the integration works end to end.

How to stop it recurring

Store the read token alongside the message ID and the receiving channel ID, and route mark-as-read calls through the same channel's credentials. Because read tokens don't expire, you can mark messages as read later (for example when a human agent opens the conversation), but only with the bot that received them. Turn on Chat in LINE Official Account Manager if you want read status to stay under your control.

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 mark-as-read endpoint ( POST /v2/bot/chat/markAsRead ) rejected the value you passed in markAsReadToken . The error table has a single row, "An invalid read token has been specified," and the message itself gives the rule: tokens must be used by the bot that received them via webhook. The read token arrives in the markAsReadToken property of a message event's message object.

How do I fix LINE error 400?

1. Log the event's message object and confirm you are reading message.markAsReadToken specifically. 2. Verify the channel access token you call markAsRead with belongs to the same channel that received the webhook. 3. Check the stored token length against the original webhook payload to rule out truncation. 4. Retry the call with a fresh token from a new message event to confirm the integration works end to end.

Should I retry after error 400?

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.