{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Profile, Posts, Ads & Groups Scraper | Lens",
    "description": "Scrape Facebook profiles, posts, reels, groups, events, Marketplace, and Ad Library. Billed via Apify Store (pay per result).",
    "version": "0.1",
    "x-build-id": "6Ngmj5z9fDXNFK1kk"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/cocoa_cherry~lens-social-facebook/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-cocoa_cherry-lens-social-facebook",
        "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/cocoa_cherry~lens-social-facebook/runs": {
      "post": {
        "operationId": "runs-sync-cocoa_cherry-lens-social-facebook",
        "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/cocoa_cherry~lens-social-facebook/run-sync": {
      "post": {
        "operationId": "run-sync-cocoa_cherry-lens-social-facebook",
        "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": [
          "endpoint"
        ],
        "properties": {
          "endpoint": {
            "title": "Endpoint",
            "enum": [
              "/v1/facebook/adLibrary/ad",
              "/v1/facebook/adLibrary/ad/transcript",
              "/v1/facebook/adLibrary/company/ads",
              "/v1/facebook/adLibrary/search/ads",
              "/v1/facebook/adLibrary/search/companies",
              "/v1/facebook/event/details",
              "/v1/facebook/events",
              "/v1/facebook/events/search",
              "/v1/facebook/group",
              "/v1/facebook/group/posts",
              "/v1/facebook/marketplace/item",
              "/v1/facebook/marketplace/location/search",
              "/v1/facebook/marketplace/search",
              "/v1/facebook/post",
              "/v1/facebook/post/comment/replies",
              "/v1/facebook/post/comments",
              "/v1/facebook/post/transcript",
              "/v1/facebook/profile",
              "/v1/facebook/profile/events",
              "/v1/facebook/profile/photos",
              "/v1/facebook/profile/posts",
              "/v1/facebook/profile/reels"
            ],
            "type": "string",
            "description": "Which Facebook social endpoint to call.",
            "default": "/v1/facebook/profile"
          },
          "url": {
            "title": "Url",
            "type": "string",
            "description": "Facebook Ad URL. Used by 15 endpoints — required only for some (see endpoint docs).",
            "default": "https://www.facebook.com/Meta"
          },
          "query": {
            "title": "Query",
            "type": "string",
            "description": "Keyword to search for. Used by 5 endpoints — required only for some (see endpoint docs)."
          },
          "id": {
            "title": "Id",
            "type": "string",
            "description": "Facebook Ad Id. Used by 4 endpoints — required only for some (see endpoint docs)."
          },
          "cursor": {
            "title": "Cursor",
            "type": "string",
            "description": "Cursor to paginate through results. Used by 12 endpoints — required only for some (see endpoint docs)."
          },
          "language": {
            "title": "Language",
            "type": "string",
            "description": "Language to filter ads on. Needs to be 2 letter language code, ie EN, ES, FR, etc. Used by /v1/facebook/adLibrary/company/ads."
          },
          "sort_by": {
            "title": "Sort By",
            "enum": [
              "suggested",
              "distance_ascend",
              "creation_time_descend",
              "price_ascend",
              "price_descend"
            ],
            "type": "string",
            "description": "Sort by impressions (high to low), or Most Recent (relevancy_monthly_grouped). Defaults to impressions. Used by 4 endpoints — required only for some (see endpoint docs)."
          },
          "ad_type": {
            "title": "Ad Type",
            "enum": [
              "all",
              "political_and_issue_ads"
            ],
            "type": "string",
            "description": "Search for all ads or only political and issue ads. Used by /v1/facebook/adLibrary/search/ads."
          },
          "availability": {
            "title": "Availability",
            "enum": [
              "available",
              "sold",
              "all"
            ],
            "type": "string",
            "description": "Availability filter. Used by /v1/facebook/marketplace/search."
          },
          "cache_max_age": {
            "title": "Cache Max Age",
            "enum": [
              "1d",
              "3d",
              "7d",
              "14d",
              "30d"
            ],
            "type": "string",
            "description": "If we have a response in the cache that is this many days old or newer, return the cached response (0 credits, with \"cached\": true and a \"cached_at\" timestamp). Otherwise, scrape a live result (1 credit). [See the Caching page for details.](https://docs.scrapecreators.com/caching). Used by 5 endpoints — required only for some (see endpoint docs)."
          },
          "companyName": {
            "title": "CompanyName",
            "type": "string",
            "description": "The name of the company. Can either use this or pageId. Used by /v1/facebook/adLibrary/company/ads."
          },
          "condition": {
            "title": "Condition",
            "enum": [
              "new",
              "used_like_new",
              "used_good",
              "used_fair"
            ],
            "type": "string",
            "description": "Condition filter. Used by /v1/facebook/marketplace/search."
          },
          "count": {
            "title": "Count",
            "type": "integer",
            "description": "Number of listings to return. Used by /v1/facebook/marketplace/search."
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "This can only be one country. It has to be the 2 letter code for the country. It defaults to ALL. Used by 2 endpoints — required only for some (see endpoint docs)."
          },
          "date_listed": {
            "title": "Date Listed",
            "enum": [
              "all",
              "1",
              "7",
              "30",
              "last_24_hours",
              "last_7_days",
              "last_30_days"
            ],
            "type": "string",
            "description": "Date listed filter. Used by /v1/facebook/marketplace/search."
          },
          "delivery_method": {
            "title": "Delivery Method",
            "enum": [
              "all",
              "local_pickup",
              "shipping"
            ],
            "type": "string",
            "description": "Delivery filter. Used by /v1/facebook/marketplace/search."
          },
          "end_date": {
            "title": "End Date",
            "type": "string",
            "description": "End date to search for. Format: YYYY-MM-DD. Used by 2 endpoints — required only for some (see endpoint docs)."
          },
          "expansion_token": {
            "title": "Expansion Token",
            "type": "string",
            "description": "The expansion_token of the comment. You can get the expansion_token from the /v1/facebook/post/comments endpoint. Used by /v1/facebook/post/comment/replies."
          },
          "feedback_id": {
            "title": "Feedback Id",
            "type": "string",
            "description": "The *feedback_id* of the comment. Be careful, this is not the comment id. You can get the feedback_id from the /v1/facebook/post/comments endpoint. Used by 2 endpoints — required only for some (see endpoint docs)."
          },
          "get_business_hours": {
            "title": "Get Business Hours",
            "type": "string",
            "description": "Get the business's hours. Used by /v1/facebook/profile."
          },
          "group_id": {
            "title": "Group Id",
            "type": "string",
            "description": "The numeric Facebook group ID. Provide this instead of url if you already have it. Used by 2 endpoints — required only for some (see endpoint docs)."
          },
          "include_gated_profile": {
            "title": "Include Gated Profile",
            "type": "string",
            "description": "When true, returns limited public fields for gated or age-restricted profiles. Ignored for normal public profiles — those still return the full response. Used by /v1/facebook/profile."
          },
          "lat": {
            "title": "Lat",
            "type": "integer",
            "description": "Latitude for the search location. Used by /v1/facebook/marketplace/search."
          },
          "lng": {
            "title": "Lng",
            "type": "integer",
            "description": "Longitude for the search location. Used by /v1/facebook/marketplace/search."
          },
          "max_price": {
            "title": "Max Price",
            "type": "integer",
            "description": "Maximum listing price. Used by /v1/facebook/marketplace/search."
          },
          "media_type": {
            "title": "Media Type",
            "enum": [
              "ALL",
              "IMAGE",
              "VIDEO",
              "MEME",
              "IMAGE_AND_MEME",
              "NONE"
            ],
            "type": "string",
            "description": "Media type of the ad. Defaults to ALL. Meme refers to ads with image and text. Not sure why they call it meme. Used by 2 endpoints — required only for some (see endpoint docs)."
          },
          "min_price": {
            "title": "Min Price",
            "type": "integer",
            "description": "Minimum listing price. Used by /v1/facebook/marketplace/search."
          },
          "next_page_id": {
            "title": "Next Page Id",
            "type": "string",
            "description": "To paginate through to the next page. Used by 2 endpoints — required only for some (see endpoint docs)."
          },
          "pageId": {
            "title": "PageId",
            "type": "string",
            "description": "The companies ad library page id. You can get this with my Search For Companies Endpoint. Can either use this or companyName. Used by 2 endpoints — required only for some (see endpoint docs)."
          },
          "radius_km": {
            "title": "Radius Km",
            "type": "integer",
            "description": "Search radius in kilometers. Used by /v1/facebook/marketplace/search."
          },
          "search_type": {
            "title": "Search Type",
            "enum": [
              "keyword_unordered",
              "keyword_exact_phrase"
            ],
            "type": "string",
            "description": "If you want to search by exact phrase or not. Used by /v1/facebook/adLibrary/search/ads."
          },
          "start_date": {
            "title": "Start Date",
            "type": "string",
            "description": "Start date to search for. Format: YYYY-MM-DD. Used by 2 endpoints — required only for some (see endpoint docs)."
          },
          "status": {
            "title": "Status",
            "enum": [
              "ALL",
              "ACTIVE",
              "INACTIVE"
            ],
            "type": "string",
            "description": "Status of the ad. Defaults to ACTIVE. Used by 2 endpoints — required only for some (see endpoint docs)."
          },
          "time": {
            "title": "Time",
            "enum": [
              "today",
              "this_week",
              "next_week"
            ],
            "type": "string",
            "description": "The time frame to search for. Defaults to all time. Used by /v1/facebook/events."
          },
          "trim": {
            "title": "Trim",
            "type": "boolean",
            "description": "Set to true for a trimmed down version of the response. Used by 3 endpoints — required only for some (see endpoint docs)."
          },
          "urls": {
            "title": "Urls (bulk)",
            "type": "array",
            "description": "Bulk mode: up to 1000 URLs for url-based endpoints (e.g. tweet, community). One dataset row per URL. Overrides singular Url when set.",
            "items": {
              "type": "string"
            }
          },
          "concurrency": {
            "title": "Concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Parallel Lens calls during bulk runs (1–20, default 5).",
            "default": 5
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}