REST API (version 1)

ここで解説するREST API 1は2013/3/5以降使用できなくなるため、API 1.1へ移行すべきです。Overview: Version 1.1 of the Twitter API | Twitter Developers

REST APIにより、ユーザー情報などのTwitterの基本情報へアクセスできます。なお認可が必要なメソッドでは、先にそれを取得する必要があります。

実行例

Exploring the Twitter APIで、さまざまなAPIの動作を確認できます。

Timelines (タイムライン)

メソッド パス 説明 認可
GET statuses/home_timeline 認可ユーザーおよびフォローしているユーザーの最近のツイートを取得する。これはtwitter.comにログインしたときに表示されるタイムラインと同一のもの。
(statuses/friends_timelineとは、リツイートを含む点を除いて同一)
Yes
GET statuses/mentions Returns the 20 most recent mentions (status containing @username) for the authenticating user. The timeline returned is the equivalent of the one seen when you view your mentions on twitter.com. This method can only return up to 800 statuses. If include_rts is set only 800 statuses, including... Yes
GET statuses/retweeted_by_me Returns the 20 most recent retweets posted by the authenticating user. Yes
GET statuses/retweeted_to_me Returns the 20 most recent retweets posted by users the authenticating user follow. Yes
GET statuses/retweets_of_me Returns the 20 most recent tweets of the authenticated user that have been retweeted by others. Yes
GET statuses/user_timeline 認可ユーザーの最近のツイートを取得する。また表示名やIDから、他のユーザーのタイムラインも取得できる。 Supported
GET statuses/retweeted_to_user Returns the 20 most recent retweets posted by users the specified user follows. The user is specified using the user_id or screen_name parameters. This method is identical to statuses/retweeted_to_me except you can choose the user to view. Supported
GET statuses/retweeted_by_user Returns the 20 most recent retweets posted by the specified user. The user is specified using the user_id or screen_name parameters. This method is identical to statuses/retweeted_by_me except you can choose the user to view. Does not require authentication, unless the user is protected. Supported

Twitter ヘルプセンター | タイムラインとは ?

Tweets (ツイート)

メソッド パス 説明 認可
GET statuses/:id/retweeted_by Show user objects of up to 100 members who retweeted the status. Supported
GET statuses/:id/retweeted_by/ids Show user ids of up to 100 users who retweeted the status. Yes
GET statuses/retweets/:id Returns up to 100 of the first retweets of a given tweet. Yes
GET statuses/show/:id 指定IDのツイートを取得する。 No
POST statuses/destroy/:id 指定IDのツイートを削除する。削除できるツイートは、認可ユーザーがツイートしたものに限られる。 Yes
POST statuses/retweet/:id Retweets a tweet. Returns the original tweet with retweet details embedded. Yes
POST statuses/update 認可ユーザーからツイートする。 Yes
POST statuses/update_with_media メディアを添付して、認可ユーザーからツイートする。 Yes
GET statuses/oembed Returns information allowing the creation of an embedded representation of a Tweet on third party sites. See the oEmbed specification for information about the response format. While this endpoint allows a bit of customization for the final appearance of the embedded Tweet, be aware that the... Supported

Reply (返信)

メソッド パス 説明 認可
GET related_results/show 指定IDへの返信を取得する。 No

Search (検索)

メソッド パス 説明 認可
GET search クエリに一致するツイートを取得する。これはSearch APIと同一。 No

Direct Messages (ダイレクトメッセージ)

