# Messaging API reference

# Common specifications

# Rate limits

The Messaging API applies the following rate limits for each endpoint. Rate limits depend on your plan and endpoint.

Note

If you continue to send requests exceeding the rate limit for an extended period of time, we may block incoming requests.

# For bots associated with LINE official accounts

Endpoint Rate limit
Send a multicast message 100,000 requests per minute
1,700 requests per second*
2,000,000 recipients per minute
Send a narrowcast message
Send a broadcast message
Get number of sent messages
Get number of friends
Get friend demographics
60 requests per hour
Other API endpoints 100,000 requests per minute
1,700 requests per second*

*The rate limit in seconds is a guideline for mass transmission.

# For bots associated with LINE@ accounts

Endpoint Rate limit
Send a multicast message 10,000 requests per minute
170 requests per second*
200,000 recipients per minute
Other API endpoints 10,000 requests per minute
170 requests per second*

*The rate limit in seconds is a guideline for mass transmission.

# Status codes

The following status codes are returned by the Messaging API.

Status code Description
200 OK Request successful
400 Bad Request Problem with the request
401 Unauthorized Valid channel access token is not specified
403 Forbidden Not authorized to access the resource. Confirm that your account or plan is authorized to access the resource.
429 Too Many Requests Exceeded the rate limit for API calls
500 Internal Server Error Error on the internal server

# Response headers

The following HTTP headers are included in Messaging API responses.

Response headers Description
X-Line-Request-Id Request ID. A unique ID is generated for each request

# Error responses

The following JSON data is returned in the response body when an error occurs.

message

String

Message containing information about the error. For more details, see Error messages.

details[].message

String

Details of the error. Not returned in certain situations.

details[].property

String

Location of where the error occurred. Not returned in certain situations.

Example error response

# Error messages

The main error messages that are found in the message property of the JSON error responses are shown below.

Message Description
The request body has X error(s) An error was found in the JSON data of the request body. The number of errors is displayed for "X". Further details are shown in the details[].message and details[].property properties.
Invalid reply token An invalid reply token was used in the reply message
The property, XXX, in the request body is invalid (line: XXX, column: XXX) An invalid property was specified in the request body. The specific property is displayed for "XXX".
The request body could not be parsed as JSON (line: XXX, column: XXX) The JSON in the request body could not be parsed. The specific line and column are displayed.
The content type, XXX, is not supported A content type not supported by the API is requested.
Authentication failed due to the following reason: XXX Authentication failed when the API was called. The reason is displayed for "XXX".
Access to this API is not available for your account Appears when calling an API that you do not have permission to use.
Failed to send messages Appears when the message fails to be sent. One reason this may appear is if the user ID specified does not exist.
You have reached your monthly limit. You have exceeded the target limit for additional messages.

# Webhooks

# Introduction

When an event, such as when a user adds your LINE official account or sends a message, is triggered, an HTTPS POST request is sent to the webhook URL that is configured for your channel on the console.

Your bot server then receives and handles the requests.

# Request headers

X-Line-Signature

# Request body

The request body contains a JSON object with the user ID of a bot that should receive webhook events and an array of webhook event objects.

destination

String

User ID of a bot that should receive webhook events. The user ID value is a string that matches the regular expression, U[0-9a-f]{32}.

events

Information about the event

# Response

Your bot server should return the status code 200 for a HTTP POST request sent by a webhook.

# Signature validation

The signature in the X-Line-Signature request header must be verified to confirm that the request was sent from the LINE Platform.

Authentication is performed as follows:

  1. With the channel secret as the secret key, your application retrieves the digest value in the request body created using the HMAC-SHA256 algorithm.
  2. The server confirms that the signature in the request header matches the digest value which is Base64 encoded.

Example of signature validation

# Webhook event objects

JSON objects which contain events generated on the LINE Platform.

Some properties of these event objects might not have any value. Generated event objects don't contain properties without any value.

The structure of these event objects might be changed when the Messaging API feature is updated. Such changes can include adding properties, changing the order of properties, adding or deleting spaces and newlines between data elements, and so on. Implement your server so as not to fail in receiving event objects whose structure has changed in the future.

Example webhook event object

# Common properties

The following properties are found in webhook event objects.

type

String

Identifier for the type of event

mode

String

Channel state.

  • active: The channel is active. You can send a reply message or push message from the bot server that received this webhook event.
  • standby (under development): The channel is waiting. The bot server that received this webhook event shouldn't send any messages.

timestamp

Number

Time of the event in milliseconds

source

Object

Source user, group, or room object with information about the source of the event.

What causes the mode property to change

The mode property's value can change to standby if the channel administrator starts using channel multiplexing (under development). The value of mode never automatically changes to standby.

There is currently no way to multiplex incoming channels.

# Source user

type

String

user

userId

String

ID of the source user

Source user example

# Source group

type

String

group

groupId

String

ID of the source group

userId

String

ID of the source user. Only included in message events. Users of LINE version 7.4.x or earlier are not included in userId. For more information, see User consent.

Source group example

# Source room

type

String

room

roomId

String

ID of the source room

userId

String

ID of the source user. Only included in message events. Users of LINE version 7.4.x or earlier are not included in userId. For more information, see User consent.

Source room example

# Message event

Webhook event object which contains the sent message. The message property contains a message object which corresponds with the message type. You can reply to message events.

type

String

message

replyToken

String

Token for replying to the event

message

Object

Object containing the contents of the message. Message types include:

# Text

Message object which contains the text sent from the source.

id

String

Message ID

type

String

text

text

String

Message text

Text message example

# Image

Message object which contains the image content sent from the source.

id

String

Message ID

type

String

image

contentProvider.type

String

Provider of the image file.

  • line: The image was sent by a LINE user. The binary image data can be retrieved from the content endpoint.
  • external: The image was sent using the LIFF liff.sendMessages() method. For more information, see liff.sendMessages() in the LIFF API reference.

contentProvider.originalContentUrl

String

URL of the image file. Only included when contentProvider.type is external.

contentProvider.previewImageUrl

String

URL of the preview image. Only included when contentProvider.type is external.

Image message example

# Video

Message object which contains the video content sent from the source. The preview image is displayed in the chat and the video is played when the image is tapped.

id

String

Message ID

type

String

video

duration

Number

Length of video file (milliseconds)

contentProvider.type

String

Provider of the video file.

  • line: The video was sent by a LINE user. The binary video data can be retrieved from the content endpoint.
  • external: The video was sent using the LIFF liff.sendMessages() method. For more information, see liff.sendMessages() in the LIFF API reference.

contentProvider.originalContentUrl

String

URL of the video file. Only included when contentProvider.type is external.

contentProvider.previewImageUrl

String

URL of the preview image. Only included when contentProvider.type is external.

Video message example

# Audio

Message object which contains the audio content sent from the source.

id

String

Message ID

type

String

audio

duration

Number

Length of audio file (milliseconds)

contentProvider.type

String

Provider of the audio file.

  • line: The audio file was sent by a LINE user. The binary audio data can be retrieved from the content endpoint.
  • external: The audio file was sent using the LIFF liff.sendMessages() method. For more information, see liff.sendMessages() in the LIFF API reference.

contentProvider.originalContentUrl

String

URL of the audio file. Only included when contentProvider.type is external.

Audio message example

# File

Message object which contains the file sent from the source. The binary data can be retrieved from the content endpoint.

id

String

Message ID

type

String

file

fileName

String

File name

fileSize

Number

File size in bytes

File message example

# Location

Message object which contains the location data sent from the source.

id

String

Message ID

type

String

location

title

String

Title

address

String

Address

latitude

Decimal

Latitude

longitude

Decimal

Longitude

Location message example

# Sticker

Message object which contains the sticker data sent from the source. For a list of basic LINE stickers and sticker IDs, see sticker list.

id

String

Message ID

type

String

sticker

packageId

String

Package ID

stickerId

String

Sticker ID

stickerResourceType

String

Sticker resource type. One of:

  • STATIC: Still image
  • ANIMATION: Animated sticker
  • SOUND: Sticker with sound
  • ANIMATION_SOUND: Animated sticker with sound
  • POPUP: Pop-up sticker
  • POPUP_SOUND: Pop-up sticker with sound
  • NAME_TEXT: Custom sticker
About sticker resource types

In the future, we may add new types without notice. Make sure your implementation can handle both current and future sticker resource types.

Sticker message example

# Follow event

Event object for when your LINE official account is added as a friend (or unblocked). You can reply to follow events.

type

String

follow

replyToken

String

Token for replying to this event

Follow event example

# Unfollow event

Event object for when your LINE official account is blocked.

type

String

unfollow

Unfollow event example

# Join event

Event object for when your LINE official account joins a group or room. You can reply to join events.

A join event is triggered at different times for groups and rooms.

  • For groups: A join event is sent when a user invites your LINE official account.
  • For rooms: A join event is sent when the first event (for example when a user sends a message or is added to the room) occurs after your LINE official account is added.

type

String

join

replyToken

String

Token for replying to this event

Join event example

# Leave event

Event object for when a user removes your LINE official account from a group or when your LINE official account leaves a group or room.

type

String

leave

Leave event example

# Member join event

Event object for when a user joins a group or room that the LINE official account is in.

type

String

memberJoined

joined.members

Array of source user objects

User ID of users who joined

replyToken

String

Token for replying to this event

Member join event example

# Member leave event

Event object for when a user leaves a group or room that the LINE official account is in.

type

String

memberLeft

left.members

Array of source user objects

User ID of users who left

Member leave event example

# Postback event

Event object for when a user performs a postback action which initiates a postback. You can reply to postback events.

type

String

postback

replyToken

String

Token for replying to this event

postback.data

String

Postback data

JSON object with the date and time selected by a user through a datetime picker action.
Only returned for postback actions via a datetime picker action.

Postback event example

# postback.params object

Object with the date and time selected by a user through a datetime picker action. The full-date, time-hour, and time-minute formats follow the RFC3339 protocol.

Property Format Description
date full-date Date selected by user. Only included in the date mode.
time time-hour ":" time-minute Time selected by the user. Only included in the time mode.
datetime full-date "T" time-hour ":" time-minute Date and time selected by the user. Only included in the datetime mode.

postback.params object example

# Beacon event

Event object for when a user enters the range of a LINE Beacon. You can reply to beacon events.

type

String

beacon

replyToken

String

Token for replying to this event

beacon.hwid

String

Hardware ID of the beacon that was detected

beacon.type

String

Type of beacon event. See Beacon event types.

beacon.dm

String

Device message of beacon that was detected. This message consists of data generated by the beacon to send notifications to bot servers. Only included in webhook events from devices that support the "device message" property.
For more information, see the LINE Simple Beacon specification.

Beacon event example

# Beacon event types

beacon.type Description
enter Entered beacon's reception range
leave [Deprecated] Left beacon's reception range.
banner Tapped beacon banner
stay A user is in the beacon's reception range.
This event is sent repeatedly at a minimum of 10 seconds.

If you are interested in using the Beacon Banner feature and stay event, make an inquiry through the LINE for Business website.

Event object for when a user has linked his/her LINE account with a provider's service account. You can reply to account link events.

If the link token has expired or has already been used, no webhook event will be sent and the user will be shown an error.

type

String

accountLink

replyToken

String

Token for replying to this event. This value will not be included if the link has failed.

link

Object

link object. This will include whether the account link was successful or not and a nonce generated from the user ID on the provider's service.

Account link event example

result

String

One of the following values to indicate whether the link was successful or not.

  • ok: Indicates the link was successful.
  • failed: Indicates the link failed for any reason, such as due to a user impersonation.

nonce

String

Example link object

Indicates that a user linked a device with LINE.

type

String

things

replyToken

String

Token for replying to this event

things.deviceId

String

Device ID of the device that has been linked with LINE.

things.type

String

link

If you use the LINE Things API, you can identify the device that has been linked or unlinked by the user from the device ID acquired by the Webhook event. For more information about the API, see Getting the product ID and PSDI by specifying the device ID in the LINE Things API reference.

Device link event example

Indicates that the user unlinked a device from LINE.

type

String

things

replyToken

String

Token for replying to this event

things.deviceId

String

Device ID of the device that was unlinked from LINE.

things.type

String

unlink

If you use the LINE Things API, you can identify the device that has been linked or unlinked by the user from the device ID acquired by the Webhook event. For more information about the API, see Getting the product ID and PSDI by specifying the device ID in the LINE Things API reference.

Device unlink event example

# LINE Things scenario execution event

This event indicates that an automatic communication scenario has been executed.

Rather than returning an aggregated result for a scenario set, an execution result is returned for each individual scenario.

The order in which execution results are returned is independent of the order of the scenarios.

type

String

things

replyToken

String

Token for replying to this event

things.deviceId

String

Device ID of the device that executed the scenario

things.type

String

scenarioResult

things.result.scenarioId

String

Scenario ID executed

things.result.revision

Number

Revision number of the scenario set containing the executed scenario

things.result.startTime

Number

Timestamp for when execution of scenario action started (milliseconds, LINE app time)

things.result.endTime

Number

Timestamp for when execution of scenario was completed (milliseconds, LINE app time)

things.result.resultCode

String

Scenario execution completion status
See also things.result.resultCode definitions.

things.result.actionResults

Array

Execution result of individual operations specified in action
Note that an array of actions specified in a scenario has the following characteristics

  • The actions defined in a scenario are performed sequentially, from top to bottom.
  • Each action produces some result when executed.
    Even actions that do not generate data, such as SLEEP, return an execution result of type void.
  • The number of items in an action array may be 0.

Therefore, things.result.actionResults has the following properties:

  • The number of items in the array matches the number of actions defined in the scenario.
  • The order of execution results matches the order in which actions are performed. That is, in a scenario set with multiple GATT_READ actions, the results are returned in the order in which each individual GATT_READ action was performed.
  • If 0 actions are defined in the scenario, the number of items in things.result.actionResults will be 0.

things.result.actionResults[].type

String

void, binary

  • Depends on type of the executed action.
  • This property is always included if things.result.actionResults is not empty.

things.result.actionResults[].data

String

Base64-encoded binary data
This property is always included when things.result.actionResults[].type is binary.

things.result.bleNotificationPayload

String

Data contained in notification
The value is Base64-encoded binary data. Only included for scenarios where trigger.type = BLE_NOTIFICATION.

things.result.errorReason

String

Error reason

Example of LINE Things scenario execution event

# things.result.resultCode definition

resultCode Description
success Indicates that the execution has completed successfully
gatt_error Indicates that the execution of the GATT operation failed
  • GATT Service UUID is incorrect.
  • GATT Characteristic UUID is incorrect.
  • Attempted to write to a characteristic that cannot be written to.
runtime_error Indicates that an unexpected error has occurred
  • When an unexpected error has occurred

# OAuth

