> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vexqo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Facebook Ad Search



## OpenAPI

````yaml https://api.vexqo.dev/openapi.json get /facebook/ads
openapi: 3.1.0
info:
  title: Vexqo API
  description: >-
    Public Meta Ad Library, Reddit, Hacker News, Product Hunt, eBay, TikTok and
    Instagram data. Authenticate with X-API-Key. Follow response links for
    related resources and supported pagination; each collection request can use
    credits. Social lookups are fresh by default; max_age explicitly allows
    cached public data.
  version: 0.1.0
servers:
  - url: https://api.vexqo.dev
security: []
paths:
  /facebook/ads:
    get:
      summary: Facebook Ad Search
      operationId: facebook_ad_search_facebook_ads_get
      parameters:
        - name: q
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 100
              - type: 'null'
            title: Q
        - name: page_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                pattern: ^[0-9]+$
              - type: 'null'
            title: Page Id
        - name: search_type
          in: query
          required: false
          schema:
            enum:
              - keyword_unordered
              - keyword_exact_phrase
            type: string
            default: keyword_unordered
            title: Search Type
        - name: country
          in: query
          required: false
          schema:
            type: string
            pattern: ^([A-Za-z]{2}|[Aa][Ll][Ll])$
            default: ALL
            title: Country
        - name: active_status
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/ActiveStatus'
              - type: 'null'
            description: >-
              `active` keeps the ads that run now, `inactive` the ads that
              stopped, `all` both. Without it: `active`, or `all` when
              `end_date` is a day before today, since few ads of a past period
              still run.
            title: Active Status
          description: >-
            `active` keeps the ads that run now, `inactive` the ads that
            stopped, `all` both. Without it: `active`, or `all` when `end_date`
            is a day before today, since few ads of a past period still run.
        - name: ad_type
          in: query
          required: false
          schema:
            enum:
              - all
              - political_and_issue_ads
              - housing_ads
              - employment_ads
              - credit_ads
            type: string
            default: all
            title: Ad Type
        - name: media_type
          in: query
          required: false
          schema:
            enum:
              - all
              - image
              - video
              - meme
              - image_and_meme
              - none
            type: string
            default: all
            title: Media Type
        - name: start_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            description: >-
              The first day of a period, as YYYY-MM-DD. The search keeps the ads
              that ran on a day of the period, whenever they started: it does
              not select by the day an ad started. Each ad says that day as
              `start_date`. Days are the Ad Library's, which begin at midnight
              Pacific time.
            title: Start Date
          description: >-
            The first day of a period, as YYYY-MM-DD. The search keeps the ads
            that ran on a day of the period, whenever they started: it does not
            select by the day an ad started. Each ad says that day as
            `start_date`. Days are the Ad Library's, which begin at midnight
            Pacific time.
        - name: end_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            description: >-
              The last day of the period, as YYYY-MM-DD, counted in. The same
              day as `start_date` asks for one day.
            title: End Date
          description: >-
            The last day of the period, as YYYY-MM-DD, counted in. The same day
            as `start_date` asks for one day.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            default: 30
            title: Limit
        - name: include_products
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Include Products
        - name: include_page_info
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Include Page Info
        - name: view
          in: query
          required: false
          schema:
            enum:
              - raw
              - compact
            type: string
            description: >-
              Raw source fields (default), or compact ads with complete creative
              groups and no empty optional fields. No collection or credit
              difference.
            default: raw
            title: View
          description: >-
            Raw source fields (default), or compact ads with complete creative
            groups and no empty optional fields. No collection or credit
            difference.
        - name: include_ad_details
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              Fetch each returned ad's detail panel. Costs the ad-detail rate
              (normally 2 credits) per available panel, in addition to search.
              Up to 30 extra seconds; partial outcomes are reported per ad.
              Defaults to false.
            default: false
            title: Include Ad Details
          description: >-
            Fetch each returned ad's detail panel. Costs the ad-detail rate
            (normally 2 credits) per available panel, in addition to search. Up
            to 30 extra seconds; partial outcomes are reported per ad. Defaults
            to false.
        - name: include_creative_assets
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              Include an index of usable copy and media from the snapshot and
              its cards, with source paths. No extra credits; increases response
              size. Defaults to false.
            default: false
            title: Include Creative Assets
          description: >-
            Include an index of usable copy and media from the snapshot and its
            cards, with source paths. No extra credits; increases response size.
            Defaults to false.
        - name: platforms
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 120
              - type: 'null'
            title: Platforms
        - name: languages
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 120
              - type: 'null'
            title: Languages
        - name: sort_by
          in: query
          required: false
          schema:
            enum:
              - total_impressions
              - relevancy_monthly_grouped
            type: string
            default: total_impressions
            title: Sort By
        - name: cursor
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                minLength: 2
                maxLength: 4200
              - type: 'null'
            title: Cursor
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetaSearchResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    ActiveStatus:
      type: string
      enum:
        - active
        - inactive
        - all
    MetaSearchResponse:
      properties:
        search_parameters:
          additionalProperties: true
          type: object
          title: Search Parameters
        search_information:
          $ref: '#/components/schemas/SearchInformation'
        ads:
          items:
            $ref: '#/components/schemas/MetaAd'
          type: array
          title: Ads
        links:
          $ref: '#/components/schemas/ResponseLinks'
        response_metadata:
          additionalProperties: true
          type: object
          title: Response Metadata
      additionalProperties: true
      type: object
      required:
        - search_parameters
        - search_information
        - ads
        - links
        - response_metadata
      title: MetaSearchResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SearchInformation:
      properties:
        total_results:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Results
        ads_returned:
          type: integer
          minimum: 0
          title: Ads Returned
        has_more:
          type: boolean
          title: Has More
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Cursor
        refused_requests:
          type: integer
          minimum: 0
          title: Refused Requests
      additionalProperties: true
      type: object
      required:
        - total_results
        - ads_returned
        - has_more
        - next_cursor
        - refused_requests
      title: SearchInformation
    MetaAd:
      properties:
        ad_archive_id:
          type: string
          title: Ad Archive Id
        page_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Page Id
        page_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Page Name
        is_active:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Active
        snapshot:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Snapshot
          description: >-
            Present in view=raw; Meta source fields, including nulls and
            templates.
        creatives:
          anyOf:
            - items:
                $ref: '#/components/schemas/Creative'
              type: array
            - type: 'null'
          title: Creatives
          description: >-
            Present in view=compact when usable creative groups were captured.
            No truncation.
        ad_details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Ad Details
        ad_details_status:
          anyOf:
            - type: string
              enum:
                - available
                - unavailable
                - failed
                - skipped
            - type: 'null'
          title: Ad Details Status
        ad_details_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Ad Details Reason
        links:
          $ref: '#/components/schemas/AdLinks'
      additionalProperties: true
      type: object
      required:
        - ad_archive_id
        - links
      title: MetaAd
    ResponseLinks:
      properties:
        self:
          type: string
          title: Self
        next:
          anyOf:
            - type: string
            - type: 'null'
          title: Next
      additionalProperties: true
      type: object
      required:
        - self
      title: ResponseLinks
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    Creative:
      properties:
        source:
          type: string
          title: Source
          description: >-
            Source group, such as snapshot.cards[0]. Groups are not inferred
            combinations.
        text:
          anyOf:
            - type: string
            - type: 'null'
          title: Text
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        destination_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Destination Url
        cta:
          anyOf:
            - type: string
            - type: 'null'
          title: Cta
        images:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Images
        videos:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Videos
      additionalProperties: true
      type: object
      required:
        - source
      title: Creative
    AdLinks:
      properties:
        details:
          type: string
          title: Details
        advertiser:
          anyOf:
            - type: string
            - type: 'null'
          title: Advertiser
      additionalProperties: true
      type: object
      required:
        - details
      title: AdLinks
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.