メソッド パス 説明 認可
GET direct_messages Returns the 20 most recent direct messages sent to the authenticating user. The XML and JSON versions include detailed information about the sender and recipient user. Important: This method requires an access token with RWD (read, write... Yes
GET direct_messages/sent Returns the 20 most recent direct messages sent by the authenticating user. The XML and JSON versions include detailed information about the sender and recipient user. Important: This method requires an access token with RWD (read, write... Yes
POST direct_messages/destroy/:id Important: This method requires an access token with RWD (read, write... Yes
POST direct_messages/new Sends a new direct message to the specified user from the authenticating user. Requires both the user and text parameters and must be a POST. Returns the sent message in the requested format if successful. Yes
GET direct_messages/show/:id Returns a single direct message, specified by an id parameter. Like the /1/direct_messages.format request, this method will include the user objects of the sender and recipient. Important: This method requires an access token with RWD (read, write... Yes

Twitter ヘルプセンター | DM (ダイレクトメッセージ) とは?

Friends & Followers (友達 & フォロワー)

メソッド パス 説明 認可
GET followers/ids Returns an array of numeric IDs for every user following the specified user. This method is powerful when used in conjunction with users/lookup. Supported
GET friends/ids Returns an array of numeric IDs for every user the specified user is following. This method is powerful when used in conjunction with users/lookup. Supported
GET friendships/exists Test for the existence of friendship between two users. Will return true if user_a follows user_b, otherwise will return false. Authentication is required if either user A or user B are protected. Additionally the authenticating user must be a follower of the protected user. Consider using... Supported
GET friendships/incoming Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user. Yes
GET friendships/outgoing Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request. Yes
GET friendships/show Returns detailed information about the relationship between two users. Supported
POST friendships/create Allows the authenticating users to follow the user specified in the ID parameter. Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful. If you are already friends with the user a HTTP 403 may be returned, though for... Yes
POST friendships/destroy Allows the authenticating users to unfollow the user specified in the ID parameter. Returns the unfollowed user in the requested format when successful. Returns a string describing the failure condition when unsuccessful. Yes
GET friendships/lookup Returns the relationship of the authenticating user to the comma separated list of up to 100 screen_names or user_ids provided. Values for connections can be: following, following_requested, followed_by, none. Yes
POST friendships/update Allows one to enable or disable retweets and device notifications from the specified user. Yes
GET friendships/no_retweet_ids Returns an array of user_ids that the currently authenticated user does not want to see retweets from. Yes

Users (ユーザー)

メソッド パス 説明 認可
GET users/lookup Return up to 100 users worth of extended information, specified by either ID, screen name, or combination of the two. The author's most recent status (if the authenticating user has permission) will be returned inline. This method is crucial for consumers of the Streaming API. It's also well suited... Supported
GET users/profile_image/:screen_name Access the profile image in various sizes for the user with the indicated screen_name. If no size is provided the normal image is returned. This resource does not return JSON or XML, but instead returns a 302 redirect to the actual image resource. This method should only be used by application... No
GET users/search Runs a search for users similar to Find People button on Twitter.com. The results returned by people search on Twitter.com are the same as those returned by this API request. Note that unlike GET search, this method does not support any operators. Only the first 1000 matches are available. Yes
GET users/show Returns extended information of a given user, specified by ID or screen name as per the required id parameter. The author's most recent status will be returned inline. Supported
GET users/contributees Returns an array of users that the specified user can contribute to. Supported
GET users/contributors Returns an array of users who can contribute to the specified account. Supported

Suggested Users (おすすめユーザー)

メソッド パス 説明 認可
GET users/suggestions Access to Twitter's suggested user list. This returns the list of suggested user categories. The category can be used in GET users/suggestions/:slug to get the users in that category. No
GET users/suggestions/:slug Access the users in a given category of the Twitter suggested user list. It is recommended that end clients cache this data for no more than one hour. No
GET users/suggestions/:slug/members.format Access the users in a given category of the Twitter suggested user list and return their most recent status if they are not a protected user. No

Twitter ヘルプセンター | おすすめユーザー: フォローするユーザーを見つけましょう!

Favorites (お気に入り)

メソッド パス 説明 認可
GET favorites Returns the 20 most recent favorite statuses for the authenticating or specified user in the requested format. Yes
POST favorites/create/:id Favorites the status specified in the ID parameter as the authenticating user. Returns the favorite status when successful. This process invoked by this method is asynchronous. The immediately returned status may not indicate the resultant favorited status of the tweet. A 200 OK response from this... Yes
POST favorites/destroy/:id Un-favorites the status specified in the ID parameter as the authenticating user. Returns the un-favorited status in the requested format when successful. This process invoked by this method is asynchronous. The immediately returned status may not indicate the resultant favorited status of the... Yes

Twitter Help Center | お気に入りとは? (Internet Explorer)

Lists (リスト)

メソッド パス 説明 認可
GET lists/all Returns all lists the authenticating or specified user subscribes to, including their own. The user is specified using the user_id or screen_name parameters. If no user is given, the authenticating user is used. Supported
GET lists/statuses Returns tweet timeline for members of the specified list. Historically, retweets were not available in list timeline responses but you can now use the include_rts=true parameter to additionally receive retweet objects. Supported
POST lists/members/destroy Removes the specified member from the list. The authenticated user must be the list's owner to remove members from the list. Yes
GET lists/memberships Returns the lists the specified user has been added to. If user_id or screen_name are not provided the memberships for the authenticating user are returned. Supported
GET lists/subscribers Returns the subscribers of the specified list. Private list subscribers will only be shown if the authenticated user owns the specified list. Supported
POST lists/subscribers/create Subscribes the authenticated user to the specified list. Yes
GET lists/subscribers/show Check if the specified user is a subscriber of the specified list. Returns the user if they are subscriber. Yes
POST lists/subscribers/destroy Unsubscribes the authenticated user from the specified list. Yes
POST lists/members/create_all Adds multiple members to a list, by specifying a comma-separated list of member ids or screen names. The authenticated user must own the list to be able to add members to it. Note that lists can't have more than 500 members, and you are limited to adding up to 100 members to a list at a time with... Yes
GET lists/members/show Check if the specified user is a member of the specified list. Yes
GET lists/members Returns the members of the specified list. Private list members will only be shown if the authenticated user owns the specified list. Supported
POST lists/members/create Add a member to a list. The authenticated user must own the list to be able to add members to it. Note that lists can't have more than 500 members. Yes
POST lists/destroy Deletes the specified list. The authenticated user must own the list to be able to destroy it. Yes
POST lists/update Updates the specified list. The authenticated user must own the list to be able to update it. Yes
POST lists/create Creates a new list for the authenticated user. Note that you can't create more than 20 lists per account. Yes
GET lists Returns the lists of the specified (or authenticated) user. Private lists will be included if the authenticated user is the same as the user whose lists are being returned. Supported
GET lists/show Returns the specified list. Private lists will only be shown if the authenticated user owns the specified list. Supported
GET lists/subscriptions Obtain a collection of the lists the specified user is subscribed to, 20 lists per page by default. Does not include the user's own lists. Supported
POST lists/members/destroy_all Removes multiple members from a list, by specifying a comma-separated list of member ids or screen names. The authenticated user must own the list to be able to remove members from it. Note that lists can't have more than 500 members, and you are limited to removing up to 100 members to a list at a... Yes

Twitter ヘルプセンター | Twitterリストの使い方

Accounts (アカウント)

メソッド パス 説明 認可
GET account/rate_limit_status Returns the remaining number of API requests available to the requesting user before the API limit is reached for the current hour. Calls to rate_limit_status do not count against the rate limit. If authentication credentials are provided, the rate limit status for the authenticating user is... Supported
GET account/verify_credentials 認可が成功していればHTTP 200のステータス コードとユーザー情報を返す。さもなくば401のコードとエラーメッセージを返す。
(これはユーザーの認可が有効か検証するのに使用する)
Yes
POST account/end_session Ends the session of the authenticating user, returning a null cookie. Use this method to sign users out of client-facing applications like widgets. Yes
POST account/update_profile Sets values that users are able to set under the "Account" tab of their settings page. Only the parameters specified will be updated. Yes
POST account/update_profile_background_image Updates the authenticating user's profile background image. This method can also be used to enable or disable the profile background image. Although each parameter is marked as optional, at least one of image, tile or use must be provided when making this request. Yes
POST account/update_profile_colors Sets one or more hex values that control the color scheme of the authenticating user's profile page on twitter.com. Each parameter's value must be a valid hexidecimal value, and may be either three or six characters (ex: #fff or #ffffff). Yes
POST account/update_profile_image Updates the authenticating user's profile image. Note that this method expects raw multipart data, not a URL to an image. This method asynchronously processes the uploaded file before updating the user's profile image URL. You can either update your local cache the next time you request the user's... Yes
GET account/totals Returns the current count of friends, followers, updates (statuses) and favorites of the authenticating user. Yes
GET account/settings Returns settings (including current trend, geo and sleep time information) for the authenticating user. Yes
POST account/settings Updates the authenticating user's settings. Yes

Notification (通知)

メソッド パス 説明 認可
POST notifications/follow Enables device notifications for updates from the specified user. Returns the specified user when successful. Yes
POST notifications/leave Disables notifications for updates from the specified user to the authenticating user. Returns the specified user when successful. Yes

Saved Searches (保存された検索 : 検索メモ)

メソッド パス 説明 認可
GET saved_searches Returns the authenticated user's saved search queries. Yes
GET saved_searches/show/:id Retrieve the information for the saved search represented by the given id. The authenticating user must be the owner of saved search ID being requested. Yes
POST saved_searches/create Create a new saved search for the authenticated user. A user may only have 25 saved searches. Yes
POST saved_searches/destroy/:id Destroys a saved search for the authenticating user. The authenticating user must be the owner of saved search id being destroyed. Yes

Places & Geo (位置 & ジオ)

メソッド パス 説明 認可
GET geo/id/:place_id Returns all the information about a known place. No
GET geo/reverse_geocode Given a latitude and a longitude, searches for up to 20 places that can be used as a place_id when updating a status. This request is an informative call and will deliver generalized results about geography. No
GET geo/search Search for places that can be attached to a statuses/update. Given a latitude and a longitude pair, an IP address, or a name, this request will return a list of all the valid places that can be used as the place_id when updating a status. Conceptually, a query can be made from the user's location... No
GET geo/similar_places Locates places near the given coordinates which are similar in name. Conceptually you would use this method to get a list of known places to choose from first. Then, if the desired place doesn't exist, make a request to post/geo/place to create a new one. The token contained in the response is the... No
POST geo/place Creates a new place object at the given latitude and longitude. Before creating a place you need to query GET geo/similar_places with the latitude, longitude and name of the place you wish to create. The query will return an array of places which are similar to the one you wish to create, and a... Yes

Trends (トレンド)

メソッド パス 説明 認可
GET trends/:woeid Returns the top 10 trending topics for a specific WOEID, if trending information is available for it. The response is an array of "trend" objects that encode the name of the trending topic, the query parameter that can be used to search for the topic on Twitter Search, and the Twitter Search URL.... No
GET trends/available Returns the locations that Twitter has trending topic information for. The response is an array of "locations" that encode the location's WOEID and some other human-readable information such as a canonical name and country the location belongs in.

A WOEID is a Yahoo! Where On Earth ID.

No
GET trends/daily Returns the top 20 trending topics for each hour in a given day. No
GET trends/weekly Returns the top 30 trending topics for each day in a given week. No

Twitter ヘルプセンター | トレンドについて

Block (ブロック)

メソッド パス 説明 認可
GET blocks/blocking Returns an array of user objects that the authenticating user is blocking. Consider using GET blocks/blocking/ids with GET users/lookup instead of this method. Yes
GET blocks/blocking/ids Returns an array of numeric user ids the authenticating user is blocking. Yes
GET blocks/exists Returns if the authenticating user is blocking a target user. Will return the blocked user's object if a block exists, and error with a HTTP 404 response code otherwise. Yes
POST blocks/create Blocks the specified user from following the authenticating user. In addition the blocked user will not show in the authenticating users mentions or timeline (unless retweeted by another user). If a follow or friend relationship exists it is destroyed. Yes
POST blocks/destroy Un-blocks the user specified in the ID parameter for the authenticating user. Returns the un-blocked user in the requested format when successful. If relationships existed before the block was instated, they will not be restored. Yes

Twitter ヘルプセンター | 特定ユーザーをブロックするには

Spam Reporting (スパム報告)

メソッド パス 説明 認可
POST report_spam The user specified in the id is blocked by the authenticated user and reported as a spammer. Yes

Twitter ヘルプセンター | スパム報告について

OAuth

メソッド パス 説明 認可
GET oauth/authenticate Allows a Consumer application to use an OAuth request_token to request user authorization. This method is a replacement of Section 6.2 of the OAuth 1.0 authentication flow for applications using the callback authentication flow. The method will use the currently logged in user as the account for... Yes
GET oauth/authorize Allows a Consumer application to use an OAuth Request Token to request user authorization. This method fulfills Section 6.2 of the OAuth 1.0 authentication flow. Desktop applications must use this method (and cannot use GET oauth/authenticate). Please use HTTPS for this method, and all other OAuth... Yes
POST oauth/access_token Allows a Consumer application to exchange the OAuth Request Token for an OAuth Access Token. This method fulfills Section 6.3 of the OAuth 1.0 authentication flow. The OAuth access token may also be used for xAuth operations. Please use HTTPS for this method, and all other OAuth token negotiation... Yes
POST oauth/request_token Allows a Consumer application to obtain an OAuth Request Token to request user authorization. This method fulfills Section 6.1 of the OAuth 1.0 authentication flow. It is strongly recommended you use HTTPS for all OAuth authorization steps. Usage Note: Only ASCII values are accepted for the... No

Help (ヘルプ)

メソッド パス 説明 認可
GET help/test Returns the string "ok" in the requested format with a 200 OK HTTP status code. This method is great for sending a HEAD request to determine our servers current time. No
GET help/configuration Returns the current configuration used by Twitter including twitter.com slugs which are not usernames, maximum photo resolutions, and t.co URL lengths. It is recommended applications request this endpoint when they are loaded, but no more than once a day. No
GET help/languages Returns the list of languages supported by Twitter along with their ISO 639-1 code. The ISO 639-1 code is the two letter value to use if you include lang with any of your requests. No

Legal

メソッド パス 説明 認可
GET legal/privacy Returns Twitter's Privacy Policy in the requested format. No
GET legal/tos Returns the Twitter Terms of Service in the requested format. These are not the same as the Developer Rules of the Road. No

Deprecated (非推奨)

メソッド パス 説明 認可
DELETE :user/:list_id/members

This method is deprecated and has been replaced by POST lists/members/destroy. Please update your applications with the new endpoint.

Removes the specified member from the list. The authenticated user must be the list's owner to remove members from the list. Usage Note: clients who can not issue...
Yes
DELETE :user/:list_id/subscribers

This method is deprecated and has been replaced by POST lists/subscribers/destroy. Please update your applications with the new endpoint.

Unsubscribes the authenticated user form the specified list. Usage Note: clients who can not issue DELETE requests can POST with the added parameter _method=...
Yes
DELETE :user/lists/:id

This method is deprecated and has been replaced by POST lists/destroy. Please update your applications with the new endpoint.

Deletes the specified list. Must be owned by the authenticated user. Usage Note: clients who can not issue DELETE requests can POST with the added parameter _method=DELETE.
Yes
GET :user/:list_id/members

This method is deprecated and has been replaced by GET lists/members. Please update your applications with the new endpoint.

Returns the members of the specified list.
Yes
GET :user/:list_id/members/:id

This method is deprecated and has been replaced by GET lists/members/show. Please update your applications with the new endpoint.

Check if a user is a member of the specified list. Returns the user indicated by :id if the user is a member of the list.
Yes
GET :user/:list_id/subscribers

This method is deprecated and has been replaced by GET lists/subscribers. Please update your applications with the new endpoint.

Returns the subscribers of the specified list.
Yes
GET :user/:list_id/subscribers/:id

This method is deprecated and has been replaced by GET lists/subscribers/show. Please update your applications with the new endpoint.

Check if a user is a subscriber of the specified list.
Yes
GET :user/lists

This method is deprecated and has been replaced by GET lists. Please update your applications with the new endpoint.

List the lists of the specified user. Private lists will be included if the authenticated users is the same as the user who's lists are being returned.
Yes
GET :user/lists/:id

This method is deprecated and has been replaced by GET lists/show. Please update your applications with the new endpoint.

Show the specified list. Private lists will only be shown if the authenticated user owns the specified list.
Yes
GET :user/lists/:id/statuses

This method is deprecated and has been replaced by GET lists/statuses. Please update your applications with the new endpoint.

Show the tweet timeline for members of the specified list.
No
GET :user/lists/memberships

This method is deprecated and has been replaced by GET lists/memberships. Please update your applications with the new endpoint.

List the lists the specified user has been added to.
Yes
GET :user/lists/subscriptions

This method is deprecated and has been replaced by GET lists/subscriptions. Please update your applications with the new endpoint.

List the lists the specified user follows.
Yes
GET geo/nearby_places

This method is deprecated and has been replaced by geo/search. Please update your applications with the new endpoint.

No
GET statuses/followers

This method is deprecated as it will only return information about users who have Tweeted recently.

It is not a functional way to retrieve all of a users followers. Instead of using this method use a combination of GET followers/ids and GET users/lookup. Returns the authenticating user's followers...
Supported
GET statuses/friends

This method is deprecated as it will only return information about users who have Tweeted recently.

It is not a functional way to retrieve all of a users followers. Instead of using this method use a combination of GET friends/ids and GET users/lookup. Returns a user's friends, each with current...
No
GET statuses/friends_timeline

This method is deprecated and has been replaced by GET statuses/home_timeline. Please update your applications with the new endpoint.

Returns the 20 most recent statuses posted by the authenticating user and the user's they follow. This is the same timeline seen by a user when they login to twitter...
Yes
GET statuses/public_timeline Returns the 20 most recent statuses, including retweets if they exist, from non-protected users. The public timeline is cached for 60 seconds. Requesting more frequently than that will not return any more data, and will count against your rate limit usage. Use the Streaming API's sample... No
GET trends

This method is deprecated and has been replaced by GET trends/:woeid. Please update your applications with the new endpoint.

Returns the top ten topics that are currently trending on Twitter. The response includes the time of the request, the name of each trend, and the url to the Twitter Search...
No
GET trends/current

This method is deprecated and has been replaced by GET trends/:woeid. Please update your applications with the new endpoint.

Returns the current top 10 trending topics on Twitter. The response includes the time of the request, the name of each trending topic, and query used on Twitter Search...
No
POST :user/lists/:list_id/create_all

This method is deprecated and has been replaced by POST lists/members/create_all. Please update your applications with the new endpoint.

Adds multiple members to a list, by specifying a comma-separated list of member ids or screen names. The authenticated user must own the list to be able to add...
Yes
POST :user/:list_id/members

This method is deprecated and has been replaced by POST lists/members/create. Please update your applications with the new endpoint.

Add a member to a list. The authenticated user must own the list to be able to add members to it. Lists are limited to having 500 members.
Yes
POST :user/:list_id/subscribers

This method is deprecated and has been replaced by POST lists/subscribers/create. Please update your applications with the new endpoint.

Make the authenticated user follow the specified list.
Yes
POST :user/lists

This method is deprecated and has been replaced by POST lists/create. Please update your applications with the new endpoint.

Creates a new list for the authenticated user. Accounts are limited to 20 lists.
Yes
POST :user/lists/:id

This method is deprecated and has been replaced by POST lists/update. Please update your applications with the new endpoint.

Updates the specified list.
Yes
POST account/update_delivery_device Sets which device Twitter delivers updates to for the authenticating user. Sending none as the device parameter will disable SMS updates. Yes
POST account/update_location

This method is deprecated and has been replaced by POST account/update_profile. Please update your applications with the new endpoint.

Sets the value of the profile location field for the authenticating user.
Yes