페이지 이동경로
  • Docs>
  • Kakao Story>
  • REST API

Kakao Story

REST API

This document describes how to integrate Kakao Story APIs into your service with a REST API.

You can test the features described in this document in [Tools] > [REST API Test].

Tag used in this document

Tag Description
Login required The API marked with this tag requires Kakao Login. You must implement the Kakao Login function first, and then call the corresponding API by using the access token issued when a user logs in.
Consent required To use the API marked with this tag, you must enable a specific scope required for the corresponding API.
In addition, a user must also consent to the scope. Otherwise, an error occurs or empty value is returned. To check which scopes a user has consented to, you can call the Retrieving consent details API.

Validate Kakao Story user Login required

This API checks if the user who is currently logged in is using Kakao Story.

Include the access token in the request header, and send a GET request.

If the request is successful, the API returns isStoryUser in JSON format. If its value is true, the user is using Kakao Story. If the user is not using Kakao Story, false is returned so that you can take action to prevent an error that occurs when calling Kakao Story APIs for the user.

Request

URL
GET /v1/api/story/isstoryuser HTTP/1.1
Host: kapi.kakao.com
Authorization: Bearer ${ACCESS_TOKEN}

Response

Name Type Description Required
isStoryUser Boolean Whether to use Kakao Story. If true, the currently logged-in user is a Kakao Story user. O

Sample

Request
curl -v -X GET "https://kapi.kakao.com/v1/api/story/isstoryuser" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}"
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
  "isStoryUser":true
}

Retrieve Kakao Story profile Login required Consent required

This API enables you to retrieve the Kakao Story profile information of the user who is currently logged in.

The user's profile data returned in response to this API may differ depending on a user's consent. To check the required user consent for each data, refer to the Response table below.

Users can set their desired profile nicknames and images for Kakao Story, Kakao Talk, and Kakao Account respectively. Thus, profile information retrieved through this API is different from the ones obtained through the Retrieving user information or Retrieving Kakao Talk profile API.

Include the access token in the request header, and send a GET request. If the request is successful, the Kakao Story profile information is returned in JSON format.

Request

URL
GET /v1/api/story/profile HTTP/1.1
Host: kapi.kakao.com
Authorization: Bearer ${ACCESS_TOKEN}

Response

Name Type Description Required
nickName String Kakao Story nickname.

Required user consent: Profile Info(nickname/profile image) or Nickname
X
profileImageUrl String Kakao Story profile image URL with a size of 480x480 pixels to 1024x1024 pixels.

Required user consent: Profile Info(nickname/profile image) or Profile image
X
thumbnailUrl String Kakao Story thumbnail profile image URL with a size of 160x213 pixels.
Image size can be changed within the range of 160x213 pixels.

Required user consent: Profile Info(nickname/profile image) or Profile image
X
bgImageURL String Kakao Story background image URL with a size of 480x480 pixels to 1024x1024 pixels.

Required user consent: Profile Info(nickname/profile image) or Profile image
X
permalink String Kakao Story profile URL.

Required user consent: KakaoStory profile URL

NOTE: From June 1, 2021, only when a user consents to 'KakaoStory profile URL(story_permalink)', the Retrieving Kakao Story profile API returns 'permalink' in the response. For more details, see Notice.
X
birthday String Birthday registered in Kakao Story in MMdd format.

Required user consent: Birthday
X
birthdayType String Solar or Lunar birthday.
SOLAR or LUNAR

Required user consent: Birthday
X
IMPORTANT: Providing separated scopes for profile information

From June 25, 2021, we provide the profile information separated as 'Nickname' and 'Profile image'. You can request consent to desired profile information by setting desired scopes respectively. If you create a new app, the separated scopes for profile information are applied to the app. If you have enabled the 'Profile Info(nickname/profile image)' scope, you can continue to use that scope. In this case, you do not need to change the app settings, and there is no change in API response. But if you want to use the new scpes in the existing app, fill out the request form. In this case, the API response may change. Refer to Notice for more details.

Sample

