openapi: 3.0.3 info: title: Instagram Graph API version: "24.0" description: | The Instagram Graph API allows Instagram Business and Creator accounts to access Instagram data. This API is built on the Graph API and allows businesses to manage their Instagram presence, publish content, moderate comments, identify tagged media, and get basic metadata and metrics about other Instagram Businesses and Creators. termsOfService: https://developers.facebook.com/terms/ contact: name: Meta for Developers url: https://developers.facebook.com/ license: name: Meta Platform Terms url: https://developers.facebook.com/terms/ servers: - url: https://graph.instagram.com description: Instagram Graph API security: - facebook_auth: [] paths: # User endpoints /me: get: summary: Get current user info description: Returns information about the current user tags: [User] parameters: - $ref: '#/components/parameters/fields_user' responses: '200': description: User information content: application/json: schema: $ref: '#/components/schemas/User' /{user-id}: get: summary: Get user by ID description: Returns information about a specific user tags: [User] parameters: - $ref: '#/components/parameters/user_id' - $ref: '#/components/parameters/fields_user' responses: '200': description: User information content: application/json: schema: $ref: '#/components/schemas/User' # Media endpoints /{user-id}/media: get: summary: Get user media description: Returns a list of media objects for a user tags: [Media] parameters: - $ref: '#/components/parameters/user_id' - $ref: '#/components/parameters/fields_media' - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/after' - $ref: '#/components/parameters/before' responses: '200': description: List of media objects content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Media' paging: $ref: '#/components/schemas/Paging' post: summary: Create media description: Creates a media object (container) for publishing tags: [Media, Publishing] parameters: - $ref: '#/components/parameters/user_id' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateMediaRequest' responses: '200': description: Media container created content: application/json: schema: type: object properties: id: type: string description: Media container ID /{media-id}: get: summary: Get media by ID description: Returns information about a specific media object tags: [Media] parameters: - $ref: '#/components/parameters/media_id' - $ref: '#/components/parameters/fields_media' responses: '200': description: Media information content: application/json: schema: $ref: '#/components/schemas/Media' delete: summary: Delete media description: Deletes a media object tags: [Media] parameters: - $ref: '#/components/parameters/media_id' responses: '200': description: Media deleted content: application/json: schema: type: object properties: success: type: boolean # Publishing endpoints /{user-id}/media_publish: post: summary: Publish media description: Publishes a media container tags: [Publishing] parameters: - $ref: '#/components/parameters/user_id' requestBody: required: true content: application/json: schema: type: object required: - creation_id properties: creation_id: type: string description: Media container ID to publish responses: '200': description: Media published content: application/json: schema: type: object properties: id: type: string description: Published media ID # Comments endpoints /{media-id}/comments: get: summary: Get media comments description: Returns comments for a media object tags: [Comments] parameters: - $ref: '#/components/parameters/media_id' - $ref: '#/components/parameters/fields_comment' - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/after' responses: '200': description: List of comments content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Comment' paging: $ref: '#/components/schemas/Paging' post: summary: Create comment reply description: Creates a reply to a comment tags: [Comments] parameters: - $ref: '#/components/parameters/media_id' requestBody: required: true content: application/json: schema: type: object required: - message properties: message: type: string description: Comment text responses: '200': description: Comment created content: application/json: schema: type: object properties: id: type: string /{comment-id}: get: summary: Get comment by ID description: Returns information about a specific comment tags: [Comments] parameters: - name: comment-id in: path required: true schema: type: string - $ref: '#/components/parameters/fields_comment' responses: '200': description: Comment information content: application/json: schema: $ref: '#/components/schemas/Comment' delete: summary: Delete comment description: Deletes a comment tags: [Comments] parameters: - name: comment-id in: path required: true schema: type: string responses: '200': description: Comment deleted content: application/json: schema: type: object properties: success: type: boolean /{comment-id}/replies: get: summary: Get comment replies description: Returns replies to a comment tags: [Comments] parameters: - name: comment-id in: path required: true schema: type: string - $ref: '#/components/parameters/fields_comment' - $ref: '#/components/parameters/limit' responses: '200': description: List of comment replies content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Comment' paging: $ref: '#/components/schemas/Paging' # Insights endpoints /{user-id}/insights: get: summary: Get user insights description: Returns insights for a user account tags: [Insights] parameters: - $ref: '#/components/parameters/user_id' - $ref: '#/components/parameters/metric' - $ref: '#/components/parameters/period' - $ref: '#/components/parameters/since' - $ref: '#/components/parameters/until' responses: '200': description: User insights content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Insight' paging: $ref: '#/components/schemas/Paging' /{media-id}/insights: get: summary: Get media insights description: Returns insights for a media object tags: [Insights] parameters: - $ref: '#/components/parameters/media_id' - $ref: '#/components/parameters/metric' responses: '200': description: Media insights content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Insight' # Hashtag endpoints /ig_hashtag_search: get: summary: Search hashtags description: Returns hashtag data tags: [Hashtags] parameters: - name: user_id in: query required: true schema: type: string - name: q in: query required: true schema: type: string description: Hashtag to search for responses: '200': description: Hashtag search results content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Hashtag' /{hashtag-id}: get: summary: Get hashtag by ID description: Returns information about a hashtag tags: [Hashtags] parameters: - name: hashtag-id in: path required: true schema: type: string - name: fields in: query schema: type: string default: "id,name" responses: '200': description: Hashtag information content: application/json: schema: $ref: '#/components/schemas/Hashtag' /{hashtag-id}/recent_media: get: summary: Get recent hashtag media description: Returns recent media tagged with a hashtag tags: [Hashtags, Media] parameters: - name: hashtag-id in: path required: true schema: type: string - name: user_id in: query required: true schema: type: string - $ref: '#/components/parameters/fields_media' - $ref: '#/components/parameters/limit' responses: '200': description: Recent hashtag media content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Media' paging: $ref: '#/components/schemas/Paging' /{hashtag-id}/top_media: get: summary: Get top hashtag media description: Returns top media tagged with a hashtag tags: [Hashtags, Media] parameters: - name: hashtag-id in: path required: true schema: type: string - name: user_id in: query required: true schema: type: string - $ref: '#/components/parameters/fields_media' - $ref: '#/components/parameters/limit' responses: '200': description: Top hashtag media content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Media' paging: $ref: '#/components/schemas/Paging' # Mentioned media endpoints /{user-id}/tags: get: summary: Get tagged media description: Returns media in which the user is tagged tags: [User, Media] parameters: - $ref: '#/components/parameters/user_id' - $ref: '#/components/parameters/fields_media' - $ref: '#/components/parameters/limit' responses: '200': description: Tagged media content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Media' paging: $ref: '#/components/schemas/Paging' # Stories endpoints /{user-id}/stories: get: summary: Get user stories description: Returns stories for a user tags: [Stories] parameters: - $ref: '#/components/parameters/user_id' - $ref: '#/components/parameters/fields_media' - $ref: '#/components/parameters/limit' responses: '200': description: User stories content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Media' paging: $ref: '#/components/schemas/Paging' # Content Publishing - Container Creation /{user-id}/media_containers: post: summary: Create media container description: Create a media container for publishing content tags: [Publishing] parameters: - $ref: '#/components/parameters/user_id' requestBody: required: true content: application/x-www-form-urlencoded: schema: type: object properties: image_url: type: string format: uri description: URL of image to publish video_url: type: string format: uri description: URL of video to publish caption: type: string description: Caption text (max 2,200 characters) maxLength: 2200 location_id: type: string description: Location Page ID user_tags: type: array items: type: object properties: username: type: string x: type: number format: float y: type: number format: float description: User tags with coordinates media_type: type: string enum: [IMAGE, VIDEO, CAROUSEL, REELS] description: Type of media thumb_offset: type: integer description: Video thumbnail offset in milliseconds oneOf: - required: [image_url] - required: [video_url] responses: '200': description: Media container created successfully content: application/json: schema: type: object properties: id: type: string description: Container ID # Business Discovery /{user-id}/business_discovery: get: summary: Get business discovery info description: Get basic metadata and metrics for other Instagram Business accounts tags: [User] parameters: - $ref: '#/components/parameters/user_id' - name: username in: query required: true schema: type: string description: Username to get info about (without @) example: "instagram" - name: fields in: query schema: type: string default: "account_type,id,followers_count,follows_count,media_count,name,profile_picture_url,username,website" description: Comma-separated list of fields responses: '200': description: Business account information content: application/json: schema: type: object properties: business_discovery: $ref: '#/components/schemas/User' # Product Tagging /{user-id}/product_catalogs: get: summary: Get product catalogs description: Get product catalogs connected to the Instagram Business account tags: [Shopping] parameters: - $ref: '#/components/parameters/user_id' responses: '200': description: Product catalogs content: application/json: schema: type: object properties: data: type: array items: type: object properties: id: type: string name: type: string /{media-id}/product_tags: get: summary: Get product tags on media description: Get product tags applied to a media object tags: [Shopping] parameters: - $ref: '#/components/parameters/media_id' responses: '200': description: Product tags content: application/json: schema: type: object properties: data: type: array items: type: object properties: id: type: string product_id: type: string x: type: number format: float y: type: number format: float post: summary: Add product tags to media description: Add product tags to a media object tags: [Shopping] parameters: - $ref: '#/components/parameters/media_id' requestBody: required: true content: application/x-www-form-urlencoded: schema: type: object properties: updated_tags: type: array items: type: object properties: product_id: type: string x: type: number format: float y: type: number format: float required: [updated_tags] responses: '200': description: Product tags updated successfully # Mentions /{user-id}/mentions: get: summary: Get user mentions description: Get media objects where the user has been mentioned tags: [User] parameters: - $ref: '#/components/parameters/user_id' - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/after' - $ref: '#/components/parameters/before' responses: '200': description: Media objects with mentions content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Media' paging: $ref: '#/components/schemas/Paging' # Live Media /{user-id}/live_media: get: summary: Get live media description: Get live video objects for the user tags: [Media] parameters: - $ref: '#/components/parameters/user_id' - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/after' - $ref: '#/components/parameters/before' responses: '200': description: Live media objects content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Media' paging: $ref: '#/components/schemas/Paging' # Additional Insights /{user-id}/insights/audience: get: summary: Get audience insights description: Get demographic and behavioral audience insights tags: [Insights] parameters: - $ref: '#/components/parameters/user_id' - name: metric in: query required: true schema: type: string enum: [audience_gender_age, audience_locale, audience_country, audience_city, online_followers] description: Audience metric to retrieve - name: period in: query required: true schema: type: string enum: [lifetime, days_28] description: Time period for insights responses: '200': description: Audience insights data content: application/json: schema: $ref: '#/components/schemas/InsightsResponse' /{user-id}/insights/content: get: summary: Get content insights description: Get insights about published content performance tags: [Insights] parameters: - $ref: '#/components/parameters/user_id' - name: metric in: query required: true schema: type: string enum: [posts_impressions, posts_reach, posts_saved, posts_video_views, posts_engagement] description: Content metric to retrieve - name: period in: query required: true schema: type: string enum: [day, week, days_28] description: Time period for insights - name: since in: query schema: type: string format: date description: Start date (YYYY-MM-DD) - name: until in: query schema: type: string format: date description: End date (YYYY-MM-DD) responses: '200': description: Content insights data content: application/json: schema: $ref: '#/components/schemas/InsightsResponse' # Comment Moderation /{user-id}/comments_filter: get: summary: Get comment filters description: Get current comment filtering settings tags: [Comments] parameters: - $ref: '#/components/parameters/user_id' responses: '200': description: Comment filter settings content: application/json: schema: type: object properties: filter_keywords: type: array items: type: string hide_offensive_comments: type: boolean post: summary: Update comment filters description: Update comment filtering settings tags: [Comments] parameters: - $ref: '#/components/parameters/user_id' requestBody: required: true content: application/x-www-form-urlencoded: schema: type: object properties: filter_keywords: type: array items: type: string description: Keywords to filter out hide_offensive_comments: type: boolean description: Whether to hide offensive comments responses: '200': description: Comment filters updated successfully # Webhooks /{user-id}/subscribed_apps: get: summary: Get webhook subscriptions description: Get current webhook subscriptions for the user tags: [Webhooks] parameters: - $ref: '#/components/parameters/user_id' responses: '200': description: Webhook subscriptions content: application/json: schema: type: object properties: data: type: array items: type: object properties: application: type: object properties: id: type: string name: type: string subscribed_fields: type: array items: type: string post: summary: Subscribe to webhooks description: Subscribe to webhook events tags: [Webhooks] parameters: - $ref: '#/components/parameters/user_id' requestBody: required: true content: application/x-www-form-urlencoded: schema: type: object properties: object: type: string enum: [instagram] default: instagram callback_url: type: string format: uri description: Webhook callback URL fields: type: array items: type: string enum: [comments, mentions, live_comments, story_insights] description: Fields to subscribe to verify_token: type: string description: Verification token required: [callback_url, fields, verify_token] responses: '200': description: Webhook subscription created successfully # Shopping Tags /{user-id}/shopping_tags: get: summary: Get shopping tags description: Get media objects with shopping tags tags: [Shopping] parameters: - $ref: '#/components/parameters/user_id' - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/after' - $ref: '#/components/parameters/before' responses: '200': description: Media with shopping tags content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Media' paging: $ref: '#/components/schemas/Paging' # Account Management /{user-id}/available_catalogs: get: summary: Get available catalogs description: Get available product catalogs for the business tags: [User] parameters: - $ref: '#/components/parameters/user_id' responses: '200': description: Available catalogs content: application/json: schema: type: object properties: data: type: array items: type: object properties: id: type: string name: type: string /{user-id}/content_publishing_limit: get: summary: Get content publishing limit description: Get the current content publishing limit status tags: [Publishing] parameters: - $ref: '#/components/parameters/user_id' responses: '200': description: Publishing limit information content: application/json: schema: type: object properties: data: type: array items: type: object properties: config: type: object properties: limit: type: integer period: type: string components: securitySchemes: facebook_auth: type: oauth2 flows: authorizationCode: authorizationUrl: https://www.facebook.com/v20.0/dialog/oauth tokenUrl: https://graph.facebook.com/v20.0/oauth/access_token scopes: instagram_basic: Basic Instagram access instagram_content_publish: Publish content to Instagram instagram_manage_comments: Manage comments instagram_manage_insights: Read insights pages_read_engagement: Read page engagement parameters: user_id: name: user-id in: path required: true schema: type: string description: Instagram User ID media_id: name: media-id in: path required: true schema: type: string description: Instagram Media ID fields_user: name: fields in: query schema: type: string default: "id,username" example: "id,username,account_type,media_count,followers_count" description: Comma-separated list of user fields fields_media: name: fields in: query schema: type: string default: "id,media_type" example: "id,media_type,media_url,permalink,caption,timestamp,like_count,comments_count" description: Comma-separated list of media fields fields_comment: name: fields in: query schema: type: string default: "id,text" example: "id,text,timestamp,username,like_count,replies" description: Comma-separated list of comment fields limit: name: limit in: query schema: type: integer default: 25 minimum: 1 maximum: 200 description: Number of items to return after: name: after in: query schema: type: string description: Pagination cursor before: name: before in: query schema: type: string description: Pagination cursor metric: name: metric in: query required: true schema: type: string example: "impressions,reach,profile_views" description: Comma-separated list of metrics period: name: period in: query schema: type: string enum: [day, week, days_28] default: day description: Period for insights since: name: since in: query schema: type: string format: date description: Start date for insights (YYYY-MM-DD) until: name: until in: query schema: type: string format: date description: End date for insights (YYYY-MM-DD) schemas: User: type: object properties: id: type: string description: Instagram User ID username: type: string description: Instagram username account_type: type: string enum: [BUSINESS, PERSONAL, CREATOR] media_count: type: integer description: Number of media published by user followers_count: type: integer description: Number of followers follows_count: type: integer description: Number of users this user follows name: type: string description: User's full name profile_picture_url: type: string description: User's profile picture URL biography: type: string description: User's biography website: type: string description: User's website URL Media: type: object properties: id: type: string description: Media ID media_type: type: string enum: [IMAGE, VIDEO, CAROUSEL_ALBUM] media_url: type: string description: Media URL permalink: type: string description: Permalink to the media caption: type: string description: Media caption timestamp: type: string format: date-time description: Media creation time like_count: type: integer description: Number of likes comments_count: type: integer description: Number of comments thumbnail_url: type: string description: Video thumbnail URL children: type: object description: Child media for carousel albums properties: data: type: array items: $ref: '#/components/schemas/Media' username: type: string description: Username of the media owner owner: $ref: '#/components/schemas/User' Comment: type: object properties: id: type: string description: Comment ID text: type: string description: Comment text timestamp: type: string format: date-time description: Comment creation time username: type: string description: Commenter's username like_count: type: integer description: Number of likes on comment replies: type: object description: Comment replies properties: data: type: array items: $ref: '#/components/schemas/Comment' hidden: type: boolean description: Whether comment is hidden user: $ref: '#/components/schemas/User' Insight: type: object properties: name: type: string description: Metric name period: type: string description: Time period values: type: array items: type: object properties: value: type: integer description: Metric value end_time: type: string format: date-time description: End time for the metric period title: type: string description: Metric title description: type: string description: Metric description id: type: string description: Insight ID Hashtag: type: object properties: id: type: string description: Hashtag ID name: type: string description: Hashtag name CreateMediaRequest: type: object required: - image_url properties: image_url: type: string description: URL of the image to upload video_url: type: string description: URL of the video to upload caption: type: string description: Media caption location_id: type: string description: Location ID user_tags: type: array items: type: object properties: username: type: string x: type: number format: float y: type: number format: float children: type: array items: type: string description: Array of media IDs for carousel posts media_type: type: string enum: [IMAGE, VIDEO, CAROUSEL_ALBUM] cover_url: type: string description: Video cover image URL is_reel: type: boolean description: Whether the video is a reel share_to_feed: type: boolean description: Whether to share reel to feed thumb_offset: type: integer description: Video thumbnail offset in milliseconds Paging: type: object properties: cursors: type: object properties: before: type: string after: type: string previous: type: string next: type: string Error: type: object properties: error: type: object properties: message: type: string type: type: string code: type: integer fbtrace_id: type: string tags: - name: User description: User account operations - name: Media description: Media management - name: Publishing description: Content publishing - name: Comments description: Comment management - name: Insights description: Analytics and insights - name: Hashtags description: Hashtag operations - name: Stories description: Stories management - name: Shopping description: Product tagging and shopping features - name: Webhooks description: Webhook subscriptions and management