########################################################### # # Description of Instagram RESTful API # # License: MIT (see http://choosealicense.com/licenses/mit/) # Author: Vladimir Lyubitelev # swagger: '2.0' # Description info: version: 1.0.0 title: Instagram API description: | Description of Instagram RESTful API. Current limitations: * Instagram service does not support [cross origin headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) for security reasons, therefore it is not possible to use Swagger UI and make API calls directly from browser. * Modification API requests (`POST`, `DELETE`) require additional security [scopes](https://instagram.com/developer/authorization/) that are available for Apps [created on or after Nov 17, 2015](http://instagram.com/developer/review/) and started in [Sandbox Mode](http://instagram.com/developer/sandbox/). * Consider the [Instagram limitations](https://instagram.com/developer/limits/) for API calls that depends on App Mode. **Warning:** For Apps [created on or after Nov 17, 2015](http://instagram.com/developer/changelog/) API responses containing media objects no longer return the `data` field in `comments` and `likes` nodes. Last update: 2015-11-28 termsOfService: https://instagram.com/about/legal/terms/api/ contact: name: Instagram url: https://instagram.com/developer/support externalDocs: description: Instagram Developer Documentation url: https://instagram.com/developer host: api.instagram.com basePath: /v1 schemes: - https produces: - application/json # Groups and their descriptions tags: - name: users description: Get information about users - name: relationships description: Relationships to other users outgoing and incoming - name: media description: Get information about media - name: comments description: Manage comments - name: likes description: Manage likes - name: tags description: Get information about tags - name: locations description: Get information about locations - name: geographies description: Get geographies # Security securityDefinitions: api_key: type: apiKey name: access_token in: query instagram_auth: type: oauth2 authorizationUrl: https://instagram.com/oauth/authorize/ flow: implicit scopes: basic: to read a user's profile info and media (granted by default) public_content: to read any public profile info and media on a user’s behalf follower_list: to read the list of followers and followed-by users comments: to post and delete comments on a user's behalf relationships: to follow and unfollow accounts on a user's behalf likes: to like and unlike media on a user's behalf # URL patterns paths: /users/{user-id}: get: tags: - users summary: Get basic information about a user. description: | Get basic information about a user. To get information about the owner of the access token, you can use **self** instead of the `user-id`. Security scope `public_content` is required to read information about other users. parameters: - name: user-id in: path type: string description: The ID of a user to get information about, or **self** to retrieve information about authenticated user. required: true responses: 200: description: User basic information. schema: $ref: '#/definitions/UserResponse' 404: description: Not Found, user with such ID does not exist. security: - api_key: [] - instagram_auth: - basic - public_content /users/self/feed: get: tags: - users summary: See the authenticated user's feed. deprecated: true description: | See the authenticated user's feed. **Warning:** [Deprecated](http://instagram.com/developer/changelog/) for Apps created **on or after** Nov 17, 2015 parameters: - name: count in: query type: integer description: Count of media to return. required: false - name: min_id in: query type: string description: Return media later than this `min_id`. required: false - name: max_id in: query type: string description: Return media earlier than this `max_id`. required: false responses: 200: description: Users feed entries. schema: $ref: '#/definitions/MediaListResponse' security: - api_key: [] - instagram_auth: - basic /users/{user-id}/media/recent: get: tags: - users summary: Get the most recent media published by a user. description: | Get the most recent media published by a user. To get the most recent media published by the owner of the access token, you can use **self** instead of the `user-id`. Security scope `public_content` is required to read information about other users. parameters: - name: user-id in: path type: string description: The ID of a user to get recent media of, or **self** to retrieve media of authenticated user. required: true - name: count in: query type: integer description: Count of media to return. required: false - name: max_timestamp in: query type: integer format: int64 description: Return media before this UNIX timestamp. required: false - name: min_timestamp in: query type: integer format: int64 description: Return media after this UNIX timestamp. required: false - name: min_id in: query type: string description: Return media later than this `min_id`. required: false - name: max_id in: query type: string description: Return media earlier than this `max_id`. required: false responses: 200: description: Users media entries. schema: $ref: '#/definitions/MediaListResponse' security: - api_key: [] - instagram_auth: - basic - public_content /users/self/media/liked: get: tags: - users summary: See the list of media liked by the authenticated user. description: | See the list of media liked by the authenticated user. Private media is returned as long as the authenticated user has permission to view that media. Liked media lists are only available for the currently authenticated user. parameters: - name: count in: query type: integer description: Count of media to return. required: false - name: max_like_id in: query type: string description: Return media liked before this id. required: false responses: 200: description: Users media entries. schema: $ref: '#/definitions/MediaListResponse' security: - api_key: [] - instagram_auth: - basic /users/search: get: tags: - users summary: Search for a user by name. description: Search for a user by name. parameters: - name: q in: query type: string description: A query string. required: true - name: count in: query type: integer description: Number of users to return. required: false responses: 200: description: List of found users. schema: $ref: '#/definitions/UsersInfoResponse' security: - api_key: [] - instagram_auth: - basic /users/{user-id}/follows: get: tags: - relationships summary: Get the list of users this user follows. description: | Get the list of users this user follows. To get follows of the owner of the access token, you can use **self** instead of the `user-id`. parameters: - name: user-id in: path type: string description: The ID of a user, or **self** to retrieve information about authenticated user. required: true responses: 200: description: List of users this user follows. schema: $ref: '#/definitions/UsersPagingResponse' security: - api_key: [] - instagram_auth: - follower_list /users/{user-id}/followed-by: get: tags: - relationships summary: Get the list of users this user is followed by. description: | Get the list of users this user is followed by. To get users followed by the owner of the access token, you can use **self** instead of the `user-id`. parameters: - name: user-id in: path type: string description: The ID of a user, or **self** to retrieve information about authenticated user. required: true responses: 200: description: List of users this user is followed by. schema: $ref: '#/definitions/UsersPagingResponse' security: - api_key: [] - instagram_auth: - follower_list /users/self/requested-by: get: tags: - relationships summary: List the users who have requested this user's permission to follow. description: List the users who have requested this user's permission to follow. responses: 200: description: List of users who have requested this user's permission to follow. schema: $ref: '#/definitions/UsersInfoResponse' security: - api_key: [] - instagram_auth: - follower_list /users/{user-id}/relationship: get: tags: - relationships summary: Get information about a relationship to another user. description: Get information about a relationship to another user. parameters: - name: user-id in: path type: string description: The ID of a user to get information about. required: true responses: 200: description: Relationship information. schema: $ref: '#/definitions/RelationshipResponse' security: - api_key: [] - instagram_auth: - follower_list post: tags: - relationships summary: Modify the relationship between the current user and the target user. description: Modify the relationship between the current user and the target user. parameters: - name: user-id in: path type: string description: The ID of the target user. required: true - name: action in: query type: string enum: [ 'follow', 'unfollow', 'block', 'unblock', 'approve', 'ignore' ] description: Type of action to apply for relationship with the user. required: true responses: 200: description: Relationship information. schema: $ref: '#/definitions/RelationshipPostResponse' security: - api_key: [] - instagram_auth: - relationships /media/{media-id}: get: tags: - media summary: Get information about a media object. description: | Get information about a media object. The returned type key will allow you to differentiate between image and video media. **Note:** if you authenticate with an OAuth Token, you will receive the user_has_liked key which quickly tells you whether the current user has liked this media item. parameters: - name: media-id in: path type: string description: The ID of the media resource. required: true responses: 200: description: Media resource information. schema: $ref: '#/definitions/MediaEntryResponse' security: - api_key: [] - instagram_auth: - basic - public_content /media/shortcode/{shortcode}: get: tags: - media summary: Get information about a media object. description: | This endpoint returns the same response as `GET /media/{media-id}`. A media object's shortcode can be found in its shortlink URL. An example shortlink is `http://instagram.com/p/D/`, its corresponding shortcode is `D`. parameters: - name: shortcode in: path type: string description: The short code of the media resource. required: true responses: 200: description: Media resource information. schema: $ref: '#/definitions/MediaEntryResponse' security: - api_key: [] - instagram_auth: - basic - public_content /media/search: get: tags: - media summary: Search for media in a given area. description: | Search for media in a given area. The default time span is set to 5 days. The time span must not exceed 7 days. Defaults time stamps cover the last 5 days. Can return mix of `image` and `video` types. parameters: - name: lat in: query type: number format: double description: Latitude of the center search coordinate. If used, `lng` is required. required: true - name: lng in: query type: number format: double description: Longitude of the center search coordinate. If used, `lat` is required. required: true - name: min_timestamp in: query type: integer format: int64 description: A unix timestamp. All media returned will be taken later than this timestamp. required: false - name: max_timestamp in: query type: integer format: int64 description: A unix timestamp. All media returned will be taken earlier than this timestamp. required: false - name: distance in: query type: integer format: int32 description: Default is 1km (distance=1000), max distance is 5km. required: false responses: 200: description: Found media resources (without likes information) in a given area. schema: $ref: '#/definitions/MediaSearchResponse' security: - api_key: [] - instagram_auth: - public_content /media/popular: get: tags: - media summary: Get a list of currently popular media. deprecated: true description: | Get a list of what media is most popular at the moment. Can return mix of `image` and `video` types. **Warning:** [Deprecated](http://instagram.com/developer/changelog/) for Apps created **on or after** Nov 17, 2015 responses: 200: description: Found media resources (without likes information). schema: $ref: '#/definitions/MediaSearchResponse' security: - api_key: [] - instagram_auth: - basic /media/{media-id}/comments: get: tags: - comments summary: Get a list of recent comments on a media object. description: Get a list of recent comments on a media object. parameters: - name: media-id in: path type: string description: The ID of the media resource. required: true responses: 200: description: List of comments of the media resource. schema: $ref: '#/definitions/CommentsResponse' security: - api_key: [] - instagram_auth: - basic - public_content post: tags: - comments summary: Create a comment on a media object. description: | Create a comment on a media object with the following rules: * The total length of the comment cannot exceed 300 characters. * The comment cannot contain more than 4 hashtags. * The comment cannot contain more than 1 URL. * The comment cannot consist of all capital letters. parameters: - name: media-id in: path type: string description: The ID of the media resource. required: true - name: text in: query type: string description: Text to post as a comment on the media object as specified in `media-id`. required: true responses: 200: description: Result of posting a comment. schema: $ref: '#/definitions/StatusResponse' security: - api_key: [] - instagram_auth: - comments /media/{media-id}/comments/{comment-id}: delete: tags: - comments summary: Remove a comment. description: | Remove a comment either on the authenticated user's media object or authored by the authenticated user. parameters: - name: media-id in: path type: string description: The ID of the media resource. required: true - name: comment-id in: path type: string description: The ID of the comment entry. required: true responses: 200: description: Result of deleting a comment. schema: $ref: '#/definitions/StatusResponse' security: - api_key: [] - instagram_auth: - comments /media/{media-id}/likes: get: tags: - likes summary: Get a list of users who have liked this media. description: Get a list of users who have liked this media. parameters: - name: media-id in: path type: string description: The ID of the media resource. required: true responses: 200: description: List of users who liked the media resource. schema: $ref: '#/definitions/UsersInfoResponse' security: - api_key: [] - instagram_auth: - basic - public_content post: tags: - likes summary: Set a like on this media by the current user. description: Set a like on this media by the currently authenticated user. parameters: - name: media-id in: path type: string description: The ID of the media resource. required: true responses: 200: description: Result of setting a like. schema: $ref: '#/definitions/StatusResponse' security: - api_key: [] - instagram_auth: - likes delete: tags: - likes summary: Remove a like on this media by the current user. description: Remove a like on this media by the currently authenticated user. parameters: - name: media-id in: path type: string description: The ID of the media resource. required: true responses: 200: description: Result of removing a like. schema: $ref: '#/definitions/StatusResponse' security: - api_key: [] - instagram_auth: - likes /tags/{tag-name}: get: tags: - tags summary: Get information about a tag object. description: Get information about a tag object. parameters: - name: tag-name in: path type: string description: The tag name. required: true responses: 200: description: Tag information response. schema: $ref: '#/definitions/TagInfoResponse' security: - api_key: [] - instagram_auth: - public_content /tags/{tag-name}/media/recent: get: tags: - tags summary: Get a list of recently tagged media. description: | Get a list of recently tagged media. Use the `max_tag_id` and `min_tag_id` parameters in the pagination response to paginate through these objects. parameters: - name: tag-name in: path type: string description: The tag name. required: true - name: count in: query type: integer description: Count of tagged media to return. required: false - name: min_tag_id in: query type: string description: Return media before this `min_tag_id`. required: false - name: max_tag_id in: query type: string description: Return media after this `max_tag_id`. required: false responses: 200: description: List of media entries with this tag. schema: $ref: '#/definitions/TagMediaListResponse' security: - api_key: [] - instagram_auth: - public_content /tags/search: get: tags: - tags summary: Search for tags by name. description: Search for tags by name. parameters: - name: q in: query type: string description: A valid tag name without a leading \#. (eg. snowy, nofilter) required: true responses: 200: description: List of found tags and their statistics. schema: $ref: '#/definitions/TagSearchResponse' security: - api_key: [] - instagram_auth: - public_content /locations/{location-id}: get: tags: - locations summary: Get information about a location. description: Get information about a location. parameters: - name: location-id in: path type: string description: The location ID. required: true responses: 200: description: Location information response. schema: $ref: '#/definitions/LocationInfoResponse' security: - api_key: [] - instagram_auth: - public_content /locations/{location-id}/media/recent: get: tags: - locations summary: Get a list of recent media objects from a given location. description: Get a list of recent media objects from a given location. parameters: - name: location-id in: path type: string description: The location ID. required: true - name: min_timestamp in: query type: integer format: int64 description: Return media after this UNIX timestamp. required: false - name: max_timestamp in: query type: integer format: int64 description: Return media before this UNIX timestamp. required: false - name: min_id in: query type: string description: Return media before this `min_id`. required: false - name: max_id in: query type: string description: Return media after this `max_id`. required: false responses: 200: description: List of media entries from this location. schema: $ref: '#/definitions/MediaListResponse' security: - api_key: [] - instagram_auth: - public_content /locations/search: get: tags: - locations summary: Search for a location by geographic coordinate. description: Search for a location by geographic coordinate. parameters: - name: distance in: query type: integer format: int32 description: Default is 1000m (distance=1000), max distance is 5000. required: false - name: facebook_places_id in: query type: string description: Returns a location mapped off of a Facebook places id. If used, a Foursquare id and `lat`, `lng` are not required. required: false - name: foursquare_id in: query type: string description: | Returns a location mapped off of a foursquare v1 api location id. If used, you are not required to use `lat` and `lng`. Note that this method is deprecated; you should use the new foursquare IDs with V2 of their API. required: false - name: lat in: query type: number format: double description: Latitude of the center search coordinate. If used, `lng` is required. required: false - name: lng in: query type: number format: double description: Longitude of the center search coordinate. If used, `lat` is required. required: false - name: foursquare_v2_id in: query type: string description: | Returns a location mapped off of a foursquare v2 api location id. If used, you are not required to use `lat` and `lng`. required: false responses: 200: description: List of found locations. schema: $ref: '#/definitions/LocationSearchResponse' security: - api_key: [] - instagram_auth: - public_content /geographies/{geo-id}/media/recent: get: tags: - geographies summary: Get recent media from a custom geo-id. deprecated: true description: | Get recent media from a geography subscription that you created. **Note:** You can only access Geographies that were explicitly created by your OAuth client. Check the Geography Subscriptions section of the [real-time updates page](https://instagram.com/developer/realtime/). When you create a subscription to some geography that you define, you will be returned a unique `geo-id` that can be used in this query. To backfill photos from the location covered by this geography, use the [media search endpoint](https://instagram.com/developer/endpoints/media/). **Warning:** [Deprecated](http://instagram.com/developer/changelog/) for Apps created **on or after** Nov 17, 2015 parameters: - name: geo-id in: path type: string description: The geography ID. required: true - name: count in: query type: integer format: int32 description: Max number of media to return. required: false - name: min_id in: query type: string description: Return media before this `min_id`. required: false responses: 200: description: List of recent media entries from a geography subscription. schema: $ref: '#/definitions/MediaListResponse' security: - api_key: [] - instagram_auth: - basic # Model definitions: MetaData: type: object properties: code: type: integer format: int32 description: HTTP result code IdPaginationInfo: type: object properties: next_url: type: string description: URL to retrieve next page of entries next_max_id: type: string description: The max ID of the next page CursorPaginationInfo: type: object properties: next_url: type: string description: URL to retrieve next page of entries next_cursor: type: string description: The cursor ID of the next page UserResponse: type: object properties: meta: $ref: '#/definitions/MetaData' description: Response meta-data data: $ref: '#/definitions/UserInfo' description: User basic information UserInfo: type: object properties: id: type: string description: User ID username: type: string description: User name, nickname bio: type: string description: User biography website: type: string description: URL to user web-site profile_picture: type: string description: URL to user profile picture full_name: type: string description: User full name counts: $ref: '#/definitions/UserCounts' description: User statistics (counters) UserCounts: type: object properties: media: type: integer format: int32 description: Number of user media follows: type: integer format: int32 description: Number of users followed by this user followed_by: type: integer format: int32 description: Number of followers of this user UsersInfoResponse: type: object properties: meta: $ref: '#/definitions/MetaData' description: Response meta-data data: type: array description: User short information entries items: $ref: '#/definitions/UserShortInfo' UsersPagingResponse: type: object properties: pagination: $ref: '#/definitions/CursorPaginationInfo' description: Information for pagination meta: $ref: '#/definitions/MetaData' description: Response meta-data data: type: array description: List of user short information entries items: $ref: '#/definitions/UserShortInfo' UserShortInfo: type: object properties: id: type: string description: User ID username: type: string description: User name, nickname profile_picture: type: string description: URL to user profile picture full_name: type: string description: User full name MediaListResponse: type: object properties: pagination: $ref: '#/definitions/IdPaginationInfo' description: Information for pagination meta: $ref: '#/definitions/MetaData' description: Response meta-data data: type: array description: List of media entries items: $ref: '#/definitions/MediaEntry' MediaSearchResponse: type: object properties: meta: $ref: '#/definitions/MetaData' description: Response meta-data data: type: array description: Found media entries; some end-points do not return likes informtaion items: $ref: '#/definitions/MediaEntry' MediaEntry: type: object properties: attribution: type: string description: ??? Unknown ??? id: type: string description: ID of a media entry type: type: string enum: [ 'image', 'video' ] description: Type of this media entry tags: type: array description: List of tags assigned to this media items: type: string location: $ref: '#/definitions/LocationInfo' description: Location data for this media if available comments: $ref: '#/definitions/CommentsCollection' description: Comments of this media entry filter: type: string description: Filter of this media entry created_time: type: string description: Media creation UNIX timestamp link: type: string description: Fixed URL of this media entry likes: $ref: '#/definitions/LikesCollection' description: Likes of this media entry images: $ref: '#/definitions/ImagesData' description: Images data in different resolutions videos: $ref: '#/definitions/VideosData' description: Videos data in different resolutions, applied for 'video' type users_in_photo: type: array description: Users located on this media entry items: $ref: '#/definitions/UserInPhoto' caption: $ref: '#/definitions/CaptionData' description: Describes caption of this media user_has_liked: type: boolean description: Indicates whether authenticated user has liked this media or not user: $ref: '#/definitions/UserShortInfo' description: User who posted this media LocationInfo: type: object properties: id: type: string description: ID of this location (in some responses it has a type of 'integer') latitude: type: number format: double description: Location latitude longitude: type: number format: double description: Location longitude name: type: string description: Location name CommentsCollection: type: object properties: count: type: integer description: Nember of comments available, data does not necessary contain all comments data: type: array description: Collection of comment entries; **warning:** deprecated for Apps [created on or after Nov 17, 2015](http://instagram.com/developer/changelog/) items: $ref: '#/definitions/CommentEntry' CommentEntry: type: object properties: id: type: string description: ID of this comment created_time: type: string description: Comment creation UNIX timestamp text: type: string description: Text of the comment from: $ref: '#/definitions/UserShortInfo' description: User who posted this comment LikesCollection: type: object properties: count: type: integer description: Nember of likes available, data does not necessary contain all comments data: type: array description: Collection of users who liked; **warning:** deprecated for Apps [created on or after Nov 17, 2015](http://instagram.com/developer/changelog/) items: $ref: '#/definitions/UserShortInfo' ImagesData: type: object properties: low_resolution: $ref: '#/definitions/ImageInfo' description: Image in low resolution thumbnail: $ref: '#/definitions/ImageInfo' description: Thumbnail of the image standard_resolution: $ref: '#/definitions/ImageInfo' description: Image in standard resolution VideosData: type: object properties: low_resolution: $ref: '#/definitions/ImageInfo' description: Video in low resolution standard_resolution: $ref: '#/definitions/ImageInfo' description: Video in standard resolution ImageInfo: type: object properties: url: type: string description: URL of the image/video resource width: type: integer description: Image/video width in pixels height: type: integer description: Image/video height in pixels UserInPhoto: type: object properties: position: $ref: '#/definitions/Position' description: Position in photo user: $ref: '#/definitions/UserShortInfo' description: User who is indicated on the photo Position: type: object properties: x: type: number format: float description: X position (horizontal) y: type: number format: float description: Y position (vertical) CaptionData: type: object properties: id: type: string description: ID of this caption created_time: type: string description: Caption creation UNIX timestamp text: type: string description: Caption text from: $ref: '#/definitions/UserShortInfo' description: User who created this caption RelationshipResponse: type: object properties: meta: $ref: '#/definitions/MetaData' description: Response meta-data data: $ref: '#/definitions/RelationshipInfo' description: Relationship information RelationshipInfo: type: object properties: outgoing_status: type: string enum: [ 'none', 'follows', 'requested' ] description: Status of outgoing relationship incoming_status: type: string enum: [ 'none', 'followed_by', 'requested_by' ] description: Status of incoming relationship target_user_is_private: type: boolean description: Indicates whether target user is private or not RelationshipPostResponse: type: object properties: meta: $ref: '#/definitions/MetaData' description: Response meta-data data: $ref: '#/definitions/RelationshipStatus' description: Current relationship status RelationshipStatus: type: object properties: outgoing_status: type: string enum: [ 'none', 'follows', 'requested' ] description: Status of outgoing relationship MediaEntryResponse: type: object properties: meta: $ref: '#/definitions/MetaData' description: Response meta-data data: $ref: '#/definitions/MediaEntry' description: Media resource information CommentsResponse: type: object properties: meta: $ref: '#/definitions/MetaData' description: Response meta-data data: type: array description: Collection of comments items: $ref: '#/definitions/CommentEntry' StatusResponse: type: object properties: meta: $ref: '#/definitions/MetaData' description: Response meta-data data: type: string description: No data - 'null' TagInfoResponse: type: object properties: meta: $ref: '#/definitions/MetaData' description: Response meta-data data: $ref: '#/definitions/TagInfo' description: Tag brief information TagInfo: type: object properties: media_count: type: integer format: int64 description: Overall number of media entries taged with this name name: type: string description: Tag name TagMediaListResponse: type: object properties: pagination: $ref: '#/definitions/TagPaginationInfo' description: Information for pagination meta: $ref: '#/definitions/MetaData' description: Response meta-data data: type: array description: List of media entries with this tag items: $ref: '#/definitions/MediaEntry' TagPaginationInfo: type: object properties: next_max_tag_id: type: string description: The max ID of a tag for the next page deprecation_warning: type: string description: The deprication warning, if information is available next_max_id: type: string description: Depricated. Use min_tag_id instead next_min_id: type: string description: Depricated. Use max_tag_id instead min_tag_id: type: string description: The min ID of a tag for the next page next_url: type: string description: URL to retrieve next page of entries TagSearchResponse: type: object properties: meta: $ref: '#/definitions/MetaData' description: Response meta-data data: type: array description: List of found tags with brief statistics items: $ref: '#/definitions/TagInfo' LocationInfoResponse: type: object properties: meta: $ref: '#/definitions/MetaData' description: Response meta-data data: $ref: '#/definitions/LocationInfo' description: Location brief information LocationSearchResponse: type: object properties: meta: $ref: '#/definitions/MetaData' description: Response meta-data data: type: array description: List of found locations items: $ref: '#/definitions/LocationInfo'