# Issue channel access token

Note

This method issues a short-lived channel access token that is valid for 30 days. To issue a long-lived channel access token, use the "Issue" button found on the Console.

Issues a short-lived channel access token.

Up to 30 tokens can be issued. If the maximum is exceeded, existing channel access tokens are revoked in the order of when they were first issued.

Example request

# HTTP request

# Request headers

Content-Type

application/x-www-form-urlencoded

# Request body

grant_type

String

client_credentials

client_id

String

Channel ID. Found on the console.

client_secret

String

Channel secret. Found on the console.

# Response

Returns a 200 HTTP status code and a JSON object with the following information.

access_token

String

Short-lived channel access token. Valid for 30 days.
Note: Channel access tokens cannot be refreshed.

expires_in

Number

Time until channel access token expires in seconds from time the token is issued

token_type

String

Bearer

Example response

# Error response

Returns a 400 HTTP status code and a JSON object with the following information.

error

String

Error summary

error_description

String

Details of the error. Not returned in certain situations.

Example error response

# Revoke channel access token

Revokes a channel access token.

Example request

# HTTP request

# Request headers

Content-Type

application/x-www-form-urlencoded

# Request body

access_token

String

Channel access token

# Response

Returns the status code 200 and an empty response body. No error occurs if an invalid channel access token is specified.

# Error response

Returns a 400 HTTP status code and a JSON object with the following information.

error

String

Error summary

error_description

String

Details of the error. Not returned in certain situations.

Example error response

# Message

# Send reply message

Sends a reply message in response to an event from a user, group, or room.

To send reply messages, you must have a reply token which is included in a webhook event object.

Webhooks are used to notify you when an event occurs. For events that you can respond to, a reply token is issued for replying to messages.

Because the reply token becomes invalid after a certain period of time, responses should be sent as soon as a message is received. Reply tokens can only be used once.

Example request

# HTTP request

POST https://api.line.me/v2/bot/message/reply

# Request headers

Content-Type

application/json

Authorization

Bearer {channel access token}

# Request body

replyToken

String

Required

Reply token received via webhook

messages

Array of message objects

Required

Messages
Max: 5

notificationDisabled

Boolean

Optional
  • true: The user doesn't receive a push notification when the message is sent.
  • false: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device).

Default: false

# Response

Returns the status code 200 and an empty JSON object.

Example response

# Send push message

Sends a push message to a user, group, or room at any time.

Note: LINE@ accounts under the free or basic plan cannot call this API endpoint.

Example request

# HTTP request

POST https://api.line.me/v2/bot/message/push

# Request headers

Content-Type

application/json

Authorization

Bearer {channel access token}

# Request body

to

String

Required

ID of the target recipient. Use a userId, groupId, or roomId value returned in a webhook event object. Do not use the LINE ID found on LINE.

messages

Array of message objects

Required

Messages
Max: 5

notificationDisabled

Boolean

Optional
  • true: The user doesn't receive a push notification when the message is sent.
  • false: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device).

Default: false

# Response

Returns the status code 200 and an empty JSON object.

Example response

# Send multicast message

Sends push messages to multiple users at any time. Messages cannot be sent to groups or rooms.

Note: LINE@ accounts under the free or basic plan cannot call this API endpoint.

Example request

# HTTP request

POST https://api.line.me/v2/bot/message/multicast

# Request headers

Content-Type

application/json

Authorization

Bearer {channel access token}

# Request body

to

Array of strings

Required

Array of user IDs. Use userId values which are returned in webhook event objects. Do not use LINE IDs found on LINE.
Max: 150 user IDs

messages

Array of message objects

Required

Messages
Max: 5

notificationDisabled

Boolean

Optional
  • true: The user doesn't receive a push notification when the message is sent.
  • false: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device).

Default: false

# Response

Returns the status code 200 and an empty JSON object.

Example response

# ナローキャストメッセージを送る

★ This section will be translated into English soon.

複数のユーザーに、任意のタイミングでプッシュメッセージを送信します。送信対象は、属性情報(性別や年齢、OSの種類、地域など)やリターゲティング(オーディエンス)を利用して指定できます。グループまたはトークルームにメッセージを送ることはできません。

注意

サービス統合前のLINE公式アカウントおよびLINE@アカウントでは、このAPIは使用できません。サービス統合後のLINE公式アカウントに移行してください。詳しくは、「LINE@アカウントの移行」を参照してください。

リクエストの例

# HTTPリクエスト

POST https://api.line.me/v2/bot/message/narrowcast

# リクエストヘッダー

Authorization

Bearer {channel access token}

Content-Type

application/json

# リクエストボディ

messages

送信するメッセージ
最大件数:5

recipient

Object

Optional

レシピエントオブジェクト。オーディエンスを使用して、送信対象を指定します。
省略すると、LINE公式アカウントを友だち追加したすべてのユーザーが送信対象になります。

filter.demographic

Object

Optional

デモグラフィックフィルターオブジェクト。友だちの属性情報を使用して、送信対象をフィルタリングできます。
省略すると、属性が「不明」になっているユーザーを含めた全員に配信されます。

limit.max

Number

Optional

ナローキャストメッセージの最大送信数。このナローキャストメッセージによる送信数を制限する場合に指定します。なお、選択される送信対象は、無作為に抽出されます。

最低送信対象数について

送信対象のユーザーの属性を推測できないようにするために、送信対象が「最低送信対象数」よりも少ない場合はナローキャストメッセージは送信できません。「最低送信対象数」は、LINEプラットフォームで定義されており、数値は非公開です。

配信可能なメッセージの上限数について

ナローキャストメッセージを送信するときは、recipientプロパティおよびfilter.demographicプロパティの設定にかかわらず、一時的にすべての友だちにメッセージを配信する前提で、配信予定メッセージ数が計算されます。配信予定メッセージ数が、当月分の上限目安を超えた場合は、ナローキャストメッセージを送信できません。

ただし、limit.maxプロパティで設定した最大送信数が、当月分の上限目安を超えなければ、ナローキャストメッセージを送信できます。

属性情報の利用について
  • 属性情報は3日前の属性情報を元に絞込みます。
  • 属性を指定しない場合は、属性が「不明」になっているユーザーを含めた全員に配信されます。
# レシピエントオブジェクト

レシピエントオブジェクトは、オーディエンスを表すオブジェクトです。演算子オブジェクトを利用すると、条件を組み合わせて、送信対象を指定できます。

  • オーディエンスオブジェクト

    type

    String

    Required

    audience

    audienceGroupId

    Number

    Required

    オーディエンスID。オーディエンスを作成するには、「オーディエンス管理」のAPIを使用します。

  • 演算子オブジェクト

    積集合(AND)、和集合(OR)、差集合(NOT)を使用して、複数のレシピエントオブジェクトから、新たなレシピエントオブジェクトを作成できます。1回のリクエストごとに、レシピエントオブジェクトは、合計10件まで指定できます。

    type

    String

    Required

    operator

    and

    レシピエントオブジェクトの配列

    配列で指定したレシピエントオブジェクトの積集合(AND)を、新たなレシピエントオブジェクトとする

    or

    レシピエントオブジェクトの配列

    配列で指定したレシピエントオブジェクトの和集合(OR)を、新たなレシピエントオブジェクトとする

    not

    レシピエントオブジェクト

    指定したレシピエントオブジェクトを配信対象外にした、新たなレシピエントオブジェクトとする

    andプロパティ、orプロパティ、notプロパティのいずれか1つだけ、必ず指定してください。また、空配列は指定できません。

オーディエンスを表すレシピエントオブジェクトの例

# デモグラフィックフィルターオブジェクト

デモグラフィックフィルターオブジェクトは、送信対象をフィルタリングする条件(性別、年齢、OSの種類、地域、友だち期間)を表すオブジェクトです。演算子オブジェクトを利用すると、条件を組み合わせて、送信対象をフィルタリングできます。

  • 性別

    type

    String

    Required

    gender

    oneOf

    Stringの配列

    Required

    指定した性別を送信対象とします。以下のいずれかの値を指定します。

    • male:男性
    • female:女性
  • 年齢

    年齢の範囲を指定してフィルタリングします。

    type

    String

    Required

    age

    gte

    String

    指定した年齢以上を送信対象とします。以下のいずれかの値を指定します。

    • age_15
    • age_20
    • age_25
    • age_30
    • age_35
    • age_40
    • age_45
    • age_50

    lt

    String

    指定した年齢未満を送信対象とします。gteプロパティと同じ値を指定できます。

    gteプロパティまたはltプロパティの両方またはいずれか一方を、必ず指定してください。

  • OSの種類

    type

    String

    Required

    appType

    oneOf

    Stringの配列

    Required

    指定したOSを送信対象とします。以下のいずれかの値を指定します。

    • ios
    • android
  • 地域

    type

    String

    Required

    area

    oneOf

    Stringの配列

    Required

    指定した地域を送信対象とします。以下のいずれかの値を指定します。
    日本 // JP (country code=392)

    • jp_01:北海道 // Hokkaido
    • jp_02:青森県 // Aomori
    • jp_03:岩手県 // Iwate
    • jp_04:宮城県 // Miyagi
    • jp_05:秋田県 // Akita
    • jp_06:山形県 // Yamagata
    • jp_07:福島県 // Fukushima
    • jp_08:茨城県 // Ibaraki
    • jp_09:栃木県 // Tochigi
    • jp_10:群馬県 // Gunma
    • jp_11:埼玉県 // Saitama
    • jp_12:千葉県 // Chiba
    • jp_13:東京都 // Tokyo
    • jp_14:神奈川県 // Kanagawa
    • jp_15:新潟県 // Niigata
    • jp_16:富山県 // Toyama
    • jp_17:石川県 // Ishikawa
    • jp_18:福井県 // Fukui
    • jp_19:山梨県 // Yamanashi
    • jp_20:長野県 // Nagano
    • jp_21:岐阜県 // Gifu
    • jp_22:静岡県 // Shizuoka
    • jp_23:愛知県 // Aichi
    • jp_24:三重県 // Mie
    • jp_25:滋賀県 // Shiga
    • jp_26:京都府 // Kyoto
    • jp_27:大阪府 // Osaka
    • jp_28:兵庫県 // Hyougo
    • jp_29:奈良県 // Nara
    • jp_30:和歌山県 // Wakayama
    • jp_31:鳥取県 // Tottori
    • jp_32:島根県 // Shimane
    • jp_33:岡山県 // Okayama
    • jp_34:広島県 // Hiroshima
    • jp_35:山口県 // Yamaguchi
    • jp_36:徳島県 // Tokushima
    • jp_37:香川県 // Kagawa
    • jp_38:愛媛県 // Ehime
    • jp_39:高知県 // Kouchi
    • jp_40:福岡県 // Fukuoka
    • jp_41:佐賀県 // Saga
    • jp_42:長崎県 // Nagasaki
    • jp_43:熊本県 // Kumamoto
    • jp_44:大分県 // Oita
    • jp_45:宮崎県 // Miyazaki
    • jp_46:鹿児島県 // Kagoshima
    • jp_47:沖縄県 // Okinawa

    台湾 // TW (country code=158)

    • tw_01:台北市 // Taipei City
    • tw_02:新北市 // New Taipei City
    • tw_03:桃園市 // Taoyuan City
    • tw_04:台中市 // Taichung City
    • tw_05:台南市 // Tainan City
    • tw_06:高雄市 // Kaohsiung City
    • tw_07:基隆市 // Keelung City
    • tw_08:新竹市 // Hsinchu City
    • tw_09:嘉義市 // Chiayi City
    • tw_10:新竹県 // Hsinchu County
    • tw_11:苗栗県 // Miaoli County
    • tw_12:彰化県 // Changhua County
    • tw_13:南投県 // Nantou County
    • tw_14:雲林県 // Yunlin County
    • tw_15:嘉義県 // Chiayi County
    • tw_16:屏東県 // Pingtung County
    • tw_17:宜蘭県 // Yilan County
    • tw_18:花蓮県 // Hualien County
    • tw_19:台東県 // Taitung County
    • tw_20:澎湖県 // Penghu County
    • tw_21:金門県 // Kinmen County
    • tw_22:連江県 // Lienchiang County

    タイ // TH (country code=764)

    • th_01:バンコク // Bangkok
    • th_02:パタヤ // Pattaya
    • th_03:北部 // Northern
    • th_04:中央部 // Central
    • th_05:南部 // Southern
    • th_06:東部 // Eastern
    • th_07:東北部 // NorthEastern
    • th_08:西部 // Western

    インドネシア // ID (country code=360)

    • id_01:バリ // Bali
    • id_02:バンドン // Bandung
    • id_03:バンジャルマシン // Banjarmasin
    • id_04:ジャボデタベック(ジャカルタ首都圏) // Jabodetabek
    • id_06:マカッサル // Makassar
    • id_07:メダン // Medan
    • id_08:パレンバン // Palembang
    • id_09:サマリンダ // Samarinda
    • id_10:スマラン // Semarang
    • id_11:スラバヤ // Surabaya
    • id_12:ジョグジャカルタ // Yogyakarta
    • id_05:その他のエリア // Lainnya
  • 友だち期間

    友だち期間の範囲を指定してフィルタリングします。

    type

    String

    Required

    subscriptionPeriod

    gte

    String

    指定した日数以上を送信対象とします。以下のいずれかの値を指定します。

    • day_7
    • day_30
    • day_90
    • day_180
    • day_365

    lt

    String

    指定した日数未満を送信対象とします。gteプロパティと同じ値を指定できます。

    gteプロパティまたはltプロパティの両方またはいずれか一方を、必ず指定してください。

  • 演算子オブジェクト

    積集合(AND)、和集合(OR)、差集合(NOT)を使用して、複数のデモグラフィックフィルターオブジェクトから、新たなデモグラフィックフィルターオブジェクトを作成できます。1回のリクエストごとに、デモグラフィックフィルターオブジェクトは、合計10件まで指定できます。

    type

    String

    Required

    operator

    and

    デモグラフィックフィルターオブジェクトの配列

    配列で指定したデモグラフィックフィルターオブジェクトの積集合(AND)を、新たなデモグラフィックフィルターオブジェクトとする

    or

    デモグラフィックフィルターオブジェクトの配列

    配列で指定したデモグラフィックフィルターオブジェクトの和集合(OR)を、新たなデモグラフィックフィルターオブジェクトとする

    not

    デモグラフィックフィルターオブジェクト

    指定したデモグラフィックフィルターオブジェクトを配信対象外にした、新たなデモグラフィックフィルターオブジェクトとする

    andプロパティ、orプロパティ、notプロパティのいずれか1つだけ、必ず指定してください。また、空配列は指定できません。

性別を使用してフィルタリングするデモグラフィックフィルターオブジェクトの例

# レスポンス

HTTPステータスコード202を返します。

