{
  "openapi": "3.0.1",
  "info": {
    "title": "Instagram Post Scraper + Comments & Metadata",
    "description": "Scrape Instagram posts by username, profile URL, post/reel URL, or user ID. Returns captions, hashtags, mentions, likes, comments, media URLs, video views, location, and more — fast, reliable, no login required for public content.",
    "version": "1.2",
    "x-build-id": "nQ9pCAW53r25W8RIV"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/cynix_dev~instagram-post-scraper-comments-metadata/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-cynix_dev-instagram-post-scraper-comments-metadata",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/cynix_dev~instagram-post-scraper-comments-metadata/runs": {
      "post": {
        "operationId": "runs-sync-cynix_dev-instagram-post-scraper-comments-metadata",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/cynix_dev~instagram-post-scraper-comments-metadata/run-sync": {
      "post": {
        "operationId": "run-sync-cynix_dev-instagram-post-scraper-comments-metadata",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "usernames": {
            "title": "Instagram usernames or handles",
            "type": "array",
            "description": "One or more Instagram usernames (e.g. \"natgeo\") or handles (\"@natgeo\"). The scraper resolves each to its posts automatically.",
            "items": {
              "type": "string"
            }
          },
          "directUrls": {
            "title": "Profile or post URLs",
            "type": "array",
            "description": "Direct Instagram URLs. Supports profile URLs (https://www.instagram.com/natgeo/), post URLs (/p/CODE/), reel URLs (/reel/CODE/), and TV URLs (/tv/CODE/).",
            "items": {
              "type": "string"
            }
          },
          "resultsLimit": {
            "title": "Max posts per profile",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum number of posts to scrape per profile. Post/reel URLs always return exactly that one post. Keep this reasonable to control cost.",
            "default": 30
          },
          "mediaTypeFilter": {
            "title": "Media type filter",
            "enum": [
              "all",
              "image",
              "video",
              "carousel"
            ],
            "type": "string",
            "description": "Only return posts of the selected media type. \"all\" returns everything.",
            "default": "all"
          },
          "includePinned": {
            "title": "Include pinned posts",
            "type": "boolean",
            "description": "Whether to include posts pinned to the top of the profile grid.",
            "default": true
          },
          "scrapeComments": {
            "title": "Scrape comments",
            "type": "boolean",
            "description": "Fetch comments for each scraped post. REQUIRES session cookies — Instagram gates comments behind a logged-in session on 2026. Provide sessionCookies (sessionid + ds_user_id) or comments will be skipped with a warning.",
            "default": false
          },
          "maxComments": {
            "title": "Max comments per post",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Maximum number of top-level comments to fetch per post.",
            "default": 20
          },
          "scrapeCommentReplies": {
            "title": "Include comment replies",
            "type": "boolean",
            "description": "Also fetch nested replies (child comments) under each comment.",
            "default": false
          },
          "proxyCountry": {
            "title": "Proxy country",
            "maxLength": 2,
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code for residential proxy exit location (e.g. US, GB, DE, FR). Leave empty for auto/any.",
            "default": "US"
          },
          "sessionid": {
            "title": "Instagram sessionid",
            "type": "string",
            "description": "Your Instagram `sessionid` cookie. Required for comment scraping and higher-volume / limited-profile access. Log in to instagram.com, open DevTools → Application → Cookies, copy the `sessionid` value. Leave blank to scrape public posts anonymously."
          },
          "dsUserId": {
            "title": "Instagram ds_user_id",
            "type": "string",
            "description": "Your Instagram `ds_user_id` cookie (your numeric account ID). Copy it from the same Cookies list as sessionid. Must come from the same logged-in session as sessionid."
          },
          "csrfToken": {
            "title": "Instagram csrftoken (optional)",
            "type": "string",
            "description": "Optional `csrftoken` cookie. Usually not required, but paste it if you see auth errors. Copy from the same Cookies list."
          },
          "sessionCookies": {
            "title": "Advanced: raw cookies JSON (optional)",
            "type": "array",
            "description": "Advanced / agent use. Paste the full exported cookie array (e.g. from the 'Cookie Editor' browser extension) as an array of {name, value} objects. If provided, it is merged with the individual cookie fields above. Most users should just fill in sessionid + ds_user_id above."
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Apify proxy settings. Residential is strongly recommended for Instagram. Defaults to Apify residential proxy.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}