{
  "openapi": "3.0.1",
  "info": {
    "title": "🖼️ Facebook Posts Media & OCR Content Harvester",
    "description": "Facebook Posts Media & OCR Content Harvester: Extract posts, captions, images, videos, engagement metrics, and text from media using OCR. Organize visual and textual content into structured datasets for keyword research, competitor monitoring, content analysis, and social media intelligence.",
    "version": "0.1",
    "x-build-id": "7gq9um56YUdS7gs9f"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapier~facebook-posts-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapier-facebook-posts-scraper",
        "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/scrapier~facebook-posts-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapier-facebook-posts-scraper",
        "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/scrapier~facebook-posts-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapier-facebook-posts-scraper",
        "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",
        "required": [
          "startUrls"
        ],
        "properties": {
          "startUrls": {
            "title": "🔗 Facebook Page URLs or Usernames",
            "type": "array",
            "description": "One or more Facebook *page* targets.\n\n• **Full URL:** `https://www.facebook.com/nytimes/`\n• **Username only:** `nytimes`, `Cristiano` — turned into a full URL automatically.\n\nEach target is scraped in sequence to reduce rate limits.",
            "items": {
              "type": "string"
            }
          },
          "resultsLimit": {
            "title": "📊 Maximum Posts per Page",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "How many posts to collect **per target page**.\n\n• Minimum: **1**. Default: **20**.\n• Scraping stops once this count is reached for each page.\n\nExample: `resultsLimit=20` on two pages → up to 40 posts total.",
            "default": 20
          },
          "captionText": {
            "title": "📝 Include Post Text",
            "type": "boolean",
            "description": "Include the post's caption text in the output.\n\n• **ON** (default) — post `text` is included, and OCR/entity extraction runs over it.\n• **OFF** — post `text` is blanked (useful when you only want the image manifest / OCR).",
            "default": true
          },
          "includeMedia": {
            "title": "🖼️ Build Per-Post Image Manifest",
            "type": "boolean",
            "description": "Extract each post's downloadable image assets — full-res `url`, `width`, `height`, `id`, OCR alt-text, and a suggested filename — into `creative.images`.\n\n• Values come straight from the scraped `media[].photo_image`. Default: **ON**.",
            "default": true
          },
          "extractEntities": {
            "title": "🔍 Extract Entities (links / hashtags / prices / CTAs)",
            "type": "boolean",
            "description": "Extract **real substrings** of the scraped post text + OCR image-text: URLs, emails, phone numbers, @mentions, #hashtags, prices, and known call-to-action phrases.\n\n• Only non-empty entity types are attached. Default: **ON**.",
            "default": true
          },
          "ocrKeywords": {
            "title": "🎯 OCR / Text Keyword Filter",
            "type": "array",
            "description": "Keep only posts whose **post text OR image-OCR** contains any of these keywords (case-insensitive substring). Leave empty to keep every post.\n\nExample: `[\"sale\", \"discount\"]` keeps only posts mentioning a sale in the caption or inside an image.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "mediaManifest": {
            "title": "📦 Run-Level Media Manifest",
            "type": "boolean",
            "description": "Also save a flat run-level manifest of every image asset (postId, url, width, height, ocrText) to the run's key-value store under `MEDIA_MANIFEST` — handy for bulk download. Requires the image manifest. Default: **ON**.",
            "default": true
          },
          "metricsOnly": {
            "title": "📉 Metrics-Only Rows",
            "type": "boolean",
            "description": "Drop the heavy base post fields from each dataset row and keep only identity + the `creative` block. Default: **OFF** (rows include the pristine base post plus the `creative` block).",
            "default": false
          },
          "rawData": {
            "title": "↩️ Raw Base Passthrough",
            "type": "boolean",
            "description": "Return the **plain base post array**, byte-identical to the base Facebook Posts Scraper — no `creative` block, no filtering, no extra fields. Use this when you only want the original scrape. Default: **OFF**.",
            "default": false
          },
          "onlyPostsNewerThan": {
            "title": "📅 Posts Newer Than (Start Date)",
            "type": "string",
            "description": "Only include posts **after** this date.\n\n• **Absolute:** a calendar date (e.g. `2024-01-01`).\n• **Relative:** e.g. `7 days`, `2 months`, `1 year` — counted back from today.\n\nLeave empty for no start limit."
          },
          "onlyPostsOlderThan": {
            "title": "⌛ Posts Older Than (End Date)",
            "type": "string",
            "description": "Only include posts **before** this date.\n\n• **Absolute:** e.g. `2024-12-31`.\n• **Relative:** e.g. `0 days` for today, or a number of days/months/years ago.\n\nLeave empty for no end limit."
          },
          "aiEnhancement": {
            "title": "🤖 AI Enhancement (sentiment / topics / brand-safety)",
            "type": "boolean",
            "description": "Run an optional AI pass over each post's creative free-text (post caption + OCR image-text) to add `aiEnhancement` = { sentiment, topics, brandSafety, language }.\n\n✅ **RECOMMENDED for this actor** — posts emit rich free text (caption + in-image OCR), which is exactly what an LLM classifies well. Default: **OFF** (no LLM calls, no key needed).",
            "default": false
          },
          "aiModel": {
            "title": "🤖 AI Model / Provider",
            "enum": [
              "claude-haiku-4-5",
              "claude-sonnet-5",
              "claude-opus-4-8",
              "claude-fable-5",
              "gpt-4o-mini",
              "gpt-4o",
              "gpt-4.1-mini",
              "gpt-4.1",
              "o3-mini",
              "o1",
              "gemini-2.0-flash-lite",
              "gemini-2.0-flash",
              "gemini-1.5-pro",
              "gemini-2.5-flash",
              "gemini-2.5-pro",
              "grok-2-latest",
              "grok-3-mini",
              "grok-3",
              "grok-beta",
              "deepseek-chat",
              "deepseek-reasoner",
              "sonar",
              "sonar-pro",
              "sonar-reasoning",
              "mistral-small-latest",
              "mistral-large-latest"
            ],
            "type": "string",
            "description": "Provider auto-detected from the name: claude-*=Anthropic, gpt-*/o1/o3=OpenAI, gemini-*=Google, grok-*=xAI, deepseek-*=DeepSeek, sonar*=Perplexity, mistral-*=Mistral. Cheaper mini/flash/haiku/lite models are recommended for classification.",
            "default": "claude-haiku-4-5"
          },
          "aiApiKey": {
            "title": "🔑 AI API Key",
            "type": "string",
            "description": "API key for the selected AI provider. Used only when AI Enhancement is ON. If left empty, the actor falls back to the provider's environment variable (e.g. `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`)."
          },
          "proxyConfiguration": {
            "title": "🌐 Proxy Settings",
            "type": "object",
            "description": "The actor prefers Apify Residential proxy for higher success rates, then falls back to Datacenter proxy. You can optionally provide custom proxy URLs here."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}