ナローキャストメッセージの送信状況を確認する方法について詳しくは、「ナローキャストメッセージの進行状況を取得する」を参照してください。

# ナローキャストメッセージの進行状況を取得する

★ This section will be translated into English soon.

ナローキャストメッセージの進行状況を取得します。

注意

サービス統合前のLINE公式アカウントおよびLINE@アカウントでは、このAPIは使用できません。サービス統合後のLINE公式アカウントに移行してください。詳しくは、「LINE@アカウントの移行」を参照してください。

最低送信対象数について

送信対象のユーザーの属性を推測できないようにするために、送信対象が「最低送信対象数」よりも少ない場合はナローキャストメッセージは送信できません。「最低送信対象数」は、LINEプラットフォームで定義されており、数値は非公開です。

進行状況を取得できる期間

ナローキャストメッセージの送信をリクエストしてから7日以上経過すると、進行状況は取得できません。

リクエストの例

# HTTPリクエスト

GET /v2/bot/message/progress/narrowcast

# リクエストヘッダー

Authorization

Bearer {channel access token}

# クエリパラメータ

requestId

Required

ナローキャストメッセージのリクエストID。リクエストIDは、Messaging APIのリクエストごとに発行されるIDです。レスポンスヘッダーに含まれます。

# レスポンス

HTTPステータスコード200と以下の情報を含むJSONオブジェクトを返します。

phase

String

進行状況。以下のいずれかの値です。

  • waiting:送信準備ができていません。フィルタリングなどを行っています。
  • sending:送信中です。
  • succeeded:送信が成功しました。
  • failed:送信が失敗しました。failedDescriptionプロパティで失敗した理由を確認できます。

successCount

Number

メッセージの受信に成功したユーザー数(※)

failureCount

Number

メッセージの受信に失敗したユーザー数(※)

targetCount

Number

メッセージが配信される予定のユーザー数(※)

failedDescription

String

送信が失敗した理由。phaseプロパティがfailedの場合にのみ含まれます。

errorCode

Number

エラーの概要。以下のいずれかの値です。

  • 1:内部エラーが発生しました。
  • 2:送信対象が少なすぎたためエラーになりました。

phaseプロパティがwaitingの場合は取得できません。

# エラーレスポンス

ナローキャストメッセージ以外のリクエストIDを指定した場合や、無効なリクエストIDを指定した場合は、HTTPステータスコード404を返します。

# Send broadcast message

Sends push messages to multiple users at any time.

LINE official account migration

You can't call this API with a LINE@ account or LINE official account that hasn't been migrated to the account plans implemented on April 18, 2019. Please migrate your account first. For more information, see Migration of LINE@ accounts.

Example request

# HTTP request

POST https://api.line.me/v2/bot/message/broadcast

# Request headers

Content-Type

application/json

Authorization

Bearer {channel access token}

# Request body

messages

Array of message objects

Required

Messages
Max: 5

notificationDisabled

Boolean

Optional
  • true: The user doesn't receive a push notification when the message is sent.
  • false: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device).

Default: false

# Response

Returns the status code 200 and an empty JSON object.

Example response

# Get content

Gets images, videos, audio, and files sent by users.

No API for retrieving text

You can't use the Messaging API to retrieve text sent by users.

Example request

# HTTP request

GET https://api-data.line.me/v2/bot/message/{messageId}/content

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

messageId

Message ID

# Response

Returns status code 200 and the content in binary.

Content is automatically deleted after a certain period from when the message was sent. There is no guarantee for how long content is stored.

# Get the target limit for additional messages

Gets the target limit for additional messages in the current month.

The number of messages retrieved by this operation includes the number of messages sent from LINE Official Account Manager.

Set a target limit with LINE Official Account Manager. For the procedures, refer to the LINE Official Account Manager manual.

Note: LINE@ accounts cannot call this API endpoint.

Example request

# HTTP request

# Request headers

Authorization

Bearer {channel access token}

# Response

Returns the status code 200 and a JSON object with the following information.

type

String

One of the following values to indicate whether a target limit is set or not.

  • none. This indicates that a target limit is not set.
  • limited. This indicates that a target limit is set.

value

Number

The target limit for additional messages in the current month. This property is returned when the type property has a value of limited.

Example response

# Get number of messages sent this month

Gets the number of messages sent in the current month.

The number of messages retrieved by this operation includes the number of messages sent from LINE Official Account Manager.

The number of messages retrieved by this operation is approximate. To get the correct number of sent messages, use LINE Official Account Manager or execute API operations for getting the number of sent messages.

Note: LINE@ accounts cannot call this API endpoint.

Example request

# HTTP request

# Request headers

Authorization

Bearer {channel access token}

# Response

Returns the status code 200 and a JSON object with the following information.

totalUsage

Number

The number of sent messages in the current month

Example response

# Get number of sent reply messages

Gets the number of messages sent with the /bot/message/reply endpoint.

The number of messages retrieved by this operation does not include the number of messages sent from LINE Official Account Manager.

Example request

# HTTP request

# Request headers

Authorization

Bearer {channel access token}

# Query parameters

date

Required

Date the messages were sent

  • Format: yyyyMMdd (Example: 20191231)
  • Timezone: UTC+9

# Response

Returns the status code 200 and a JSON object with the following information.

status

String

Status of the counting process. One of the following values is returned:

  • ready: You can get the number of messages.
  • unready: The message counting process for the date specified in date has not been completed yet. Retry your request later. Normally, the counting process is completed within the next day.
  • out_of_service: The date specified in date is earlier than March 31, 2018, when the operation of the counting system started.

success

Number

The number of messages sent with the Messaging API on the date specified in date. The response has this property only when the value of status is ready.

Example response

# Get number of sent push messages

Gets the number of messages sent with the /bot/message/push endpoint.

The number of messages retrieved by this operation does not include the number of messages sent from LINE Official Account Manager.

Note: LINE@ accounts under the free or basic plan cannot call this API endpoint.

Example request

# HTTP request

# Request headers

Authorization

Bearer {channel access token}

# Query parameters

date

Required

Date the messages were sent

  • Format: yyyyMMdd (Example: 20191231)
  • Timezone: UTC+9

# Response

Returns the status code 200 and a JSON object with the following information.

status

String

Status of the counting process. One of the following values is returned:

  • ready: You can get the number of messages.
  • unready: The message counting process for the date specified in date has not been completed yet. Retry your request later. Normally, the counting process is completed within the next day.
  • out_of_service: The date specified in date is earlier than March 31, 2018, when the operation of the counting system started.

success

Number

The number of messages sent with the Messaging API on the date specified in date. The response has this property only when the value of status is ready.

Example response

# Get number of sent multicast messages

Gets the number of messages sent with the /bot/message/multicast endpoint.

The number of messages retrieved by this operation does not include the number of messages sent from LINE Official Account Manager.

Note: LINE@ accounts under the free or basic plan cannot call this API endpoint.

Example request

# HTTP request

# Request headers

Authorization

Bearer {channel access token}

# Query parameters

date

Required

Date the messages were sent

  • Format: yyyyMMdd (Example: 20191231)
  • Timezone: UTC+9

# Response

Returns the status code 200 and a JSON object with the following information.

status

String

Status of the counting process. One of the following values is returned:

  • ready: You can get the number of messages.
  • unready: The message counting process for the date specified in date has not been completed yet. Retry your request later. Normally, the counting process is completed within the next day.
  • out_of_service: The date specified in date is earlier than March 31, 2018, when the operation of the counting system started.

success

Number

The number of messages sent with the Messaging API on the date specified in date. The response has this property only when the value of status is ready.

Example response

# Get number of sent broadcast messages

Gets the number of messages sent with the /bot/message/broadcast endpoint.

The number of messages retrieved by this operation does not include the number of messages sent from LINE Official Account Manager.

LINE official account migration

You can't call this API with a LINE@ account or LINE official account that hasn't been migrated to the account plans implemented on April 18, 2019. Please migrate your account first. For more information, see Migration of LINE@ accounts.

Example request

# HTTP request

GET https://api.line.me/v2/bot/message/delivery/broadcast

# Request headers

Authorization

Bearer {channel access token}

# Query parameters

date

Required

Date the messages were sent

  • Format: yyyyMMdd (Example: 20191231)
  • Timezone: UTC+9

# Response

Returns the status code 200 and a JSON object with the following information.

status

String

Status of the counting process. One of the following values is returned:

  • ready: You can get the number of messages.
  • unready: The message counting process for the date specified in date has not been completed yet. Retry your request later. Normally, the counting process is completed within the next day.
  • out_of_service: The date specified in date is earlier than March 31, 2018, when the operation of the counting system started.

success

Number

The number of messages sent with the Messaging API on the date specified in date. The response has this property only when the value of status is ready.

Example response

# オーディエンス管理

★ This section will be translated into English soon.

オーディエンスを作成して、メッセージを配信できます。

なお、オーディエンスには、以下の3種類があります。

注意

日本(JP)、タイ(TH)、台湾(TW)のユーザーが作成したLINE公式アカウントの場合のみ、オーディエンスを利用できます。

# ユーザーIDアップロード用のオーディエンスを作成する

★ This section will be translated into English soon.

ユーザーIDアップロード用のオーディエンスを作成します。オーディエンスは、合計1,000件まで作成できます。

ユーザーIDは、以下の方法で取得できます。

送信対象アカウントをIFAで指定するには手続きが必要です

送信対象アカウントをIFAで指定することもできますが、この機能をご利用いただくためには、所定の申請等が必要です。詳しくは、担当営業までご連絡いただくか、LINE for Businessウェブサイトからお問い合わせください。

リクエストの例

# HTTPリクエスト

POST https://api.line.me/v2/bot/audienceGroup/upload

# リクエストヘッダー

Authorization

Bearer {channel access token}

Content-Type

application/json

# リクエストボディ

description

String

Required

オーディエンスの名前。他のオーディエンスと同じ名前は設定できません。なお、大文字と小文字は区別されません。
最大文字数:120

isIfaAudience

Boolean

Required

送信対象アカウントをユーザーIDで指定する場合は、falseを指定します(標準)。送信対象アカウントをIFAで指定する場合は、trueを指定します。

uploadDescription

String

Optional

ジョブ(jobs[].description)に登録する説明

audiences

Array

Required

ユーザーIDまたはIFAの配列
最大件数:10,000

audiences[].id

String

Required

ユーザーIDまたはIFA

# レスポンス

HTTPステータスコード202とオーディエンスを返します。

audienceGroupId

Number

オーディエンスID

type

String

UPLOAD

description

String

オーディエンスの名前

created

Number

オーディエンスが作成された時刻のUNIXタイム

レスポンスの例

# エラーレスポンス

HTTPステータスコード400と以下の情報を含むJSONオブジェクトを返します。

message

String

エラーの概要

details

String

エラーの内容。以下のいずれかの値です。

  • AUDIENCE_GROUP_COUNT_MAX_OVER:作成できるオーディエンス数の上限(合計1,000件)に達しています。
  • AUDIENCE_GROUP_NAME_SIZE_OVER:オーディエンスの名前が長すぎます。
  • AUDIENCE_GROUP_NAME_DUPLICATE:既存のオーディエンスと同じ名前を指定しました。
  • AUDIENCE_GROUP_NAME_WRONG:オーディエンスの名前に、無効な文字(例:\nなどの制御コード)を指定しました。
  • AUDIENCE_GROUP_MISSING_AUDIENCESaudiencesプロパティが見つかりません。または、audiences[].idにユーザーIDまたはIFAが指定されていません。
  • AUDIENCE_GROUP_MISSING_IS_IFA_AUDIENCEisIfaAudienceプロパティが見つかりません。
  • UPLOAD_AUDIENCE_GROUP_INVALID_AUDIENCE_ID_FORMATaudiences[].idプロパティに無効なユーザーIDまたはIFAが指定されています。
  • UPLOAD_AUDIENCE_GROUP_TOO_MANY_AUDIENCE_IDS:ユーザーIDまたはIFAの登録上限に達しています。

# ユーザーIDアップロード用のオーディエンスにユーザーIDまたはIFAを追加する

★ This section will be translated into English soon.

ユーザーIDアップロード用のオーディエンスに、ユーザーIDまたはIFAを追加します。

リクエストタイムアウト値について

リクエストタイムアウトを30秒以上に設定することを強く推奨します。

ユーザーIDまたはIFAの種類は変更できません

ユーザーIDアップロード用のオーディエンスを作成したときと同じ種類(ユーザーIDまたはIFA)のデータを追加してください。たとえば、初めにIFAを指定して作成したオーディエンスに、ユーザーIDを指定することはできません。

オーディエンスを作成したときに指定した送信対象アカウントの種類(ユーザーIDまたはIFA)は、オーディエンスのisIfaAudienceプロパティで確認できます。詳しくは、「オーディエンスの情報を取得する」を参照してください。

ユーザーIDまたはIFAは削除できません

一度追加したユーザーIDまたはIFAを削除することはできません。

リクエストの例

# HTTPリクエスト

PUT https://api.line.me/v2/bot/audienceGroup/upload

# リクエストヘッダー

Authorization

Bearer {channel access token}

Content-Type

application/json

# リクエストボディ

audienceGroupId

Number

Required

オーディエンスID

description

String

Optional

オーディエンスの名前。他のオーディエンスと同じ名前は設定できません。なお、大文字と小文字は区別されません。
最大文字数:120

uploadDescription

String

Optional

ジョブ(jobs[].description)に登録する説明

audiences

Array

Required

ユーザーIDまたはIFAの配列
最大件数:10,000

audiences[].id

String

Required

ユーザーIDまたはIFA

# レスポンス

HTTPステータスコード202を返します。

# エラーレスポンス

HTTPステータスコード400と以下の情報を含むJSONオブジェクトを返します。

message

String

エラーの概要

details

String

エラーの内容。以下のいずれかの値です。

  • AUDIENCE_GROUP_NAME_SIZE_OVER:オーディエンスの名前が長すぎます。
  • AUDIENCE_GROUP_NAME_DUPLICATE:既存のオーディエンスと同じ名前を指定しました。
  • AUDIENCE_GROUP_NAME_WRONG:オーディエンスの名前に、無効な文字(例:\nなどの制御コード)を指定しました。
  • UPLOAD_AUDIENCE_GROUP_INVALID_AUDIENCE_ID_FORMATaudiences[].idプロパティに無効なユーザーIDまたはIFAが指定されています。
  • UPLOAD_AUDIENCE_GROUP_TOO_MANY_AUDIENCE_IDS:ユーザーIDまたはIFAの登録上限に達しています。
  • UPLOAD_AUDIENCE_GROUP_NO_VALID_AUDIENCE_IDS:有効なユーザーIDまたはIFAが指定されていません。
  • AUDIENCE_GROUP_CAN_NOT_UPLOAD_STATUS_EXPIRED:オーディエンス作成後、180日以上が経過しました。このオーディエンスは使用できません。