Request
curl -v -X GET "https://kapi.kakao.com/v1/api/story/profile" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}"
Response: Success, if user consents to 'Profile(nickname/profile image)' only
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
  "nickName":"Ryan",
  "profileImageURL":"https://xxx.kakao.com/.../aaa.jpeg",
  "thumbnailURL":"https://xxx.kakao.com/.../bbb.jpeg",
  "bgImageURL":"https://xxx.kakao.co.kr/.../ccc.jpg"
} 
Response: Success, if user consents to 'Nickname' only
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
  "nickName":"Ryan"
} 
Response: Success, if user consents to 'Profile image' only
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
  "profileImageURL":"https://xxx.kakao.com/.../aaa.jpeg",
  "thumbnailURL":"https://xxx.kakao.com/.../bbb.jpeg",
  "bgImageURL":"https://xxx.kakao.co.kr/.../ccc.jpg"
} 
Response: Success, if user consents to 'Profile Info(nickname/profile image)' and 'Birthday'
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
  "nickName":"Ryan",
  "profileImageURL":"https://xxx.kakao.com/.../aaa.jpeg",
  "thumbnailURL":"https://xxx.kakao.com/.../bbb.jpeg",
  "bgImageURL":"https://xxx.kakao.co.kr/.../ccc.jpg",
  "birthday":"1231",
  "birthdayType":"SOLAR"
}
Response: Success, if user consents to 'KakaoStory profile URL' only
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
  "permalink": "https://story.kakao.com/XXXXX"
}
Response: Fail, if user consents to none of required consent items
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{}
Response: Fail, if the user's account is not linked to Kakao Story
HTTP/1.1 400 Bad Request 
{
  "msg": "NotExistStoryUserException",
  "code": -601
}

Post story Login required Consent required

This API enables you to post a new story on Kakao Story of the user who is currently logged in. This API supports three types of stories — text, photo, and link. Make sure that depending on the story types, the request parameters are different.

To use this API,

  • You must enable the 'Publish posts in KakaoStory' scope in [My Application] > [Kakao Login] > [Consent items].
  • A user must consent to the scope. Otherwise, an error occurs.

To post a photo story, you must get the required value using the Uploading image API in advance. For a link story, get the required value using the Scraping web page API in advance. After that, use the value obtained through each API as it is when you request to write a photo or link story. If not, an error occurs.

If the request is successful, the created story ID is returned with the HTTP status code 200.

Request

Story Type
Type Description
Text Story with text only.
Photo Story with text and photos.
Link Story with text and the information obtained by scrapping a web page.
URL: Posting text story
POST /v1/api/story/post/note HTTP/1.1
Host: kapi.kakao.com
Authorization: Bearer ${ACCESS_TOKEN}
Content-Type: application/x-www-form-urlencoded;charset=utf-8
URL: Posting photo story
POST /v1/api/story/post/photo HTTP/1.1
Host: kapi.kakao.com
Authorization: Bearer ${ACCESS_TOKEN}
Content-Type: application/x-www-form-urlencoded;charset=utf-8
URL: Posting link story
POST /v1/api/story/post/link HTTP/1.1
Host: kapi.kakao.com
Authorization: Bearer ${ACCESS_TOKEN}
Parameter
Name Type Description Required
permission String Audience for the story.
One of F (Friends only), A (Public), and M (Private).
(Default: A)
X
enable_share Boolean Whether to share the story when permission is set to F (Friends only).
(Default: false)
X
android_exec_param String Parameter to be added to the URL to execute an Android app when selecting the [View on app] button from Kakao Story. X
ios_exec_param String Parameter to be added to the URL to execute an iOS app when selecting the [View on app] button from Kakao Story. X
android_market_param String Parameter to be added to the execution URL when redirecting to an open market from Kakao Story. X
ios_market_param String Parameter to be added to the execution URL when redirecting to the App Store from Kakao Story. X
Execution URL

The execution URL works only when each platform is registered in [My Application] > [Platform]. Also, if the open market or App Store URL is not specified, the [Go to the App] button does not work. To see how to register platforms, refer to Register a platform. The default URL format you can refer is as follows:

Execution URL: kakao[Native App Key]://kakaostory Android Market URL: market://details?id=[android package name] iOS Market URL: https://itunes.apple.com/app/[App Store ID]

Parameter: Text story
Name Type Description Required
content String Text to be input in the story.
Up to 2048 characters are allowed.
O
Parameter: Photo story
Name Type Description Required
content String Text to be input in the story.
Up to 2048 characters are allowed.
X
image_url_list String[] The path, width and height of the uploaded image obtained through the Uploading image API. O
Parameter: Link story
Name Type Description Required
content String Text to be input in the story.
Up to 2048 characters are allowed.
X
link_info LinkInfo The web page information that is obtained through the Scraping web page API. O

Response

Name Type Description Required
id String ID of the uploaded story. O

Sample

