Instagram API

Manage Instagram Business and Creator account content including publishing media, retrieving posts, managing comments, discovering mentions, and accessing account insights for analytics.

OpenAPI Specification

facebook-instagram-api.yaml Raw ↑
openapi: 3.0.3
info:
  title: Facebook Instagram API
  description: >-
    Manage Instagram Business and Creator account content including publishing
    media, retrieving posts, managing comments, discovering mentions, and
    accessing account insights.
  version: '21.0'
  contact:
    name: Meta Platforms
    url: https://developers.facebook.com
  x-generated-from: documentation
  x-last-validated: '2026-04-18'
servers:
  - url: https://graph.facebook.com/v21.0
    description: Instagram API v21.0 via Graph API
security:
  - BearerAuth: []
paths:
  /{ig-user-id}:
    get:
      operationId: getInstagramUser
      summary: Facebook Get Instagram User
      description: Retrieve an Instagram Business or Creator account profile.
      tags:
        - Users
      parameters:
        - name: ig-user-id
          in: path
          required: true
          description: The Instagram user ID.
          schema:
            type: string
          example: '17841405822304914'
        - name: fields
          in: query
          description: Comma-separated list of fields to return.
          schema:
            type: string
          example: id,username,name,biography,followers_count,media_count
      responses:
        '200':
          description: Instagram user retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstagramUser'
              examples:
                GetInstagramUser200Example:
                  summary: Default getInstagramUser 200 response
                  x-microcks-default: true
                  value:
                    id: '17841405822304914'
                    username: examplebrand
                    name: Example Brand
                    biography: Official account for Example Brand
                    followers_count: 250000
                    media_count: 1200
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /{ig-user-id}/media:
    get:
      operationId: listInstagramMedia
      summary: Facebook List Instagram Media
      description: Retrieve media objects for an Instagram account.
      tags:
        - Media
      parameters:
        - name: ig-user-id
          in: path
          required: true
          description: The Instagram user ID.
          schema:
            type: string
          example: '17841405822304914'
        - name: limit
          in: query
          description: Maximum number of media to return.
          schema:
            type: integer
          example: 25
      responses:
        '200':
          description: Media list retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MediaList'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      operationId: createInstagramMedia
      summary: Facebook Create Instagram Media
      description: Create a media container for publishing to Instagram.
      tags:
        - Media
      parameters:
        - name: ig-user-id
          in: path
          required: true
          description: The Instagram user ID.
          schema:
            type: string
          example: '17841405822304914'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MediaRequest'
            examples:
              CreateInstagramMediaRequestExample:
                summary: Default createInstagramMedia request
                x-microcks-default: true
                value:
                  image_url: https://example.com/photo.jpg
                  caption: Beautiful sunset! #photography
      responses:
        '200':
          description: Media container created successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /{ig-user-id}/media_publish:
    post:
      operationId: publishInstagramMedia
      summary: Facebook Publish Instagram Media
      description: Publish a previously created media container.
      tags:
        - Media
      parameters:
        - name: ig-user-id
          in: path
          required: true
          description: The Instagram user ID.
          schema:
            type: string
          example: '17841405822304914'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                creation_id:
                  type: string
                  description: ID of the media container to publish.
              required:
                - creation_id
      responses:
        '200':
          description: Media published successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /{media-id}/comments:
    get:
      operationId: getInstagramComments
      summary: Facebook Get Instagram Comments
      description: Retrieve comments on an Instagram media object.
      tags:
        - Comments
      parameters:
        - name: media-id
          in: path
          required: true
          description: The media ID.
          schema:
            type: string
          example: '17895695668004550'
      responses:
        '200':
          description: Comments retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstagramCommentList'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /{ig-user-id}/insights:
    get:
      operationId: getInstagramInsights
      summary: Facebook Get Instagram Insights
      description: Retrieve insights for an Instagram account.
      tags:
        - Insights
      parameters:
        - name: ig-user-id
          in: path
          required: true
          description: The Instagram user ID.
          schema:
            type: string
          example: '17841405822304914'
        - name: metric
          in: query
          required: true
          description: Comma-separated list of metrics.
          schema:
            type: string
          example: impressions,reach,follower_count
        - name: period
          in: query
          required: true
          description: Aggregation period.
          schema:
            type: string
            enum:
              - day
              - week
              - days_28
              - month
              - lifetime
          example: day
      responses:
        '200':
          description: Insights retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstagramInsightList'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /{ig-user-id}/tags:
    get:
      operationId: getInstagramTags
      summary: Facebook Get Instagram Tags
      description: Retrieve media where the user has been tagged.
      tags:
        - Tags
      parameters:
        - name: ig-user-id
          in: path
          required: true
          description: The Instagram user ID.
          schema:
            type: string
          example: '17841405822304914'
      responses:
        '200':
          description: Tagged media retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MediaList'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: OAuth 2.0 access token with instagram_basic and instagram_content_publish permissions.
  schemas:
    InstagramUser:
      type: object
      description: An Instagram Business or Creator account.
      properties:
        id:
          type: string
          description: Instagram user ID.
          example: '17841405822304914'
        username:
          type: string
          description: Instagram username.
          example: examplebrand
        name:
          type: string
          description: Display name.
          example: Example Brand
        biography:
          type: string
          description: Account biography.
          example: Official account for Example Brand
        followers_count:
          type: integer
          description: Number of followers.
          example: 250000
        follows_count:
          type: integer
          description: Number of accounts followed.
          example: 500
        media_count:
          type: integer
          description: Number of media posts.
          example: 1200
        profile_picture_url:
          type: string
          format: uri
          description: Profile picture URL.
        website:
          type: string
          format: uri
          description: Website URL.
    InstagramMedia:
      type: object
      description: An Instagram media object.
      properties:
        id:
          type: string
          description: Media ID.
          example: '17895695668004550'
        caption:
          type: string
          description: Media caption.
          example: Beautiful sunset! #photography
        media_type:
          type: string
          description: Media type.
          enum:
            - IMAGE
            - VIDEO
            - CAROUSEL_ALBUM
          example: IMAGE
        media_url:
          type: string
          format: uri
          description: URL to the media.
        permalink:
          type: string
          format: uri
          description: Permanent URL to the media on Instagram.
        timestamp:
          type: string
          format: date-time
          description: Publishing timestamp.
        like_count:
          type: integer
          description: Number of likes.
          example: 1500
        comments_count:
          type: integer
          description: Number of comments.
          example: 45
    MediaRequest:
      type: object
      description: Request to create an Instagram media container.
      properties:
        image_url:
          type: string
          format: uri
          description: URL of the image to publish.
          example: https://example.com/photo.jpg
        caption:
          type: string
          description: Media caption.
          example: Beautiful sunset! #photography
        video_url:
          type: string
          format: uri
          description: URL of the video to publish.
        media_type:
          type: string
          description: Media type for carousels.
          enum:
            - CAROUSEL
    MediaList:
      type: object
      description: Paginated list of Instagram media.
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/InstagramMedia'
        paging:
          $ref: '#/components/schemas/Paging'
    InstagramComment:
      type: object
      description: A comment on Instagram media.
      properties:
        id:
          type: string
          description: Comment ID.
          example: '17858893269000001'
        text:
          type: string
          description: Comment text.
          example: Love this photo!
        timestamp:
          type: string
          format: date-time
          description: Comment timestamp.
        username:
          type: string
          description: Username of the commenter.
          example: photolovers
        like_count:
          type: integer
          description: Number of likes on the comment.
          example: 3
    InstagramCommentList:
      type: object
      description: Paginated list of Instagram comments.
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/InstagramComment'
        paging:
          $ref: '#/components/schemas/Paging'
    InstagramInsight:
      type: object
      description: An Instagram account insight metric.
      properties:
        name:
          type: string
          description: Metric name.
          example: impressions
        period:
          type: string
          description: Aggregation period.
          example: day
        values:
          type: array
          items:
            type: object
            properties:
              value:
                type: integer
                description: Metric value.
              end_time:
                type: string
                format: date-time
                description: End time of the period.
    InstagramInsightList:
      type: object
      description: List of Instagram insights.
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/InstagramInsight'
    Paging:
      type: object
      description: Pagination cursors.
      properties:
        cursors:
          type: object
          properties:
            before:
              type: string
            after:
              type: string
        next:
          type: string
          format: uri
        previous:
          type: string
          format: uri