# クリックリターゲティング用のオーディエンスを作成する

★ This section will be translated into English soon.

クリックリターゲティング用のオーディエンスを作成します。オーディエンスは、合計1,000件まで作成できます。

クリックリターゲティング用のオーディエンスは、ブロードキャストメッセージまたはナローキャストメッセージに設定されたURLをクリックしたユーザーを集めたオーディエンスです。

メッセージは、リクエストIDで指定します。少なくとも1つのリンクをクリックしたユーザーが送信対象になります。

リクエストの例

# HTTPリクエスト

POST https://api.line.me/v2/bot/audienceGroup/click

# リクエストヘッダー

Authorization

Bearer {channel access token}

Content-Type

application/json

# リクエストボディ

description

String

Required

オーディエンスの名前。他のオーディエンスと同じ名前は設定できません。なお、大文字と小文字は区別されません。
最大文字数:120

requestId

String

Required

配信から60日以内のブロードキャストメッセージまたはナローキャストメッセージのリクエストID。リクエストIDは、Messaging APIのリクエストごとに発行されるIDです。レスポンスヘッダーに含まれます。

clickUrl

String

Optional

ユーザーがクリックしたURL。省略した場合は、メッセージ内の任意のURLをクリックしたユーザーが送信対象になります。
最大文字数:2,000

# レスポンス

HTTPステータスコード202とオーディエンスを返します。

audienceGroupId

Number

オーディエンスID

type

String

CLICK

description

String

オーディエンスの名前

created

Number

オーディエンスが作成された時刻のUNIXタイム

requestId

String

オーディエンスを作成したときに指定したリクエストID

clickUrl

String

オーディエンスを作成したときに指定したURL

レスポンスの例

# エラーレスポンス

HTTPステータスコード400と以下の情報を含むJSONオブジェクトを返します。

message

String

エラーの概要

details

String

エラーの内容。以下のいずれかの値です。

  • AUDIENCE_GROUP_COUNT_MAX_OVER:作成できるオーディエンス数の上限(合計1,000件)に達しています。
  • AUDIENCE_GROUP_NAME_SIZE_OVER:オーディエンスの名前が長すぎます。
  • AUDIENCE_GROUP_NAME_DUPLICATE:既存のオーディエンスと同じ名前を指定しました。
  • AUDIENCE_GROUP_NAME_WRONG:オーディエンスの名前に、無効な文字(例:\nなどの制御コード)を指定しました。
  • AUDIENCE_GROUP_REQUESTID_DUPLICATE:既存のオーディエンスに指定したリクエストIDと同じ値を指定しました。
  • WRONG_BOT_ID:指定されたリクエストIDに含まれるボットIDが、チャネルに関連付けられたボットと異なります。
  • TOO_OLD_MESSAGES:メッセージを配信してから61日以上経過した場合は、そのメッセージ(リクエストID)に対するオーディエンスは作成できません。

# インプレッションリターゲティング用のオーディエンスを作成する

★ This section will be translated into English soon.

インプレッションリターゲティング用のオーディエンスを作成します。オーディエンスは、合計1,000件まで作成できます。

インプレッションリターゲティング用のオーディエンスは、ブロードキャストメッセージまたはナローキャストメッセージを表示したユーザーを集めたオーディエンスです。

メッセージは、リクエストIDで指定します。少なくとも1つの吹き出しを表示したユーザーが送信対象になります。

リクエストの例

# HTTPリクエスト

POST https://api.line.me/v2/bot/audienceGroup/imp

# リクエストヘッダー

Authorization

Bearer {channel access token}

Content-Type

application/json

# リクエストボディ

description

String

Required

オーディエンスの名前。他のオーディエンスと同じ名前は設定できません。なお、大文字と小文字は区別されません。
最大文字数:120

requestId

String

Required

配信から60日以内のブロードキャストメッセージまたはナローキャストメッセージのリクエストID。リクエストIDは、Messaging APIのリクエストごとに発行されるIDです。レスポンスヘッダーに含まれます。

# レスポンス

HTTPステータスコード202とオーディエンスを返します。

audienceGroupId

Number

オーディエンスID

type

String

IMP

description

String

オーディエンスの名前

created

Number

オーディエンスが作成された時刻のUNIXタイム

requestId

String

オーディエンスを作成したときに指定したリクエストID

レスポンスの例

# エラーレスポンス

HTTPステータスコード400と以下の情報を含むJSONオブジェクトを返します。

message

String

エラーの概要

details

String

エラーの内容。以下のいずれかの値です。

  • AUDIENCE_GROUP_COUNT_MAX_OVER:作成できるオーディエンス数の上限(合計1,000件)に達しています。
  • AUDIENCE_GROUP_NAME_SIZE_OVER:オーディエンスの名前が長すぎます。
  • AUDIENCE_GROUP_NAME_DUPLICATE:既存のオーディエンスと同じ名前を指定しました。
  • AUDIENCE_GROUP_NAME_WRONG:オーディエンスの名前に、無効な文字(例:\nなどの制御コード)を指定しました。
  • AUDIENCE_GROUP_REQUESTID_DUPLICATE:既存のオーディエンスに指定したリクエストIDと同じ値を指定しました。
  • WRONG_BOT_ID:指定されたリクエストIDに含まれるボットIDが、チャネルに関連付けられたボットと異なります。
  • TOO_OLD_MESSAGES:メッセージを配信してから60日以上経過した場合は、そのメッセージ(リクエストID)に対するオーディエンスは作成できません。

# オーディエンスの名前を更新する

★ This section will be translated into English soon.

既存のオーディエンスの名前を変更します。

リクエストの例

# HTTPリクエスト

PUT https://api.line.me/v2/bot/audienceGroup/{audienceGroupId}/updateDescription

# リクエストヘッダー

Authorization

Bearer {channel access token}

Content-Type

application/json

# パスパラメータ

audienceGroupId

オーディエンスID

# リクエストボディ

description

String

Required

オーディエンスの名前。他のオーディエンスと同じ名前は設定できません。なお、大文字と小文字は区別されません。
最大文字数:120

# レスポンス

HTTPステータスコード200を返します。

# エラーレスポンス

HTTPステータスコード400と以下の情報を含むJSONオブジェクトを返します。

message

String

エラーの概要

details

String

エラーの内容。以下のいずれかの値です。

  • AUDIENCE_GROUP_NAME_SIZE_OVER:オーディエンスの名前が長すぎます。
  • AUDIENCE_GROUP_NAME_DUPLICATE:既存のオーディエンスと同じ名前を指定しました。
  • AUDIENCE_GROUP_NAME_WRONG:オーディエンスの名前に、無効な文字(例:\nなどの制御コード)を指定しました。

# オーディエンスを削除する

★ This section will be translated into English soon.

オーディエンスを削除します。

削除したオーディエンスは元に戻せません

削除する前に、オーディエンスが使用されていないことを確認してください。

リクエストの例

# HTTPリクエスト

DELETE https://api.line.me/v2/bot/audienceGroup/{audienceGroupId}

# リクエストヘッダー

Authorization

Bearer {channel access token}

# パスパラメータ

audienceGroupId

オーディエンスID

# レスポンス

HTTPステータスコード202を返します。

# エラーレスポンス

HTTPステータスコード400と以下の情報を含むJSONオブジェクトを返します。

message

String

エラーの概要

details

String

エラーの内容。以下のいずれかの値です。

  • AUDIENCE_GROUP_NOT_FOUND:オーディエンスが見つかりません。

# オーディエンスの情報を取得する

★ This section will be translated into English soon.

オーディエンスの情報を取得します。

リクエストの例

# HTTPリクエスト

GET https://api.line.me/v2/bot/audienceGroup/{audienceGroupId}

# リクエストヘッダー

Authorization

Bearer {channel access token}

# パスパラメータ

audienceGroupId

オーディエンスID

# レスポンス

HTTPステータスコード200と以下の情報を含むJSONオブジェクトを返します。

audienceGroupId

Number

オーディエンスID

type

String

オーディエンスのタイプ。以下のいずれかの値です。

  • UPLOAD:ユーザーIDアップロード用のオーディエンス
  • CLICK:クリックリターゲティング用のオーディエンス
  • IMP:インプレッションリターゲティング用のオーディエンス

description

String

オーディエンスの名前

status

String

オーディエンスのステータス。以下のいずれかの値です。

  • IN_PROGRESS:準備中。READYになるまで数時間かかる場合があります。
  • READY:配信に利用可能
  • FAILED:作成時にエラーが発生
  • EXPIRED:有効期限切れ。有効期限切れ後、1か月後に自動で削除されます。

failedType

String

失敗した原因。statusがFAILEDの場合にのみ含まれます。以下のいずれかの値です。

  • AUDIENCE_GROUP_AUDIENCE_INSUFFICIENT:オーディエンスに含まれる送信対象アカウントの数(最低100件)が不足しています。
  • INTERNAL_ERROR:内部サーバーのエラーです。

audienceCount

Number

有効な送信対象アカウントの数

created

Number

オーディエンスが作成された時刻のUNIXタイム

requestId

String

オーディエンスを作成したときに指定したリクエストID。typeがCLICKまたはIMPの場合にのみ含まれます。

clickUrl

String

オーディエンスを作成したときに指定したURL。typeがCLICKの場合にのみ含まれます。

isIfaAudience

Boolean

ユーザーIDアップロード用のオーディエンスを作成したときに指定した、送信対象アカウントの種類を示す値。以下のいずれかの値です。

  • true:IFAで指定する
  • false:ユーザーIDで指定する(標準)

permission

String

オーディエンスの更新パーミッション。同じチャネルに関連付けられたオーディエンスは、READ_WRITEになります。

  • READ:利用のみ可能
  • READ_WRITE:利用と更新が可能

createRoute

String

オーディエンスの作成方法。省略した場合は、すべてのオーディエンスを取得します。

jobs

Array

ジョブの配列。ユーザーIDアップロード用のオーディエンスに、ユーザーIDまたはIFAを追加した履歴を管理する配列です。それ以外のオーディエンスの場合はnullが返ります。

jobs[].audienceGroupJobId

Number

ジョブID

jobs[].audienceGroupId

Number

オーディエンスID

jobs[].description

String

ジョブの説明

jobs[].type

String

ジョブの種類。以下のいずれかの値です。

  • DIFF_ADD:Messaging APIでユーザーIDまたはIFAを追加したことを示します。

jobs[].jobStatus

String

ジョブのステータス。以下のいずれかの値です。

  • QUEUED:待機中
  • WORKING:実行中
  • FINISHED:成功
  • FAILED:失敗

jobs[].failedType

String

失敗した原因。jobs[].jobStatusがFAILEDの場合にのみ含まれます。以下のいずれかの値です。

  • INTERNAL_ERROR:内部サーバーのエラーです。

jobs[].audienceCount

Number

追加または削除された送信対象アカウントの数

jobs[].created

Number

ジョブが作成された時刻のUNIXタイム

# エラーレスポンス

HTTPステータスコード400と以下の情報を含むJSONオブジェクトを返します。

message

String

エラーの概要

details

String

エラーの内容。以下のいずれかの値です。

  • AUDIENCE_GROUP_NOT_FOUND:オーディエンスが見つかりません。

# 複数のオーディエンスの情報を取得する

★ This section will be translated into English soon.

複数のオーディエンスの情報を取得します。

リクエストの例

# HTTPリクエスト

GET https://api.line.me/v2/bot/audienceGroup/list

# リクエストヘッダー

Authorization

Bearer {channel access token}

# クエリパラメータ

page

Required

取得するページ番号。1以上を指定してください。

description

Optional

取得するオーディエンスの名前。部分一致で検索できます。大文字と小文字は区別されません。

status

Optional

取得するオーディエンスのステータス。以下のいずれかの値です。

  • IN_PROGRESS:準備中。READYになるまで数時間かかる場合があります。
  • READY:配信に利用可能
  • FAILED:作成時にエラーが発生
  • EXPIRED:有効期限切れ。有効期限切れ後、1か月後に自動で削除されます。

size

Optional

1ページごとのオーディエンス数。デフォルト値は20です。
最大値:40

includesExternalPublicGroups

Optional
  • true:同じボットに関連付けられた、すべてのチャネルで作成された公開オーディエンスを取得
  • false:同じチャネルに作成されたオーディエンスのみを取得

createRoute

Optional

オーディエンスの作成方法。省略した場合は、すべてのオーディエンスを取得します。

  • OA_MANAGERLINE Official Account Managerで作成したオーディエンスのみを取得
  • MESSAGING_API:Messaging APIで作成したオーディエンスのみを取得

# レスポンス

HTTPステータスコード200と以下の情報を含むJSONオブジェクトを返します。

audienceGroups

Array

オーディエンスの情報の配列

audienceGroups[].audienceGroupId

Number

オーディエンスID

audienceGroups[].type

String

オーディエンスのタイプ。以下のいずれかの値です。

  • UPLOAD:ユーザーIDアップロード用のオーディエンス
  • CLICK:クリックリターゲティング用のオーディエンス
  • IMP:インプレッションリターゲティング用のオーディエンス

audienceGroups[].description

String

オーディエンスの名前

audienceGroups[].status

String

オーディエンスのステータス。以下のいずれかの値です。

  • IN_PROGRESS:準備中。READYになるまで数時間かかる場合があります。
  • READY:配信に利用可能
  • FAILED:作成時にエラーが発生
  • EXPIRED:有効期限切れ。有効期限切れ後、1か月後に自動で削除されます。

audienceGroups[].failedType

String

失敗した原因。audienceGroups[].statusがFAILEDまたはEXPIREDの場合にのみ含まれます。以下のいずれかの値です。

  • AUDIENCE_GROUP_AUDIENCE_INSUFFICIENT:オーディエンスに含まれる送信対象アカウントの数(最低100件)が不足しています。
  • INTERNAL_ERROR:内部サーバーのエラーです。

audienceGroups[].audienceCount

Number

有効な送信対象アカウントの数

audienceGroups[].created

Number

オーディエンスが作成された時刻のUNIXタイム

audienceGroups[].requestId

String

オーディエンスを作成したときに指定したリクエストID。audienceGroups[].typeがCLICKまたはIMPの場合にのみ含まれます。

audienceGroups[].clickUrl

String

オーディエンスを作成したときに指定したURL。audienceGroups[].typeがCLICKの場合にのみ含まれます。

audienceGroups[].isIfaAudience

Boolean

ユーザーIDアップロード用のオーディエンスを作成したときに指定した、送信対象アカウントの種類を示す値。以下のいずれかの値です。

  • true:IFAで指定する
  • false:ユーザーIDで指定する(標準)

audienceGroups[].permission