Request: Posting text story
curl -v -X POST "https://kapi.kakao.com/v1/api/story/post/note" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer ${ACCESS_TOKEN}" \
 --data-urlencode "content=This cafe is really awesome\!" \
 --data-urlencode "android_exec_param=cafe_id=1234" \
 --data-urlencode "ios_exec_param=cafe_id=1234"
Request: Posting photo story
curl -v -X POST "https://kapi.kakao.com/v1/api/story/post/photo" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer ${ACCESS_TOKEN}" \
 -d "permission=F" \
 -d "enable_share=true" \
 --data-urlencode "content=This cafe is really awesome\!" \
 --data-urlencode "image_url_list=['/aaa/bbb/img1.jpg?width=6200&height=3100','/aaa/ddd/img2.jpg?width=6200&height=3100']"
Request: Posting link story
curl -v -X POST "https://kapi.kakao.com/v1/api/story/post/link" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  --data-urlencode 'link_info={
                             "url":"https://developers.kakao.com/",
                             "requested_url":"http://bit.ly/1wwLqDl",
                             "host":"developers.kakao.com",
                             "title":"Kakao Developers_",
                             "image":["http://dn-l1-story.kakao.co.kr/dn/bc995u/hydnh8wbKi/dz59YCCjyZSXNmDgTPpPa0/img.jpg?height=630&width=1200"],
                             "description":"더 나은 세상을 꿈꾸고 그것을 현실로 만드는 이를 위하여 카카오에서 앱 개발 플랫폼 서비스를 시작합니다.",
                             "section":"",
                             "type":"website"
                            }' \
  --data-urlencode "content=better than expected!\"
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
    "id":"AAAAAAA.BBBBBBBBBBB"
}

Retrieve story Login requiredConsent required

This API enables you to retrieve story information on Kakao Story of the user currently logged in. You can request basic information about the multiple recent stories or a specific story only by specifying a story ID. When requesting a specific story, you can get detailed information about the story, including comments.

To use this API,

  • You must enable the 'Read access to KakaoStory posts' scope in [My Application] > [Kakao Login] > [Consent items].
  • A user must consent to the 'Read access to KakaoStory posts' scope. Otherwise, an error occurs.

You can use this API in either way:

  • Retrieve specific story information by specifying the story ID obtained by requesting to retrieve multiple stories.
  • Retrieve information of the recent stories by retrieving multiple stories.

Depending on whether you request a single story or multiple stories, the request parameters you need to pass are different. If you want to request to get the specified story, you must pass id of the story. In this case, the response includes the contents and the comments of the story.

On the other hand, when requesting multiple stories, you do not need to pass id in the request. In this case, the response includes only the number of comments and likes. To get information of the recent stories from a specific story, pass last_id.

If the request is successful, the story information is returned in JSON format.

Request

URL: Retrieving specified story
GET /v1/api/story/mystory HTTP/1.1
Host: kapi.kakao.com
Authorization: Bearer ${ACCESS_TOKEN}
URL: Retrieving multiple stories
GET /v1/api/story/mystories HTTP/1.1
Host: kapi.kakao.com
Authorization: Bearer ${ACCESS_TOKEN}
Parameter: Retrieving specified story
Name Type Description Required
id String Story ID to be retrieved. O
Parameter: Retrieving multiple stories
Name Type Description Required
last_id String Set the last (latest) story ID among the stories that you want to retrieve.
The stories from the specified story to the oldest stories are returned, excluding the specified story ID.
If not specified, all stories from recent to oldest are returned, which is set as a default.
X

Response

Name Type Description Required
id String Story ID. O
url String Story URL. O
media_type String Story type.
One of PHOTO (photo), NOTE (text), NOT_SUPPORTED (not supported).
X
media StoryMedia[] URLs by image size.
Only returned if media_type is PHOTO.
X
created_at Datetime The time when the story is posted in RFC3339 internet date/time format. O
comment_count Integer Number of comments. O
like_count Integer Number of moods that the user's friends left. O
content String Story content. X
comments StoryComments[] List of comments consisting of text (content) and writer (the user who left the comment).
* Not supported in the Retrieving multiple stories API.
X
likes StoryLikes[] List of moods consisting of emotion (mood emoji) and actor (the user who left the mood).
* Not supported in the Retrieving multiple stories API.
X
permission String Audience for the story.
- PUBLIC: Open to all.
- FRIEND: Open to only friends.
- ONLY_ME: Open to only me (Private).
(Default: PUBLIC)
X
comments
Name Type Description Required
text String Comment content. O
writer StoryActor User who left a comment.
Consists of display_name (user's Kakao Story nickname) and profile_thumbnail_url (user's Kakao Story profile thumbnail URL).
O
likes
Name Type Description Required
emotion String Mood left in a story.
One of LIKE, COOL, HAPPY, SAD, CHEER_UP, NOT_DEFINED.
O
actor StoryActor User who left the mood.
Consists of display_name (user's Kakao Story nickname) and profile_thumbnail_url (user's Kakao Story profile thumbnail URL).
O

