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

# Meta Ads Search API

> One page of keyword search results across active/inactive ads.



## OpenAPI

````yaml openapi.json GET /v1/meta-ads/search
openapi: 3.0.0
info:
  title: ScoutLayer API
  version: 1.0.0
  description: Competitor data. One API.
servers:
  - url: https://api.scoutlayer.io
    description: Production
security:
  - ApiKeyAuth: []
  - BearerAuth: []
paths:
  /v1/meta-ads/search:
    get:
      tags:
        - meta-ads
        - search
      summary: Search the Meta Ad Library by keyword
      description: One page of keyword search results across active/inactive ads.
      parameters:
        - schema:
            type: string
            minLength: 1
            example: email marketing
          required: true
          name: query
          in: query
        - schema:
            type: string
            example: US
          required: false
          name: country
          in: query
        - schema:
            type: string
          required: false
          name: cursor
          in: query
      responses:
        '200':
          description: Search the Meta Ad Library by keyword
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdList'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: Insufficient credits
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: This endpoint is declared but not yet implemented — never charged
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: The orchestrator failed or was unreachable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
components:
  schemas:
    AdList:
      type: object
      properties:
        ads:
          type: array
          items:
            $ref: '#/components/schemas/Ad'
        nextCursor:
          type: string
          nullable: true
          description: >-
            Opaque pagination cursor — pass as ?cursor= for the next page; null
            on the last page
        hasMore:
          type: boolean
      required:
        - ads
        - nextCursor
        - hasMore
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: NOT_FOUND
            message:
              type: string
          required:
            - code
            - message
      required:
        - error
    Ad:
      type: object
      properties:
        adId:
          type: string
          description: >-
            Stable id ScoutLayer assigns — pass this straight into the matching
            ads.get endpoint, ScoutLayer resolves it back to whatever
            URL/id-pair the underlying network actually needs
        advertiserId:
          type: string
        advertiserName:
          type: string
        isActive:
          type: boolean
          nullable: true
        firstShownAt:
          type: string
          nullable: true
        lastShownAt:
          type: string
          nullable: true
        format:
          type: string
          enum:
            - text
            - image
            - video
            - carousel
            - unknown
        platforms:
          type: array
          items:
            type: string
          description: >-
            Where the ad ran (e.g. facebook, instagram) — only Meta reports this
            today, other networks return []
        creative:
          type: object
          properties:
            title:
              type: string
              nullable: true
            body:
              type: string
              nullable: true
            ctaText:
              type: string
              nullable: true
            imageUrls:
              type: array
              items:
                type: string
            videoUrls:
              type: array
              items:
                type: string
          required:
            - title
            - body
            - ctaText
            - imageUrls
            - videoUrls
        landingUrl:
          type: string
          nullable: true
        previewUrl:
          type: string
          nullable: true
        metrics:
          type: object
          properties:
            impressions:
              type: integer
              nullable: true
              description: Only TikTok reports this
            spend:
              type: string
              nullable: true
              description: TikTok reports a range, not a precise value (e.g. "$100-$199")
            audienceSize:
              type: string
              nullable: true
              description: TikTok only
          required:
            - impressions
            - spend
            - audienceSize
        checkedAt:
          type: string
      required:
        - adId
        - advertiserId
        - advertiserName
        - isActive
        - firstShownAt
        - lastShownAt
        - format
        - platforms
        - creative
        - landingUrl
        - previewUrl
        - metrics
        - checkedAt
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key passed as the X-API-Key request header. Recommended for
        server-to-server calls.
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key (or OAuth token) passed as a Bearer token in the Authorization
        header.

````