String

オーディエンスの更新パーミッション。同じチャネルに関連付けられたオーディエンスは、READ_WRITEになります。

  • READ:利用のみ可能
  • READ_WRITE:利用と更新が可能

audienceGroups[].createRoute

String

オーディエンスの作成方法。省略した場合は、すべてのオーディエンスを含める。

hasNextPage

Boolean

次のページが存在する場合は、true

totalCount

Int

指定した条件で取得できるオーディエンスの総数

readWriteAudienceGroupTotalCount

Int

指定した条件で取得できるオーディエンスのうち、更新パーミッションがREAD_WRITEに設定されているオーディエンスの数

page

Int

現在のページ番号

size

Int

現在のページに含まれるオーディエンス数

# オーディエンスの権限レベルを取得する

★ This section will be translated into English soon.

オーディエンスの権限レベルを取得します。

注意

権限レベルはチャネルごとに設定されます。オーディエンスごとに異なる権限レベルを設定することはできません。

リクエストの例

# HTTPリクエスト

GET https://api.line.me/v2/bot/audienceGroup/authorityLevel

# リクエストヘッダー

Authorization

Bearer {channel access token}

# レスポンス

HTTPステータスコード200と以下の情報を含むJSONオブジェクトを返します。

authorityLevel

String

このチャネルで作成された、すべてのオーディエンスの権限レベル

  • PUBLIC:デフォルトの権限レベルです。オーディエンスを作成したチャネル以外でも使用できます。たとえば、LINE Official Account ManagerLINE広告、同じボットに関連付けられているすべてのチャネルで利用できます。
  • PRIVATE:オーディエンスを作成したチャネルでのみ使用できます。

# オーディエンスの権限レベルを変更する

★ This section will be translated into English soon.

同じチャネルで作成された、すべてのオーディエンスの権限レベルを変更します。

  • PUBLICに設定すると、オーディエンスを作成したチャネル以外でも使用できます。たとえば、LINE Official Account ManagerLINE広告、同じボットに関連付けられているすべてのチャネルで利用できます。
  • PRIVATEに設定すると、オーディエンスを作成したチャネルでのみ使用できます。
注意

権限レベルはチャネルごとに設定されます。オーディエンスごとに異なる権限レベルを設定することはできません。

リクエストの例

# HTTPリクエスト

PUT https://api.line.me/v2/bot/audienceGroup/authorityLevel

# リクエストヘッダー

Authorization

Bearer {channel access token}

Content-Type

application/json

# リクエストボディ

authorityLevel

String

Required

チャネルに関連付けられた、すべてのオーディエンスの権限レベル

  • PUBLIC:デフォルトの権限レベルです。オーディエンスを作成したチャネル以外でも使用できます。たとえば、LINE Official Account ManagerLINE広告、同じボットに関連付けられているすべてのチャネルで利用できます。
  • PRIVATE:オーディエンスを作成したチャネルでのみ使用できます。

# レスポンス

HTTPステータスコード200を返します。

# Insight

# Get number of message deliveries

Returns the number of messages sent from LINE official account on a specified day.

LINE official account migration

You can't call this API with a LINE@ account or LINE official account that hasn't been migrated to the account plans implemented on April 18, 2019. Please migrate your account first. For more information, see Migration of LINE@ accounts.

Example request

# HTTP request

GET https://api.line.me/v2/bot/insight/message/delivery?date={date}

# Request headers

Authorization

Bearer {channel access token}

# Query parameters

date

Required

Date for which to retrieve number of sent messages.

  • Format: yyyyMMdd (Example: 20191231)
  • Timezone: UTC+9

# Response

Returns status code 200 and a JSON object with these properties:

status

String

Status of the counting process. One of the following values is returned:

  • ready: Calculation has finished; the numbers are up-to-date.
  • unready: We haven't finished calculating the number of sent messages for the specified date. Retry your request later. Calculation usually takes about a day.
  • out_of_service: The specified date is earlier than the date on which we first started calculating sent messages (March 1, 2017).

broadcast

Number

Number of push messages sent to all of this LINE official account's friends (broadcast messages).

targeting

Number

Number of push messages sent to some of this LINE official account's friends, based on specific attributes (targeted/segmented messages).

autoResponse

Number

Number of auto-response messages sent.

welcomeResponse

Number

Number of greeting messages sent.

chat

Number

Number of messages sent from LINE Official Account Manager Chat screen.

apiBroadcast

Number

Number of broadcast messages sent with the Send broadcast message Messaging API operation.

apiPush

Number

Number of push messages sent with the Send push message Messaging API operation.

apiMulticast

Number

Number of multicast messages sent with the Send multicast message Messaging API operation.

apiNarrowcast

Number

Number of narrowcast messages sent with the Send narrowcast message Messaging API operation.

apiReply

Number

Number of replies sent with the Send reply message Messaging API operation.

Properties after broadcast contain the number of messages sent on the date specified in date. These extra properties are included only if status is ready.

Example response

# Get number of followers

Returns the number of users who have added the LINE official account on or before a specified date.

LINE official account migration

You can't call this API with a LINE@ account or LINE official account that hasn't been migrated to the account plans implemented on April 18, 2019. Please migrate your account first. For more information, see Migration of LINE@ accounts.

Example request

# HTTP request

GET https://api.line.me/v2/bot/insight/followers?date={date}

# Request headers

Authorization

Bearer {channel access token}

# Query parameters

date

Required

Date for which to retrieve the number of followers.

  • Format: yyyyMMdd (Example: 20191231)
  • Timezone: UTC+9

# Response

Returns status code 200 and a JSON object with these properties:

status

String

Calculation status. One of:

  • ready: Calculation has finished. The numbers are up-to-date.
  • unready: We haven't finished calculating followers for the specified date. Please try again later. Calculation usually takes about a day.
  • out_of_service: The specified date is earlier than the date on which we first started calculating followers (November 1, 2016).

followers

Number

The number of times, as of the specified date, that a user added this LINE official account as a friend for the first time. The number doesn't decrease even if a user later blocks the account or when they delete their LINE account.

targetedReaches

Number

The number of users, as of the specified date, that the official account can reach through targeted messages based on gender, age, and/or region. This number only includes users who are active on LINE or LINE services and whose demographics have a high level of certainty.

blocks

Number

The number of users blocking the account as of the specified date. The number decreases when a user unblocks the account.

Properties after followers are only returned if status is ready.

Example response

# Get friend demographics

Retrieves the demographic attributes for a LINE Official Account's friends. You can only retrieve information about friends for LINE official accounts created by users in Japan (JP), Thailand (TH) and Taiwan (TW).

LINE Official Account migration

You can't call this API with a LINE@ account or LINE Official Account that hasn't been migrated to the account plans implemented on April 18, 2019. Please migrate your account first. For more information, see Migration of LINE@ accounts.

Not real-time data

It can take up to 3 days for demographic information to be calculated. This means the information the API returns may be 3 days old. Furthermore, your "Target reach" number must be at least 20 to retrieve demographic information.

Example request

# HTTP request

GET https://api.line.me/v2/bot/insight/demographic

# Request headers

Authorization

Bearer {channel access token}

# Response

Returns status code 200 and a JSON object with these properties:

available

Boolean

true if friend demographic information is available.

genders

Array

Percentage per gender

genders[].gender

String

Returns these values based on the users' gender:

  • male
  • female
  • unknown

genders[].percentage

Number

Percentage

ages

Array

Percentage per age group

ages[].age

String

Returns these values based on the users' age:

  • from0to14
  • from15to19
  • from20to24
  • from25to29
  • from30to34
  • from35to39
  • from40to44
  • from45to49
  • from50
  • unknown

ages[].percentage

Number

Percentage

areas

Array

Percentage per area

areas[].area

String

Returns these values based on the users' country and region:
JP

  • 北海道
  • 青森
  • 岩手
  • 宮城
  • 秋田
  • 山形
  • 福島
  • 茨城
  • 栃木
  • 群馬
  • 埼玉
  • 千葉
  • 東京
  • 神奈川
  • 新潟
  • 富山
  • 石川
  • 福井
  • 山梨
  • 長野
  • 岐阜
  • 静岡
  • 愛知
  • 三重
  • 滋賀
  • 京都
  • 大阪
  • 兵庫
  • 奈良
  • 和歌山
  • 鳥取
  • 島根
  • 岡山
  • 広島
  • 山口
  • 徳島
  • 香川
  • 愛媛
  • 高知
  • 福岡
  • 佐賀
  • 長崎
  • 熊本
  • 大分
  • 宮崎
  • 鹿児島
  • 沖縄
  • unknown

TW

  • 台北市
  • 新北市
  • 桃園市
  • 台中市
  • 台南市
  • 高雄市
  • 基隆市
  • 新竹市
  • 嘉義市
  • 新竹縣
  • 苗栗縣
  • 彰化縣
  • 南投縣
  • 雲林縣
  • 嘉義縣
  • 屏東縣
  • 宜蘭縣
  • 花蓮縣
  • 台東縣
  • 澎湖縣
  • 金門縣
  • 連江縣
  • unknown

TH

  • Bangkok
  • Pattaya
  • Northern
  • Central
  • Southern
  • Eastern
  • NorthEastern
  • Western
  • unknown

areas[].percentage

Number

Percentage

appTypes

Array

Percentage by OS

appTypes[].appType

String

Returns these values based on the users' OS:

  • ios
  • android
  • others

appTypes[].percentage

Number

Percentage

subscriptionPeriods

Array

Percentage per friendship duration

subscriptionPeriods[].subscriptionPeriod

String

Returns these values based on the friendship duration with the users:

  • within7days
  • within30days
  • within90days
  • within180days
  • within365days
  • over365days
  • unknown

subscriptionPeriods[].percentage

Number

Percentage

The elements of each Array are included in the response only if the value of available is true.

Example response

# Get user interaction statistics

Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account.

You can get statistics per message or per bubble.

Message and bubbles

LINE Official Account migration

You can't call this API with a LINE@ account or LINE Official Account that hasn't been migrated to the account plans implemented on April 18, 2019. Please migrate your account first. For more information, see Migration of LINE@ accounts.

Understanding the numbers

Interactions are tracked for only 14 days after a message was sent. The statistics are no longer updated after 15 days.

Example request

# HTTP request

GET https://api.line.me/v2/bot/insight/message/event?requestId={requestId}

# Request headers

Authorization

Bearer {channel access token}

# Query parameters

requestId

Required

Request ID of narrowcast messages or broadcast message. A unique ID is generated for each Messaging API request. It is provided in the response headers.

# Response

Returns status code 200 and a JSON object with these properties:

Note

To protect users' privacy, the values of some properties related to user interactions may be displayed as null or -1.

  • null:overview.uniqueImpression is 20 or lower.
  • -1:overview.uniqueImpression is 20 or higher, but the value of this property is 20 or lower.

overview

Object

Summary of message statistics.

overview.requestId

String

Request ID.

overview.timestamp

Number

UNIX timestamp for message delivery time.

overview.delivered

Number

Number of messages delivered. This property shows values of less than 20.

overview.uniqueImpression

Number

Number of people who opened the message, meaning they displayed at least 1 bubble.

overview.uniqueClick

Number

Number of people who opened any URL in the message.

overview.uniqueMediaPlayed

Number

Number of people who started playing any video or audio in the message.

overview.uniqueMediaPlayed100Percent

Number

Number of people who played the entirety of any video or audio in the message.

messages

Array

Array of information about individual message bubbles.

messages[].seq

Number

Bubble's serial number.

messages[].impression

Number

Number of times the bubble was displayed.

messages[].mediaPlayed

Number

Number of times audio or video in the bubble started playing.

messages[].mediaPlayed25Percent

Number

Number of times audio or video in the bubble was played from start to 25%.

messages[].mediaPlayed50Percent

Number

Number of times audio or video in the bubble was played from start to 50%.

messages[].mediaPlayed75Percent

Number

Number of times audio or video in the bubble was played from start to 75%.

messages[].mediaPlayed100Percent

Number

Number of times audio or video in the bubble was played in its entirety.

messages[].uniqueMediaPlayed

Number

Number of people that started playing audio or video in the bubble.

messages[].uniqueMediaPlayed25Percent

Number

Number of people that played audio or video in the bubble from start to 25%.

messages[].uniqueMediaPlayed50Percent

Number

Number of people that played audio or video in the bubble from start to 50%.

messages[].uniqueMediaPlayed75Percent

Number

Number of people that played audio or video in the bubble from start to 75%.

messages[].uniqueMediaPlayed100Percent

Number

Number of people that played audio or video in the bubble in its entirety.

clicks

Array

Array of information about URLs in the message.

clicks[].seq

Number

The URL's serial number.

clicks[].url

String

URL

clicks[].click

Number

Number of times the URL was opened.

clicks[].uniqueClick

Number

Number of people that opened the URL.

clicks[].uniqueClickOfRequest

Number

Number of people who opened this url through any link in the message. If a message contains two links to the same URL and a user opens both links, they're counted only once.

Example response

# Profile

# Get profile

Gets user profile information.

Example request

# HTTP request

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

userId

User ID that is returned in a webhook event object. Do not use the LINE ID found on LINE.

# Response

Returns the status code 200 and a JSON object with the following information.

displayName

String

User's display name

userId

String

User ID

pictureUrl

String

Profile image URL. "https" image URL. Not included in the response if the user doesn't have a profile image.

statusMessage

String

User's status message. Not included in the response if the user doesn't have a status message.

Example response

# Group

# Get group member user IDs

Note

This feature is available only to verified or premium accounts. For more information about account types, see the LINE Account Connect page on the LINE for Business website.

Gets the user IDs of the members of a group that the bot is in. This includes the user IDs of users who have not added the LINE official account as a friend or has blocked the LINE official account.

Example request

# HTTP request

GET https://api.line.me/v2/bot/group/{groupId}/members/ids

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

groupId

Required

Group ID. Found in the source object of webhook event objects.

# Query parameters

start

Optional

Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group.

# Response

Returns the status code 200 and a JSON object with the following properties.

memberIds

Array of strings

List of user IDs of members in the group. Users of LINE version 7.4.x or earlier are not included in memberIds. For more information, see User consent.
Max: 100 user IDs

next

String

A continuation token to get the next array of user IDs of the members in the group. Returned only when there are remaining user IDs that were not returned in memberIds in the original request.

Example response

# Get group member profile

Gets the user profile of a member of a group that the LINE official account is in if the user ID of the group member is known. You can get user profiles of users who have not added the LINE official account as a friend or have blocked the LINE official account.

Example request

# HTTP request

GET https://api.line.me/v2/bot/group/{groupId}/member/{userId}

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

groupId

Group ID. Found in the source object of webhook event objects.

userId

User ID. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.

# Response

Returns the status code 200 and a JSON object with the following information.

displayName