Sample

Request: Retrieving specified story
curl -v -G GET "https://kapi.kakao.com/v1/api/story/mystory" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -d "id={STORY_ID}"
Request: Retrieving multiple stories
curl -v -G GET "https://kapi.kakao.com/v1/api/story/mystories" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -d "last_id={STORY_ID}"
Response: Retrieving specified story
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
    "id": "AAAAAAA.CCCCCCCCCCC",
    "url": "http://story-web.kakao.com/AAAAAAA/CCCCCCCCCCC",
    "media_type": "PHOTO",
    "created_at": "2014-06-13T07:58:20Z",
    "comment_count": 1,
    "like_count": 1,
    "content": "This cafe is really awesome!",
    "media": [
        {
            "original":"http://xxx.kakao.co.kr/.../img.png?width=150&height=150",
            "xlarge":"http://xxx.kakao.co.kr/.../img_xl.jpg?width=150&height=150",
            "large":"http://xxx.kakao.co.kr/.../img_l.jpg?width=150&height=150",
            "medium":"http://xxx.kakao.co.kr/.../img_m.jpg?width=150&height=150",
            "small":"http://xxx.kakao.co.kr/.../img_s.jpg?width=150&height=150"
        }
    ],
      "comments": [
        {
          "text": "여기 위치가 어디?",
          "writer": {
            "display_name": "한여름",
            "profile_thumbnail_url": "http://xxxx.kakao.co.kr/.../ABCDEFG.jpeg"
          }
        }
      ],
      "likes": [
        {
          "emotion": "COOL",
          "actor": {
            "display_name": "여바다",
            "profile_thumbnail_url": "http://xxxx.kakao.co.kr/.../1234566.jpeg"
          }
        }
      ]
}
Response: Retrieving multiple stories
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
[
    {
        "id": "AAAAAAA.BBBBBBBBBBB",
        "url": "http://story-web.kakao.com/AAAAAAA/BBBBBBBBBBB",
        "media_type": "NOT_SUPPORTED",
        "created_at": "2014-06-13T07:58:26Z",
        "comment_count": 3,
        "like_count": 4,
        "content": "better than expected!"
    },
    {
        "id": "AAAAAAA.CCCCCCCCCCC",
        "url": "http://story-web.kakao.com/AAAAAAA/CCCCCCCCCCC",
        "media_type": "PHOTO",
        "created_at": "2014-06-13T07:58:20Z",
        "comment_count": 1,
        "like_count": 1,
        "content": "This cafe is really awesome!",
        "media": [
            {
                "original":"http://xxx.kakao.com/.../img.png?width=150&height=150",
                "xlarge":"http://xxx.kakao.com/.../img_xl.jpg?width=150&height=150",
                "large":"http://xxx.kakao.com/.../img_l.jpg?width=150&height=150",
                "medium":"http://xxx.kakao.com/.../img_m.jpg?width=150&height=150",
                "small":"http://xxx.kakao.com/.../img_s.jpg?width=150&height=150"
            }
        ]
    },
    {
        "id": "AAAAAAA.DDDDDDDDD",
        "url": "http://story-web.kakao.com/AAAAAAA/DDDDDDDDD",
        "media_type": "NOTE",
        "created_at": "2014-06-13T07:58:17Z",
        "comment_count": 0,
        "like_count": 10,
        "content": "A Rainbow - William Wordsworth\n\n..."
    },
    ...
]

Deleting story Login required

This API enables you to delete a story on Kakao Story by specifying a story ID.

Include the access token in the request header and the story ID to be deleted as a query string, and send a DELETE request.

If the request is successful, the API returns the HTTP status code 200 only without the response body.

Request

URL
DELETE /v1/api/story/delete/mystory HTTP/1.1
Host: kapi.kakao.com
Authorization: Bearer ${ACCESS_TOKEN}
Parameter
Name Type Description Required
id String Story ID to be deleted. O

Sample

Request
curl -v -X DELETE "https://kapi.kakao.com/v1/api/story/delete/mystory?id={STORY_ID}" \
     -H "Authorization: Bearer ${ACCESS_TOKEN}"
