{
  "openapi": "3.1.0",
  "info": {
    "title": "Social Media Scraper API",
    "version": "2026-11-23.2",
    "description": "197 customer operations; four upstream account operations are internal only. Send authenticated requests with the documented inputs and published price version."
  },
  "servers": [
    {
      "url": "https://socialmediascraper.org"
    }
  ],
  "paths": {
    "/v1/tiktok/ad_library_search": {
      "get": {
        "operationId": "tiktok_ad_library_search",
        "summary": "TikTok Ad Library Search API",
        "tags": [
          "tiktok"
        ],
        "description": "Search TikTok Ad Library records by keyword to find public advertising examples.",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Search text used to find matching public content.",
            "example": "The Creator Loop"
          },
          {
            "name": "advertiser_name",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Company or advertiser name used to find matching public records.",
            "example": "Gymshark"
          },
          {
            "name": "adv_biz_ids",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Advertiser business identifier used by tiktok. Send the identifier as text to preserve its full value.",
            "example": "7078923208527618049"
          },
          {
            "name": "start_time",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Beginning of the time range used to filter results.",
            "example": "1790812800"
          },
          {
            "name": "end_time",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "End of the time range used to filter results.",
            "example": "1793491200"
          },
          {
            "name": "region",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "AT",
                "BE",
                "BG",
                "BR",
                "CH",
                "CY",
                "CZ",
                "DE",
                "DK",
                "EE",
                "ES",
                "FI",
                "FR",
                "GB",
                "GR",
                "HR",
                "HU",
                "IE",
                "IS",
                "IT",
                "LI",
                "LT",
                "LU",
                "LV",
                "MT",
                "NL",
                "NO",
                "PL",
                "PT",
                "RO",
                "SE",
                "SI",
                "SK",
                "TR"
              ],
              "default": "all"
            },
            "description": "Country or region filter for the selected operation. Use the codes accepted below.",
            "example": "all"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Continuation value from the preceding response. Keep the other search or target parameters unchanged when loading the next page.",
            "example": "cursor from previous response"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          },
          {
            "name": "x-price-version",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Pin the expected request-price version before billing."
          }
        ],
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "JSON response containing request identity, normalized operation data and metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "request_id",
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                },
                "example": {
                  "request_id": "example-request-id",
                  "data": {
                    "platform": "tiktok",
                    "resource": "ad_library_search",
                    "items": [
                      {
                        "id": "123456789",
                        "position": 0,
                        "url": "https://example.com/public-content",
                        "title": "Example public content",
                        "text": "Example public content",
                        "published_at": null,
                        "author": {
                          "id": "123456789",
                          "handle": "example",
                          "display_name": "Example creator"
                        },
                        "metrics": {
                          "views": null,
                          "likes": 12,
                          "comments": null,
                          "shares": null
                        }
                      }
                    ],
                    "cursor": null
                  },
                  "meta": {
                    "platform": "tiktok",
                    "fetched_at": "2026-11-28T00:00:00.000Z",
                    "cached": false,
                    "schema_version": "2026-11-23.2",
                    "route_version": 1,
                    "billing": {
                      "capability": "tiktok.ad_library_search",
                      "version": "2026-11-23.retail-1",
                      "currency": "USD",
                      "unit_scale": 1000000000,
                      "amount_units": 2444000,
                      "amount_usd": "0.002444000",
                      "billing_basis": "request"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid API key"
          },
          "402": {
            "description": "Insufficient credits"
          },
          "429": {
            "description": "Customer request rate or concurrency limit. Follow Retry-After and retain the original request identity."
          },
          "503": {
            "description": "Service temporarily unavailable"
          }
        },
        "x-live-status": "verified",
        "x-response-kind": "search",
        "x-price": {
          "capability": "tiktok.ad_library_search",
          "version": "2026-11-23.retail-1",
          "currency": "USD",
          "unit_scale": 1000000000,
          "amount_units": 2444000,
          "amount_usd": "0.002444000",
          "billing_basis": "request"
        },
        "x-pagination-fields": [
          "cursor"
        ],
        "x-required-any-of": [],
        "x-parameter-rules": {
          "exactlyOneOf": [
            [
              "query",
              "advertiser_name"
            ]
          ],
          "requires": {
            "adv_biz_ids": [
              "advertiser_name"
            ],
            "start_time": [
              "end_time"
            ],
            "end_time": [
              "start_time"
            ]
          },
          "unixTimeRange": [
            "start_time",
            "end_time"
          ]
        },
        "x-input-rules": [
          "Provide exactly one of: query, advertiser_name.",
          "When sending adv_biz_ids, also send: advertiser_name.",
          "When sending start_time, also send: end_time.",
          "When sending end_time, also send: start_time.",
          "Use Unix time values for start_time, end_time; the start must precede the end."
        ],
        "x-documentation-url": "https://socialmediascraper.org/apis/tiktok/ad_library_search/",
        "x-markdown-url": "https://socialmediascraper.org/api-reference/tiktok.ad_library_search.md"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  }
}