String

Display name

userId

String

User ID

pictureUrl

String

Profile image URL

Example response

# Leave group

Leaves a group.

Example request

# HTTP request

POST https://api.line.me/v2/bot/group/{groupId}/leave

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

groupId

Group ID. Found in the source object of webhook event objects.

# Response

Returns the status code 200 and an empty JSON object.

Example response

# Room

# Get room member user IDs

Note

This feature is available only to verified or premium accounts. For more information about account types, see the LINE Account Connect page on the LINE for Business website.

Gets the user IDs of the members of a room that the LINE official account is in. This includes the user IDs of users who have not added the LINE official account as a friend or have blocked the LINE official account.

Example request

# HTTP request

GET https://api.line.me/v2/bot/room/{roomId}/members/ids

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

roomId

Required

Room ID. Found in the source object of webhook event objects.

# Query parameters

start

Optional

Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group.

# Response

Returns the status code 200 and a JSON object with the following properties.

memberIds

Array of strings

List of user IDs of the members in the room. Users of LINE version 7.4.x or earlier are not included in memberIds. For more information, see User consent.
Max: 100 user IDs

next

String

A continuation token to get the next array of user IDs of the members in the room. Returned only when there are remaining user IDs that were not returned in memberIds in the original request.

Example response

# Get room member profile

Gets the user profile of a member of a room that the LINE official account is in if the user ID of the room member is known. You can get user profiles of users who have not added the LINE official account as a friend or have blocked the LINE official account.

Example request

# HTTP request

GET https://api.line.me/v2/bot/room/{roomId}/member/{userId}

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

roomId

Room ID. Found in the source object of webhook event objects.

userId

User ID. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.

# Response

Returns the status code 200 and a JSON object with the following information.

displayName

String

Display name

userId

String

User ID

pictureUrl

String

Profile image URL

Example response

# Leave room

Leaves a room.

Example request

# HTTP request

POST https://api.line.me/v2/bot/room/{roomId}/leave

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

roomId

Room ID. Found in the source object of webhook event objects.

# Response

Returns the status code 200 and an empty JSON object.

Example response

# Rich menu

Note

Rich menus created using the Messaging API are only supported on LINE 7.14.0 and later for Android and iOS.

Customizable menu that is displayed on your LINE official account's chat screen. For more information, see Using rich menus.

# Create rich menu

Creates a rich menu.

You must upload a rich menu image, and set the rich menu as the default rich menu or link the rich menu to a user for the rich menu to be displayed. You can create up to 1000 rich menus for one LINE official account with the Messaging API.

Example request

# HTTP request

POST https://api.line.me/v2/bot/richmenu

# Request headers

Authorization

Bearer {channel access token}

Content-Type

application/json

# Request body

The rich menu represented as a rich menu object.

# Response

Returns the status code 200 and a JSON object with the rich menu ID.

Example response

# Upload rich menu image

Uploads and attaches an image to a rich menu.

You can use rich menu images with the following specifications:

  • Image format: JPEG or PNG
  • Image size (pixels): 2500x1686, 2500x843, 1200x810, 1200x405, 800x540, 800x270
  • Maximum file size: 1 MB

Note: You cannot replace an image attached to a rich menu. To update your rich menu image, create a new rich menu object and upload another image.

Example request

# HTTP request

POST https://api-data.line.me/v2/bot/richmenu/{richMenuId}/content

# Request headers

Authorization

Bearer {channel access token}

Content-Type

image/jpeg or image/png

Content-Length

The length of the request body in octets (8-bit bytes). Must be a non-negative value.

# Path parameters

richMenuId

Required

The ID of the rich menu to attach the image to

# Response

Returns the status code 200 and an empty JSON object.

Example response

# Download rich menu image

Downloads an image associated with a rich menu.

Example request

# HTTP request

GET https://api-data.line.me/v2/bot/richmenu/{richMenuId}/content

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

richMenuId

Required

ID of the rich menu with the image to be downloaded

# Response

Returns the status code 200 and the binary data of the rich menu image. The image can be downloaded as shown in the example request.

# Get rich menu list

Gets a list of the rich menu response object of all rich menus created by Create a rich menu.

Note

You can't retrieve rich menus created with LINE Official Account Manager.

Example request

# HTTP request

GET https://api.line.me/v2/bot/richmenu/list

# Request headers

Authorization

Bearer {channel access token}

# Response

Returns the status code 200 and a list of rich menu response objects.

richmenus

Array

Example response

# Get rich menu

Gets a rich menu via a rich menu ID.

Example request

# HTTP request

GET https://api.line.me/v2/bot/richmenu/{richMenuId}

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

richMenuId

Required

ID of a rich menu

# Response

Returns the status code 200 and a rich menu response object.

Example response

# Delete rich menu

Deletes a rich menu.

Rich menu limits

If you have reached the maximum of 1,000 rich menus with the Messaging API for your LINE official account, you must delete a rich menu before you can create a new one.

Example request

# HTTP request

DELETE https://api.line.me/v2/bot/richmenu/{richMenuId}

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

richMenuId

Required

ID of a rich menu

# Response

Returns the status code 200 and an empty JSON object.

Example response

# Set default rich menu

Sets the default rich menu. The default rich menu is displayed to all users who have added your LINE official account as a friend and are not linked to any per-user rich menu. If a default rich menu has already been set, calling this endpoint replaces the current default rich menu with the one specified in your request.

The rich menu is displayed in the following order of priority (highest to lowest):

  1. The per-user rich menu set with the Messaging API
  2. The default rich menu set with the Messaging API
  3. The default rich menu set with LINE Official Account Manager

Example request

# HTTP request

POST https://api.line.me/v2/bot/user/all/richmenu/{richMenuId}

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

richMenuId

Required

ID of a rich menu

# Response

Returns the status code 200 and an empty JSON object.

Example response

# Get default rich menu ID

Gets the ID of the default rich menu set with the Messaging API.

Example request

# HTTP request

GET https://api.line.me/v2/bot/user/all/richmenu

# Request headers

Authorization

Bearer {channel access token}

# Response

Returns the status code 200 and a JSON object with the rich menu ID.

Example response

# Cancel default rich menu

Cancels the default rich menu set with the Messaging API.

Example request

# HTTP request

DELETE https://api.line.me/v2/bot/user/all/richmenu

# Request headers

Authorization

Bearer {channel access token}

# Response

Returns the status code 200 and an empty JSON object.

Example response

Links a rich menu to a user. Only one rich menu can be linked to a user at one time. If a user already has a rich menu linked, calling this endpoint replaces the existing rich menu with the one specified in your request.

The rich menu is displayed in the following order of priority (highest to lowest):

  1. The per-user rich menu set with the Messaging API
  2. The default rich menu set with the Messaging API
  3. The default rich menu set with LINE Official Account Manager

Example request

# HTTP request

POST https://api.line.me/v2/bot/user/{userId}/richmenu/{richMenuId}

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

richMenuId

Required

ID of a rich menu

userId

Required

User ID. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.

# Response

Returns the status code 200 and an empty JSON object.

Example response

Links a rich menu to multiple users.

The rich menu is displayed in the following order of priority (highest to lowest):

  1. The per-user rich menu set with the Messaging API
  2. The default rich menu set with the Messaging API
  3. The default rich menu set with LINE Official Account Manager

Example request

# HTTP request

POST https://api.line.me/v2/bot/richmenu/bulk/link

# Request headers

Content-Type

application/json

Authorization

Bearer {channel access token}

# Request body

richMenuId

String

Required

ID of a rich menu

userIds

Array of strings

Required

Array of user IDs. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.
Max: 150 user IDs

# Response

Returns the status code 202 and an empty JSON object.

Unlike linking a rich menu to a user, this request is processed asynchronously in the background. Normally, the process is completed within a few seconds.

To verify whether the request was processed successfully, get the rich menu ID linked to the users and check if the rich menu is actually linked to the users.

Example response

# Get rich menu ID of user

Gets the ID of the rich menu linked to a user.

Example request

# HTTP request

GET https://api.line.me/v2/bot/user/{userId}/richmenu

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

userId

Required

User ID. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.

# Response

Returns the status code 200 and a JSON object with the rich menu ID.

Example response

Unlinks a rich menu from a user.

Example request

# HTTP request

DELETE https://api.line.me/v2/bot/user/{userId}/richmenu

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

userId

Required

User ID. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.

# Response

Returns the status code 200 and an empty JSON object.

Example response

Unlinks rich menus from multiple users.

Example request

# HTTP request

POST https://api.line.me/v2/bot/richmenu/bulk/unlink

# Request headers

Content-Type

application/json

Authorization

Bearer {channel access token}

# Request body

userIds

Array of strings

Required

Array of user IDs. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.
Max: 150 user IDs

# Response

Returns the status code 202 and an empty JSON object.

Unlike unlinking a rich menu from a user, this request is processed asynchronously in the background. Normally, the process is completed within a few seconds.

To verify whether the request was processed successfully, get the rich menu ID linked to the users and check if the unlinked rich menus are actually not linked to the users.

Example response

# Get follower IDs

Note

This feature is available only to verified or premium accounts. For more information about account types, see the LINE Account Connect page on the LINE for Business website.

Gets the user IDs of users who have added the LINE official account as a friend (followers).

Example request

# HTTP request

GET https://api.line.me/v2/bot/followers/ids

# Request headers

Content-Type

application/json

Authorization

Bearer {channel access token}

# Query parameters

start

Optional

Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs.

# Response

Returns the status code 200 and a JSON object with the following properties.

userIds

Array of string

List of user IDs of users that have added the LINE official account as a friend. Users of LINE version 7.4.x or earlier are not included in userIds. For more information, see User consent.
Max: 300 user IDs

next

String

A continuation token to get the next array of user IDs. Returned only when there are remaining user IDs that were not returned in userIds in the original request. The number of user IDs in the userIds element does not have to reach 300 for the next property to be included in the response.

Example response

Issues a link token used for the account link feature.

Example request

# HTTP request

POST https://api.line.me/v2/bot/user/{userId}/linkToken

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

userId

Required

User ID for the LINE account to be linked. Found in the source object of account link event objects. Do not use the LINE ID used in LINE.

# Response

Returns the status code 200 and a link token. Link tokens are valid for 10 minutes and can only be used once.

Note: The validity period may change without notice.

Example response

# Message objects

JSON object which contains the contents of the message you send.

# Common properties for messages

The following properties can be specified in all the message objects.

# Quick reply

These properties are used for the quick reply feature. Supported on LINE 8.11.0 and later for iOS and Android. For more information, see Using quick replies.

quickReply

Object

Optional

If the user receives multiple message objects, the quickReply property of the last message object is displayed.

# items object

This is a container that contains quick reply buttons.

items

Array of objects

Required

Example items object

# Quick reply button object

This is a quick reply option that is displayed as a button.

type

String

Required

action

imageUrl

String

Optional

URL of the icon that is displayed at the beginning of the button

  • Max character limit: 1000
  • URL scheme: https
  • Image format: PNG
  • Aspect ratio: 1:1
  • Data size: Up to 1 MB

There is no limit on the image size.
If the action property has a camera action, camera roll action, or location action, and the imageUrl property is not set, the default icon is displayed.

action

Object

Required

Action performed when this button is tapped. Specify an action object. The following is a list of the available actions:

If a version of LINE that doesn't support the quick reply feature receives a message that contains quick reply buttons, only the message is displayed.

# Text message

type

String

Required

text

text

String

Required

Message text. You can include the following emoji:

Max character limit: 2000

Text message example

Text message example with emoji

{
    "type": "text",
    "text": "\uDBC0\uDC84 LINE emoji"
}

# Sticker message

type

String

Required

sticker

packageId

String

Required

Package ID for a set of stickers. For information on package IDs, see the Sticker list.

stickerId

String

Required

Sticker ID. For a list of sticker IDs for stickers that can be sent with the Messaging API, see the Sticker list.

Sticker message example

# Image message

type

String

Required

image

originalContentUrl

String

Required

Image URL (Max character limit: 1000)
HTTPS over TLS 1.2 or later
JPEG
Max: 4096 x 4096
Max: 1 MB

previewImageUrl

String

Required

Preview image URL (Max character limit: 1000)
HTTPS over TLS 1.2 or later
JPEG
Max: 240 x 240
Max: 1 MB

Image message example

# Video message

type

String

Required

video

originalContentUrl

String

Required

URL of video file (Max character limit: 1000)
HTTPS over TLS 1.2 or later
mp4
Max: 1 minute
Max: 10 MB

A very wide or tall video may be cropped when played in some environments.

previewImageUrl

String

Required

URL of preview image (Max character limit: 1000)
HTTPS over TLS 1.2 or later
JPEG
Max: 240 x 240
Max: 1 MB

Video message example

# Audio message

type

String

Required

audio

originalContentUrl

String

Required

URL of audio file (Max character limit: 1000)
HTTPS over TLS 1.2 or later
m4a
Max: 1 minute
Max: 10 MB

duration

Number

Required

Length of audio file (milliseconds)

Audio message example

# Location message

type

String

Required

location

title

String

Required

Title
Max character limit: 100

address

String

Required

Address
Max character limit: 100

latitude

Decimal

Required

Latitude

longitude

Decimal

Required

Longitude

Location message example

# Imagemap message

Imagemap messages are messages configured with an image that has multiple tappable areas. You can assign one tappable area for the entire image or different tappable areas on divided areas of the image.

You can also play a video on the image and display a label with a hyperlink after the video is finished.

type

String

Required

imagemap

baseUrl

String

Required

Base URL of the image
Max character limit: 1000
HTTPS over TLS 1.2 or later
For more information about supported images in imagemap messages, see How to configure an image.

altText

String

Required

Alternative text
Max character limit: 400

baseSize.width

Number

Required

Width of base image in pixels. Set to 1040.

baseSize.height

Number

Required

Height of base image. Set to the height that corresponds to a width of 1040 pixels.

video.originalContentUrl

String

URL of the video file (Max character limit: 1000)
HTTPS over TLS 1.2 or later
mp4
Max: 1 minute
Max: 10 MB

Note: A very wide or tall video may be cropped when played in some environments.

video.previewImageUrl

String

URL of the preview image (Max character limit: 1000)
HTTPS over TLS 1.2 or later
JPEG
Max: 240 x 240 pixels
Max: 1 MB

video.area.x

Number

Horizontal position of the video area relative to the left edge of the imagemap area. Value must be 0 or higher.

video.area.y

Number

Vertical position of the video area relative to the top of the imagemap area. Value must be 0 or higher.

video.area.width

Number

Width of the video area

video.area.height

Number

Height of the video area

video.externalLink.linkUri

String

Webpage URL. Called when the label displayed after the video is tapped.
Max character limit: 1000
The available schemes are http, https, line, and tel. For more information about the LINE URL scheme, see Using the LINE URL scheme.