Response
HTTP/1.1 200 OK
Content-Length: 0
Content-type: application/json;charset=UTF-8

Upload image Login required

Before posting a photo story, you must upload an image file in advance and get the uploaded image URI value. With the uploading image function, you can upload an image to the Kakao platform and use the path where the image is uploaded when you request to post a photo story.

When it comes to the image to be uploaded, its size must be less than 10 MB, and you cannot upload more than 10 images. If the image file type is a GIF file, you can only upload a single image.

When you send a POST request, include the access token in the request header and the binary of the file to be uploaded in the file field.

If the request is successful, the API returns the path, width, and height of the uploaded image in the response body. You must use the same values obtained through this API when you request to post a photo story.

Request

URL
POST /v1/api/story/upload/multi HTTP/1.1
Host: kapi.kakao.com
Authorization: Bearer ${ACCESS_TOKEN}
Content-Type: multipart/form-data; boundary=---------------------------012345678901234567890123456
Parameter
Name Type Description Required
file binary[] File binary to upload, including filename in Content-Disposition. O
File parameter rules

The file name must start with 'file' and comply with the Multipart standard. Examples: file[0], file[1], file1

Response

Name Type Description Required
path String Path, width and height of the uploaded image. O

Sample

Image Data Info
---------------------------012345678901234567890123456
Content-Disposition: form-data; name="file"; filename="your_image.jpg"
Content-Type: image/jpeg

...
---------------------------012345678901234567890123456
Request: HTTP
curl -v -X POST "https://kapi.kakao.com/v1/api/story/upload/multi" \
  -H "Content-Type: multipart/form-data" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  -F "file=@/aaaa/bbbb/cccc/0.jpg" \
  -F "file=@/aaaa/bbbb/dddd/0.jpg"
Request: PHP
<?php
   $uploadfile1="your_example_image_1.jpg";
   $uploadfile2="your_example_image_2.jpg";
   $ch = curl_init("https://kapi.kakao.com/v1/api/story/upload/multi");
   curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer ${ACCESS_TOKEN}"));
   curl_setopt($ch, CURLOPT_POSTFIELDS, array('file[0]'=>"@$uploadfile1", 'file[1]'=>"@$uploadfile2"));
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   $postResult = curl_exec($ch);
   curl_close($ch);
   print "$postResult";
?>
Request: Python
import requests

upload_photo_url = 'https://kapi.kakao.com/v1/api/story/upload/multi'
post_photo_url = 'https://kapi.kakao.com/v1/api/story/post/photo'

files = {'file': open('your_picture.jpeg', 'rb')}

token = 'YOUR TOKEN HERE'
headers = {'Authorization': 'Bearer {0}'.format(token)}

upload_result = requests.post(upload_photo_url, headers=headers, files=files)

post_photo_payload = {'image_url_list': upload_result.text}
post_result = requests.post(post_photo_url, headers=headers, data=post_photo_payload)

print post_result
Request: Java
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;

public class MultiUploadTest {

    private final static String STORY_UPLOAD_MULTI_URL
            = "https://kapi.kakao.com/v1/api/story/upload/multi";

    private final static String ACCESS_TOKEN = "[ACCESS_TOKEN]";

    public static void main(String[] args) {
        String uploadedImageUrlList = uploadMulti(
                new File[]{
                        new File("/root/sample1.png"),
                        new File("/root/sample2.png")
                });

        System.out.println(uploadedImageUrlList);

        // result
        // [
        //   "/M9qi0/hygv5qpDce/jQiFgjJYUWkXoskTO8m8F0/img.png?width=160&height=160",
        //   "/cpYIJ1/hygwaZyfQl/4PjHIHrS1SlwmZWd17Vje0/img.png?width=314&height=306"
        // ]
    }

