Social API v2.0 reference

OAuth

Verify access token

Verifies the access token

HTTP request

POST https://api.line.me/v2/oauth/verify

Request header

Request header Description
Content-Type application/x-www-form-urlencoded

Request body

Property Type Description
access_token String Access token

Example request

curl -v -X POST https://api.line.me/v2/oauth/verify \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'access_token={access token}'
// No sample code available
# No sample code available
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Property Type Description
scope String Permissions obtained through the access token.
client_id String Channel ID for which the access token is issued.
expires_in Number Expiration date of the access token. Expressed as the remaining number of seconds to expiry from when the API was called.

Example response

{
   "scope":"P",
   "client_id":"1350031035",
   "expires_in":2591965
}

Refresh access token

Gets a new access token using a refresh token. Refresh tokens are returned with the access token when the user authorizes your app.

Note: This is the reference for the v2 endpoint. For information on the v2.1 endpoint, see Refresh access token.

Note: Cannot be used to refresh channel access tokens which are used for the Messaging API.

HTTP request

POST https://api.line.me/v2/oauth/accessToken

Request header

Request header Description
Content-Type application/x-www-form-urlencoded

Request body

Property Type Description
grant_type String refresh_token
refresh_token String Refresh token. Valid up until 10 days after the access token expires. You must log in the user again if the refresh token expires.
client_id String Channel ID. Found on the console.
client_secret String Channel secret. Found on the console.

Response

Example request

curl -v -X POST https://api.line.me/v2/oauth/accessToken \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'client_id={channel ID}' \
--data-urlencode 'client_secret={channel secret}' \
--data-urlencode 'refresh_token={refresh token}'

The response is returned in JSON.

Property Type Description
token_type String Bearer
scope String Permissions obtained through the access token.
accessToken String Access token
expires_in Number Expiration date of the access token. Expressed in the remaining number of seconds to expiry from when the API was called.
refresh_token String Token used to get a new access token. Valid up until 10 days after the access token expires.

Example response

{
   "token_type":"Bearer",
   "scope":"P",
   "access_token":"bNl4YEFPI/hjFWhTqexp4MuEw...",
   "expires_in":2591977,
   "refresh_token":"8iFFRdyxNVNLWYeteMMJ"
}

Revoke access token

Invalidates the access token.

Note: This is the reference for the v2 endpoint. For information on the v2.1 endpoint, see Revoke access token.

Note: Cannot be used to invalidate channel access tokens which are used for the Messaging API

HTTP request

POST https://api.line.me/v2/oauth/revoke

Request header

Request header Description
Content-Type application/x-www-form-urlencoded

Request body

Property Type Description
refresh_token String Refresh token

Response

Returns the status code 200 and an empty response body.

Example request

curl -v -X POST https://api.line.me/v2/oauth/revoke \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'refresh_token={refresh token}'

Profile

Get user profile

Gets a user's display name, profile image, and status message.

Note: Requires an access token with the profile scope. For more information, see Making an authorization request and Scopes.

HTTP request

GET https://api.line.me/v2/profile

Request header

Request header Description
Authorization Bearer {access token}

Example request

curl -v -X GET https://api.line.me/v2/profile \
-H 'Authorization: Bearer {access token}'
// No sample code available
# No sample code available
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Property Type Description
displayName String User's display name
userId String Identifier of the user
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

{
  "userId":"U4af4980629...",
  "displayName":"Brown",
  "pictureUrl":"https://example.com/abcdefghijklmn",
  "statusMessage":"Hello, LINE!"
}

Profile image thumbnail

You can change the user's profile image size by adding a suffix to the URL.

Image size Suffix
200 x 200 /large
51 x 51 /small

Example profile image URL

https://obs.line-apps.com/abcdefghijklmn/large

Errors

Status codes

The following HTTP status codes are returned after an API call.

Status code Description
200 OK Request successful
400 Bad Request Problem with the request. Check the request parameters and JSON format.
401 Unauthorized Check that the authorization header is correct.
403 Forbidden Not authorized to use the API. Confirm that your account or plan is authorized to use the API.
429 Too Many Requests Make sure that you are within the rate limits for requests.
500 Internal Server Error Temporary error on the API server.