video.externalLink.label

String

Label. Displayed after the video is finished.
Max character limit: 30

actions

Array of imagemap action objects

Required

Action when tapped
Max: 50

*1 This property is required if you set a video to play on the imagemap.
*2 This property is required if you set a video to play and a label to display after the video on the imagemap.

Imagemap message example with two tappable areas

# How to configure an image

Images used in imagemap messages must meet the following requirements.

  • Image format: JPEG or PNG
  • Image width: 240px, 300px, 460px, 700px, 1040px
  • Maximum file size: Up to 1 MB

Make it possible to access images of 5 different sizes using the baseUrl/{image width} URL format. LINE will then download an image at the appropriate resolution based on the device.

For example, if we had a base URL of https://example.com/images/cats, the URL for the image with a width of 700px would be https://example.com/images/cats/700. To confirm all images display properly, access the image URLs.

Image width Example URL
240px https://example.com/bot/images/rm001/240
300px https://example.com/bot/images/rm001/300
460px https://example.com/bot/images/rm001/460
700px https://example.com/bot/images/rm001/700
1040px https://example.com/bot/images/rm001/1040
Exclude image extension from URL

Don't include the extension in the image filename. The image will not display in the imagemap message if the URL contains the image file extension (e.g. https://example.com/bot/images/rm001/700.png).

# Imagemap action objects

Object which specifies the actions and tappable areas of an imagemap.

When an area is tapped, the user is redirected to the URI specified in uri and the message specified in message is sent.

# Imagemap URI action object

type

String

Required

uri

label

String

Optional

Label for the action. Spoken when the accessibility feature is enabled on the client device.
Max character limit: 50
Supported on LINE 8.2.0 and later for iOS.

linkUri

String

Required

Webpage URL
Max character limit: 1000
The available schemes are http, https, line, and tel. For more information about the LINE URL scheme, see Using the LINE URL scheme.

area

Defined tappable area

Example imagemap URI action object

# Imagemap message action object

type

String

Required

message

label

String

Optional

Label for the action. Spoken when the accessibility feature is enabled on the client device.
Max character limit: 50
Supported on LINE 8.2.0 and later for iOS.

text

String

Required

Message to send
Max character limit: 400
Supported on LINE for iOS and Android only.

area

Defined tappable area

Example imagemap message action object

# Imagemap area object

Defines the size of a tappable area. The top left is used as the origin of the area. Set these properties based on the baseSize.width property and the baseSize.height property.

x

Number

Required

Horizontal position relative to the left edge of the area. Value must be 0 or higher.

y

Number

Required

Vertical position relative to the top of the area. Value must be 0 or higher.

width

Number

Required

Width of the tappable area

height

Number

Required

Height of the tappable area

Example imagemap area object

# Template messages

Note

Template messages are only supported on LINE 6.7.0 and later for iOS and Android.

Template messages are messages with predefined layouts which you can customize. For more information, see template messages.

The following template types are available:

# Common properties of template message objects

The following properties are common to all template message objects.

type

String

Required

template

altText

String

Required

Alternative text.
Max character limit: 400

template

Object

Required

# Buttons template

Template with an image, title, text, and multiple action buttons.

type

String

Required

buttons

thumbnailImageUrl

String

Optional

Image URL (Max character limit: 1000)
HTTPS over TLS 1.2 or later
JPEG or PNG
Max width: 1024px
Max: 1 MB

imageAspectRatio

String

Optional

Aspect ratio of the image. Specify one of the following values:

  • rectangle: 1.51:1
  • square: 1:1

The default value is rectangle.

imageSize

String

Optional

Size of the image. Specify one of the following values:

  • cover: The image fills the entire image area. Parts of the image that do not fit in the area are not displayed.
  • contain: The entire image is displayed in the image area. A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images.

The default value is cover.

imageBackgroundColor

String

Optional

Background color of image. Specify a RGB color value. The default value is #FFFFFF (white).

title

String

Optional

Title
Max character limit: 40

text

String

Required

Message text
Max character limit: 160 (no image or title)
Max character limit: 60 (message with an image or title)

defaultAction

Action object

Optional

Action when image is tapped; set for the entire image, title, and text area

actions

Array of action objects

Required

Action when tapped
Max: 4

Buttons template message example

# Confirm template

Template with two action buttons.

type

String

Required

confirm

text

String

Required

Message text
Max character limit: 240

actions

Array of action objects

Required

Action when tapped
Set 2 actions for the 2 buttons

Confirm template message example

Template with multiple columns which can be cycled like a carousel. The columns will be shown in order by scrolling horizontally.

type

String

Required

carousel

columns

Array of column objects

Required

Array of columns
Max: 10

imageAspectRatio

String

Optional

Aspect ratio of the image. Specify one of the following values:

  • rectangle: 1.51:1
  • square: 1:1

Applies to all columns. The default value is rectangle.

imageSize

String

Optional

Size of the image. Specify one of the following values:

  • cover: The image fills the entire image area. Parts of the image that do not fit in the area are not displayed.
  • contain: The entire image is displayed in the image area. A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images.

Applies to all columns. The default value is cover.

Carousel template message example

thumbnailImageUrl

String

Optional

Image URL (Max character limit: 1000)
HTTPS over TLS 1.2 or later
JPEG or PNG
Aspect ratio: 1:1.51
Max width: 1024px
Max: 1 MB

imageBackgroundColor

String

Optional

Background color of image. Specify a RGB color value. The default value is #FFFFFF (white).

title

String

Optional

Title
Max character limit: 40

text

String

Required

Message text
Max character limit: 120 (no image or title)
Max character limit: 60 (message with an image or title)

defaultAction

Action object

Optional

Action when image is tapped; set for the entire image, title, and text area

actions

Array of action objects

Required

Action when tapped
Max: 3

Template with multiple images which can be cycled like a carousel. The images will be shown in order by scrolling horizontally.

type

String

Required

image_carousel

columns

Array of column objects

Required

Array of columns
Max: 10

Image carousel template message example

imageUrl

String

Required

Image URL (Max character limit: 1000)
HTTPS over TLS 1.2 or later
JPEG or PNG
Aspect ratio: 1:1
Max width: 1024px
Max: 1 MB

action

Action object

Required

Action when image is tapped

# Flex Message

Flex Messages are messages with a customizable layout. You can customize the layout freely based on the specification for CSS Flexible Box (CSS Flexbox). For more information, see Using Flex Messages in the API documentation.

type

String

Required

flex

altText

String

Required

Alternative text
Max character limit: 400

contents

Object

Required

Flex Message container

Flex Message example

# Container

A container is the top-level structure of a Flex Message. Here are the types of containers available:

For JSON samples and usage of containers, see Flex Message elements in the API documentation.

# Bubble

This is a container that contains one message bubble. It can contain four blocks: header, hero, body, and footer. For more information about using each block, see Block in the API documentation.

The maximum size of JSON data that defines a bubble is 10 KB.

type

String

Required

bubble

size

String

Optional

The size of the bubble. You can specify one of the following values: nano, micro, kilo, mega, or giga. The default value is mega.

direction

String

Optional

Text directionality and the direction of placement of components in horizontal boxes. Specify one of the following values:

  • ltr: The text is left-to-right horizontal writing, and the components are placed from left to right
  • rtl: The text is right-to-left horizontal writing, and the components are placed from right to left

The default value is ltr.

header

Object

Optional

Header block. Specify a Box.

hero

Object

Optional

Hero block. Specify a box or an image.

body

Object

Optional

Body block. Specify a Box.

footer

Object

Optional

Footer block. Specify a Box.

styles

Object

Optional

Style of each block. Specify a bubble style.

action

Object

Optional

Action performed when this image is tapped. Specify an action object. This property is supported on the following versions of LINE.

  • LINE for iOS and Android: 8.11.0 and later

Bubble example

# Objects for the block style

Use the following two objects to define the style of blocks in a bubble.

Example of a bubble style and block style

# Bubble style

header

Object

Optional

Header block. Specify a block style.

hero

Object

Optional

Hero block. Specify a block style.

body

Object

Optional

Body block. Specify a block style.

footer

Object

Optional

Footer block. Specify a block style.

# Block style

backgroundColor

String

Optional

Background color of the block. Use a hexadecimal color code.

separator

Boolean

Optional

true to place a separator above the block. The default value is false.

separatorColor

String

Optional

Color of the separator. Use a hexadecimal color code.

Note

You cannot place a separator above the first block.

A carousel is a container that contains multiple bubbles as child elements. Users can scroll horizontally through the bubbles.

The maximum size of JSON data that defines a carousel is 50 KB.

type

String

Required

carousel

contents

Array of objects

Required

Bubbles in the carousel. Max: 10 bubbles

Bubble width

A carousel cannot contain bubbles of different widths (size property). Each bubble in a carousel should have the same width.

Bubble height

The body of each bubble will stretch to match the bubble with the greatest height in the carousel. However, bubbles with no body will not change height.

Carousel example

# Component

Components are elements that make up a block. Here are the types of components available:

For JSON samples and usage of each component, see Flex Message elements and Flex Message layout in the API documentation.

# Box

This is a component that defines the layout of child components. You can also include a box in a box.

type

String

Required

box

layout

String

Required

The layout style of components in this box. For more information, see Direction of placing components in the API documentation.

contents

Array of objects

Required

Components in this box. Here are the types of components available:

Components are rendered in the order specified in the array.

backgroundColor

String

Optional