    public static String uploadMulti(File[] files) {

        if (files.length == 0)
            return null;

        String CRLF = "\r\n";
        String TWO_HYPHENS = "--";
        String BOUNDARY = "---------------------------012345678901234567890123456";
        HttpsURLConnection conn = null;
        DataOutputStream dos = null;
        FileInputStream fis = null;

        int bytesRead, bytesAvailable, bufferSize;
        byte[] buffer;
        int MAX_BUFFER_SIZE = 1 * 1024 * 1024;

        // Request
        try {
            URL url = new URL(STORY_UPLOAD_MULTI_URL);
            conn = (HttpsURLConnection) url.openConnection();
            conn.setDoInput(true);
            conn.setDoOutput(true);
            conn.setUseCaches(false);
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Connection", "Keep-Alive");
            conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" +
                                      BOUNDARY);
            conn.setRequestProperty("Authorization", "Bearer " + ACCESS_TOKEN);
            conn.setRequestProperty("Cache-Control", "no-cache");

            dos = new DataOutputStream(conn.getOutputStream());

            for (File f : files) {
                dos.writeBytes(TWO_HYPHENS + BOUNDARY + CRLF);
                dos.writeBytes("Content-Disposition: form-data; name=\"file\";" +
                                " filename=\"" + f.getName() + "\"" + CRLF);
                dos.writeBytes(CRLF);
                fis = new FileInputStream(f);
                bytesAvailable = fis.available();
                bufferSize = Math.min(bytesAvailable, MAX_BUFFER_SIZE);
                buffer = new byte[bufferSize];
                bytesRead = fis.read(buffer, 0, bufferSize);
                while (bytesRead > 0) {
                    dos.write(buffer, 0, bufferSize);
                    bytesAvailable = fis.available();
                    bufferSize = Math.min(bytesAvailable, MAX_BUFFER_SIZE);
                    bytesRead = fis.read(buffer, 0, bufferSize);
                }
                dos.writeBytes(CRLF);
            }

            // finish delimiter
            dos.writeBytes(TWO_HYPHENS + BOUNDARY + TWO_HYPHENS + CRLF);

            fis.close();
            dos.flush();
            dos.close();

        } catch (MalformedURLException ex) {
            ex.printStackTrace();
        } catch (IOException ioe) {
            ioe.printStackTrace();
        } finally {
            if (fis != null) try { fis.close(); } catch (IOException ignore) { }
            if (dos != null) try { dos.close(); } catch (IOException ignore) { }
        }

        // Response
        InputStream inputStream = null;
        BufferedReader reader = null;
        try {
            inputStream = new BufferedInputStream(conn.getInputStream());
            reader = new BufferedReader(new InputStreamReader(inputStream));
            String line;
            StringBuilder builder = new StringBuilder();
            while ((line = reader.readLine()) != null) {
                builder.append(line).append("\n");
            }
            reader.close();
            return builder.toString();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try { reader.close(); } catch (IOException ignore) {}
            }
            if (inputStream != null) {
                try { inputStream.close(); } catch (IOException ignore) {}
            }
            conn.disconnect();
        }

        return null;
    }
}
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
[
    "/aaaaa/bBbbbBbbbB/CCcCcC1ccCCcCCCCCCcc1c/img.png?width=150&height=150",
    "/aaaaaa/bBbbbbbBbBb/dDdDDDDDddddDdddddDDDDDd/img.jpg?width=1080&height=1920"
]

Scrape web page Login required

Before posting a link story, you must scrape a web page in advance and get the URL of the web page. The web page is scraped based on the Open Graph Protocol. You must not pass an arbitrary URL to post a link story.

Send a GET request with the URL to be scrapped.

If the request is successful, the API returns the information of the scraped web page in JSON format.

Request

URL
GET /v1/api/story/linkinfo HTTP/1.1
Host: kapi.kakao.com
Authorization: Bearer ${ACCESS_TOKEN}
Parameter
Name Type Description Required
url String URL of the web page to be scraped. O

Response

Name Type Description Required
url String URL of the scraped web page.
If a short URL is used for url in the request, the actual URL is passed.
X
requested_url String URL passed when requesting to scrap a web page. X
host String URL Host. X
title String Web page title. X
image String[] URL of a representative image of the web page.
Up to three images are allowed.
X
description String Web page description. X
section String Section information on a web page. X
type String Type of content included on the web page such as "website", "video", and "music". X

Sample

Request
curl -v -G GET "https://kapi.kakao.com/v1/api/story/linkinfo" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    --data-urlencode "url=http://bit.ly/1wwLqDl"
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
  "url":"https://developers.kakao.com/",
  "requested_url":"http://bit.ly/1wwLqDl",
  "host":"developers.kakao.com",
  "title":"Kakao Developers",
  "image":["http://dn-l1-story.kakao.co.kr/dn/bc995u/hydnh8wbKi/dz59YCCjyZSXNmDgTPpPa0/img.jpg?height=630&width=1200"],
  "description":"Kakao respects creative developers who are willing to venture out and add value to the technology. We hope to make the world a better place through creativity and innovation, allowing exclusive and easy access to our technology and services.",
  "section":"",
  "type":"website"
}

See more