Background color of the block. In addition to the RGB color, an alpha channel (transparency) can also be set. Use a hexadecimal color code. (Example:#RRGGBBAA) The default value is #00000000.

borderColor

String

Optional

Color of box border. Use a hexadecimal color code.

borderWidth

String

Optional

Width of box border. You can specify a value in pixels or any one of none, light, normal, medium, semi-bold, or bold. none does not render a border while the others become wider in the order of listing.

cornerRadius

String

Optional

Radius at the time of rounding the corners of the border. You can specify a value in pixels or any one of none, xs, sm, md, lg, xl, or xxl. none does not round the corner while the others increase in radius in the order of listing. The default value is none.

width

String

Optional

Width of the box. For more information, see Width of a box in the API documentation.

height

String

Optional

Height of the box. For more information, see Height of a box in the API documentation.

flex

Number

Optional

The ratio of the width or height of this component within the parent box. For more information, see Width and height of components.

spacing

String

Optional

Minimum space between components in this box. The default value is none. For more information, see spacing property of the box in the API documentation.

margin

String

Optional

Minimum space between this component and the previous component in the parent element. For more information, see margin property of the component in the API documentation.

paddingAll

String

Optional

Free space between the borders of this box and the child element. For more information, see Box padding in the API documentation.

paddingTop

String

Optional

Free space between the border at the upper end of this box and the upper end of the child element. For more information, see Box padding in the API documentation.

paddingBottom

String

Optional

Free space between the border at the lower end of this box and the lower end of the child element. For more information, see Box padding in the API documentation.

paddingStart

String

Optional

Free space between the border at the left end of this box and the left end of the child element. For more information, see Box padding in the API documentation.

paddingEnd

String

Optional

Free space between the border at the right end of this box and the right end of the child element. For more information, see Box padding in the API documentation.

position

String

Optional

Reference position for placing this box. Specify one of the following values:

  • relative: Use the previous box as reference.
  • absolute: Use the top left of parent element as reference.

The default value is relative. For more information, see Offset in the API documentation.

offsetTop

String

Optional

The top offset. For more information, see Offset in the API documentation.

offsetBottom

String

Optional

The bottom offset. For more information, see Offset in the API documentation.

offsetStart

String

Optional

The left offset. For more information, see Offset in the API documentation.

offsetEnd

String

Optional

The right offset. For more information, see Offset in the API documentation.

action

Object

Optional

Action performed when this image is tapped. Specify an action object. This property is supported on the following versions of LINE.

  • LINE for iOS and Android: 8.11.0 and later

Box example

# Button

This component renders a button. When the user taps a button, a specified action is performed.

type

String

Required

button

action

Object

Required

Action performed when this button is tapped. Specify an action object.

flex

Number

Optional

The ratio of the width or height of this component within the parent box. For more information, see Width and height of components.

margin

String

Optional

Minimum space between this component and the previous component in the parent element. For more information, see margin property of the component in the API documentation.

position

String

Optional

Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd. Specify one of the following values:

  • relative: Use the previous box as reference.
  • absolute: Use the top left of parent element as reference.

The default value is relative. For more information, see Offset in the API documentation.

offsetTop

String

Optional

The top offset. For more information, see Offset in the API documentation.

offsetBottom

String

Optional

The bottom offset. For more information, see Offset in the API documentation.

offsetStart

String

Optional

The left offset. For more information, see Offset in the API documentation.

offsetEnd

String

Optional

The right offset. For more information, see Offset in the API documentation.

height

String

Optional

Height of the button. You can specify sm or md. The default value is md.

style

String

Optional

Style of the button. Specify one of the following values:

  • primary: Style for dark color buttons
  • secondary: Style for light color buttons
  • link: HTML link style

The default value is link.

color

String

Optional

Character color when the style property is link. Background color when the style property is primary or secondary. Use a hexadecimal color code.

gravity

String

Optional

Alignment style in vertical direction. For more information, see Alignment in vertical direction in the API documentation.

Button example

# Image

This component renders an image.

type

String

Required

image

url

String

Required

Image URL
Protocol: HTTPS over TLS 1.2 or later
Image format: JPEG or PNG
Maximum image size: 1024×1024 pixels
Maximum data size: 1 MB

flex

Number

Optional

The ratio of the width or height of this component within the parent box. For more information, see Width and height of components.

margin

String

Optional

Minimum space between this component and the previous component in the parent element. For more information, see margin property of the component in the API documentation.

position

String

Optional

Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd. Specify one of the following values:

  • relative: Use the previous box as reference.
  • absolute: Use the top left of parent element as reference.

The default value is relative. For more information, see Offset in the API documentation.

offsetTop

String

Optional

The top offset. For more information, see Offset in the API documentation.

offsetBottom

String

Optional

The bottom offset. For more information, see Offset in the API documentation.

offsetStart

String

Optional

The left offset. For more information, see Offset in the API documentation.

offsetEnd

String

Optional

The right offset. For more information, see Offset in the API documentation.

align

String

Optional

Alignment style in horizontal direction. For more information, see Alignment in horizontal direction in the API documentation.

gravity

String

Optional

Alignment style in vertical direction. For more information, see Alignment in vertical direction in the API documentation.

size

String

Optional

Maximum size of the image width. You can specify one of the following values: xxs, xs, sm, md, lg, xl, xxl, 3xl, 4xl, 5xl, or full. The size increases in the order of listing. The default value is md.

aspectRatio

String

Optional

Aspect ratio of the image. {width}:{height} format. Specify the value of {width} and {height} in the range from 1 to 100000. However, you cannot set {height} to a value that is more than three times the value of {width}. The default value is 1:1.

aspectMode

String

Optional

The display style of the image if the aspect ratio of the image and that specified by the aspectRatio property do not match. For more information, see About the drawing area.

backgroundColor

String

Optional

Background color of the image. Use a hexadecimal color code.

action

Object

Optional

Action performed when this image is tapped. Specify an action object.

Image example

# About the drawing area

Specify the max width of the image with the size property and the aspect ratio (horizontal-to-vertical ratio) of the image with the aspectRatio property. The rectangular area determined by the size and aspectRatio properties is called the drawing area. The image is rendered in this drawing area.

  • If the image width specified by the flex property is larger than that calculated from the size property, the width of the drawing area is scaled down to the width of the component.
  • If the aspect ratio of the image and that specified by the aspectRatio property do not match, the image is displayed according to the aspectMode property. The default value is fit.
    • If the value of aspectMode is cover: The image fills the entire drawing area. Parts of the image that do not fit in the drawing area are not displayed.
    • If the value of aspectMode is fit: The entire image is displayed in the drawing area. The background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images.
# Icon

This component renders an icon for decorating the adjacent text.

This component can be used only in a baseline box.

type

String

Required

icon

url

String

Required

Image URL
Protocol: HTTPS over TLS 1.2 or later
Image format: JPEG or PNG
Maximum image size: 1024×1024 pixels
Maximum data size: 1 MB

margin

String

Optional

Minimum space between this component and the previous component in the parent element. For more information, see margin property of the component in the API documentation.

position

String

Optional

Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd. Specify one of the following values:

  • relative: Use the previous box as reference.
  • absolute: Use the top left of parent element as reference.

The default value is relative. For more information, see Offset in the API documentation.

offsetTop

String

Optional

The top offset. For more information, see Offset in the API documentation.

offsetBottom

String

Optional

The bottom offset. For more information, see Offset in the API documentation.

offsetStart

String

Optional

The left offset. For more information, see Offset in the API documentation.

offsetEnd

String

Optional

The right offset. For more information, see Offset in the API documentation.

size

String

Optional

Maximum size of the icon width. You can specify one of the following values: xxs, xs, sm, md, lg, xl, xxl, 3xl, 4xl, or 5xl. The size increases in the order of listing. The default value is md.

aspectRatio

String

Optional

Aspect ratio of the icon. {width}:{height} format. The values of {width} and {height} must be in the range 1–100000. {height} can't be more than three times the value of {width}. The default value is 1:1.

The icon's flex property is fixed to 0.

Icon example

# Text

This component renders a text string in one row. You can specify font color, size, and weight.

type

String

Required

text

text

String

Required

Text Be sure to set either one of the text property or contents property. If you set the contents property, text is ignored.

contents

Array of objects

Optional

Array of spans. Be sure to set either one of the text property or contents property. If you set the contents property, text is ignored.

flex

Number

Optional

The ratio of the width or height of this component within the parent box. For more information, see Width and height of components.

margin

String

Optional

Minimum space between this component and the previous component in the parent element. For more information, see margin property of the component in the API documentation.

position

String

Optional

Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd. Specify one of the following values:

  • relative: Use the previous box as reference.
  • absolute: Use the top left of parent element as reference.

The default value is relative. For more information, see Offset in the API documentation.

offsetTop

String

Optional

The top offset. For more information, see Offset in the API documentation.

offsetBottom

String

Optional

The bottom offset. For more information, see Offset in the API documentation.

offsetStart

String

Optional

The left offset. For more information, see Offset in the API documentation.

offsetEnd

String

Optional

The right offset. For more information, see Offset in the API documentation.

size

String

Optional

Font size. You can specify one of the following values: xxs, xs, sm, md, lg, xl, xxl, 3xl, 4xl, or 5xl. The size increases in the order of listing. The default value is md.

align

String

Optional

Alignment style in horizontal direction. For more information, see Alignment in horizontal direction in the API documentation.

gravity

String

Optional

Alignment style in vertical direction. The default value is top. For more information, see Alignment in vertical direction in the API documentation.

wrap

Boolean

Optional

true to wrap text. The default value is false. If set to true, you can use a new line character (\n) to begin on a new line. For more information, see Wrapping text in the API documentation.

maxLines

Number

Optional

Max number of lines. If the text does not fit in the specified number of lines, an ellipsis (…) is displayed at the end of the last line. If set to 0, all the text is displayed. The default value is 0. This property is supported on the following versions of LINE.

  • LINE for iOS and Android: 8.11.0 and later

weight

String

Optional

Font weight. You can specify one of the following values: regular or bold. Specifying bold makes the font bold. The default value is regular.

color

String

Optional

Font color. Use a hexadecimal color code.

action

Object

Optional

Action performed when this image is tapped. Specify an action object.

style

String

Optional

Style of the text. Specify one of the following values:

  • normal: Normal
  • italic: Italic

The default value is normal.

decoration

String

Optional

Decoration of the text. Specify one of the following values:

  • none: No decoration
  • underline: Underline
  • line-through: Strikethrough

The default value is none.

Text example

# Span

This component renders multiple text strings with different designs in one row. You can specify the color, size, weight, and decoration for the font. Span is set to contents property in Text.

type

String

Required

span

text

String

Required

Text. If the wrap property of the parent text is set to true, you can use a new line character (\n) to begin on a new line.

color

String

Optional

Font color. Use a hexadecimal color code.

size

String

Optional

Font size. You can specify one of the following values: xxs, xs, sm, md, lg, xl, xxl, 3xl, 4xl, or 5xl. The size increases in the order of listing. The default value is md.

weight

String

Optional

Font weight. You can specify one of the following values: regular or bold. Specifying bold makes the font bold. The default value is regular.

style

String

Optional

Style of the text. Specify one of the following values:

  • normal: Normal
  • italic: Italic

The default value is normal.

decoration

String

Optional

Decoration of the text. Specify one of the following values:

  • none: No decoration
  • underline: Underline
  • line-through: Strikethrough

The default value is none.
Note: The decoration set in the decoration property of the text cannot be overwritten by the decoration property of the span.

Span example

# Separator

This component renders a separating line within a box. A vertical line will be rendered in a horizontal box and a horizontal line will be rendered in a vertical box.

type

String

Required

separator

margin

String

Optional

Minimum space between this component and the previous component in the parent element. For more information, see margin property of the component in the API documentation.

color

String

Optional

Color of the separator. Use a hexadecimal color code.

Separator example

# Filler

This component is used to create a space. You can put a space between, before, or after components by inserting a filler anywhere within a box.

type

String

Required

filler

flex

Number

Optional

The ratio of the width or height of this component within the parent box. For more information, see Width and height of components.

The spacing property of the parent element will be ignored for fillers.

Filler example

# Spacer (not recommended)
Note

The spacer will be removed in a future release. We recommend setting the padding of the box without using a spacer. For more information, see Box padding in the API documentation.

This is an invisible component that places a fixed-size space at the beginning or end of the box.

type

String

Required

spacer

size

String

Required

Size of the space. You can specify one of the following values: xs, sm, md, lg, xl, or xxl. The size increases in the order of listing. The default value is md.

The spacing property of the parent element will be ignored for spacers.

Spacer example

# Action objects

These are types of actions for your bot to take when a user taps a button or an image in a message.

# Postback action

When a control associated with this action is tapped, a postback event is returned via webhook with the specified string in the data property.

type

String

Required

postback

label

String

Label for the action

  • Required for templates other than image carousel. Max character limit: 20
  • Optional for image carousel templates. Max character limit: 12
  • Optional for rich menus. Spoken when the accessibility feature is enabled on the client device. Max character limit: 20. Supported on LINE 8.2.0 and later for iOS.
  • Required for quick reply buttons. Max character limit: 20. Supported on LINE 8.11.0 and later for iOS and Android.
  • Required for the button of Flex Message. This property can be specified for the box, image, and text but its value is not displayed. Max character limit: 20

data

String

Required

String returned via webhook in the postback.data property of the postback event
Max character limit: 300

displayText

String

Text displayed in the chat as a message sent by the user when the action is performed. Required for quick reply buttons. Optional for the other message types.
Max character limit: 300
The displayText and text properties cannot both be used at the same time.

text

String

Optional

【Deprecated】 Text displayed in the chat as a message sent by the user when the action is performed. Returned from the server through a webhook. This property shouldn't be used with quick reply buttons.
Max character limit: 300
The displayText and text properties cannot both be used at the same time.

Example postback action object

# Message action

When a control associated with this action is tapped, the string in the text property is sent as a message from the user.

type

String

Required

message

label

String

Label for the action

  • Required for templates other than image carousel. Max character limit: 20
  • Optional for image carousel templates. Max character limit: 12
  • Optional for rich menus. Spoken when the accessibility feature is enabled on the client device. Max character limit: 20. Supported on LINE 8.2.0 and later for iOS.
  • Required for quick reply buttons. Max character limit: 20. Supported on LINE 8.11.0 and later for iOS and Android.
  • Required for the button of Flex Message. This property can be specified for the box, image, and text but its value is not displayed. Max charater limit: 20

text

String

Required

Text sent when the action is performed
Max character limit: 300

Example message action object

# URI action

When a control associated with this action is tapped, the URI specified in the uri property is opened.

type

String

Required

uri

label

String

Label for the action

  • Required for templates other than image carousel. Max character limit: 20
  • Optional for image carousel templates. Max character limit: 12
  • Optional for rich menus. Spoken when the accessibility feature is enabled on the client device. Max character limit: 20. Supported on LINE 8.2.0 and later for iOS.
  • Required for the button of Flex Message. This property can be specified for the box, image, and text but its value is not displayed. Max character limit: 20

uri

String

Required

URI opened when the action is performed (Max character limit: 1000)
The available schemes are http, https, line, and tel. For more information about the LINE URL scheme, see Using the LINE URL scheme.

altUri.desktop

String

Optional

URI opened on LINE for macOS and Windows when the action is performed (Max character limit: 1000)
If the altUri.desktop property is set, the uri property is ignored on LINE for macOS and Windows.
The available schemes are http, https, line, and tel. For more information about the LINE URL scheme, see Using the LINE URL scheme. This property is supported on the following version of LINE.

  • LINE 5.12.0 or later for macOS and Windows

Note: The altUri.desktop property is supported only when you set URI actions in Flex Messages.

Example URI action object

# Datetime picker action

When a control associated with this action is tapped, a postback event is returned via webhook with the date and time selected by the user from the date and time selection dialog. The datetime picker action does not support time zones.

type

String

Required

datetimepicker

label

String

Label for the action

  • Required for templates other than image carousel. Max character limit: 20
  • Optional for image carousel templates. Max character limit: 12
  • Optional for rich menus. Spoken when the accessibility feature is enabled on the client device. Max character limit: 20. Supported on LINE 8.2.0 and later for iOS.
  • Required for quick reply buttons. Max character limit: 20. Supported on LINE 8.11.0 and later for iOS and Android.
  • Required for the button of Flex Message. This property can be specified for the box, image, and text but its value is not displayed. Max character limit: 20

data

String

Required

String returned via webhook in the postback.data property of the postback event
Max character limit: 300

mode

String

Required

Action mode
date: Pick date
time: Pick time
datetime: Pick date and time

initial

String

Optional

Initial value of date or time

max

String

Optional

Largest date or time value that can be selected. Must be greater than the min value.

min

String

Optional

Smallest date or time value that can be selected. Must be less than the max value.

Example datetime picker action object

# Date and time format

The date and time formats for the initial, max, and min values are shown below. The full-date, time-hour, and time-minute formats follow the RFC3339 protocol.

Mode Format Example
date full-date
Max: 2100-12-31
Min: 1900-01-01
2017-06-18
time time-hour:time-minute
Max: 23:59
Min: 00:00
00:00
06:15
23:59
datetime full-dateTtime-hour:time-minute or full-datettime-hour:time-minute
Max: 2100-12-31T23:59
Min: 1900-01-01T00:00
2017-06-18T06:15
2017-06-18t06:15

# Camera action

This action can be configured only with quick reply buttons. When a button associated with this action is tapped, the camera screen in LINE is opened.

type

String

Required

camera

label

String

Required

Label for the action
Max character limit: 20

Example camera action object

# Camera roll action

This action can be configured only with quick reply buttons. When a button associated with this action is tapped, the camera roll screen in LINE is opened.

type

String

Required

cameraRoll

label

String

Required

Label for the action
Max character limit: 20

Example camera roll action object

# Location action

This action can be configured only with quick reply buttons. When a button associated with this action is tapped, the location screen in LINE is opened.

type

String

Required

location

label

String

Required

Label for the action
Max character limit: 20

Example location action object

# Rich menu structure

Rich menus consist of either of these objects.

Area objects and action objects are included in these objects.

# Rich menu object

size

Object

Required

size object which contains the width and height of the rich menu displayed in the chat. Rich menu images must be one of the following sizes (pixels): 2500x1686, 2500x843, 1200x810, 1200x405, 800x540, 800x270

selected

Boolean

Required

true to display the rich menu by default. Otherwise, false.

name

String

Required

Name of the rich menu. This value can be used to help manage your rich menus and is not displayed to users.
Max character limit: 300

chatBarText

String

Required

Text displayed in the chat bar
Max character limit: 14

areas

Array

Required

Array of area objects which define the coordinates and size of tappable areas
Max: 20 area objects

Example rich menu object

# Rich menu response object

richMenuId

String

ID of a rich menu

size

Object

size object which contains the width and height of the rich menu displayed in the chat. Rich menu images must be one of the following sizes (pixels): 2500x1686, 2500x843, 1200x810, 1200x405, 800x540, 800x270

selected

Boolean

true to display the rich menu by default. Otherwise, false.

name

String

Name of the rich menu. This value can be used to help manage your rich menus and is not displayed to users.
Max character limit: 300

chatBarText

String

Text displayed in the chat bar
Max character limit: 14

areas

Array

Array of area objects which define the coordinates and size of tappable areas
Max: 20 area objects

Example rich menu response object

# size object

width

Number

Required

Width of the rich menu. Must be 2500.

height

Number

Required

Height of the rich menu. Possible values: 1686, 843.

Example size object

# Area object

bounds

Object

Required

Object describing the boundaries of the area in pixels. See bounds object.

action

Object

Required

Action performed when the area is tapped. See action objects.

Example area object

# bounds object

x

Number

Required

Horizontal position of the top-left corner of the tappable area relative to the left edge of the image. Value must be 0 or higher.

y

Number

Required

Vertical position of the top-left corner of the tappable area relative to the left edge of the image. Value must be 0 or higher.

width

Number

Required

Width of the tappable area.

height

Number

Required

Height of the tappable area.

Example bounds object