Facebook Ad Library ad transcript API

Transcript of a video ad.

GETapi.socialscrape.io/v1/facebook/ad-library/ad/transcript
Cost
1 creditAI transcription is billed by the started minute after 2
Cached repeats
0 creditssend max_age_days, results kept 30 days
Failed requests
0 credits
Status
Betashape may still gain fields

Ad Library videos carry no caption tracks, so this is always AI transcription of the audio, billed by the length of the audio. An ad with no video answers an unbilled error.

You send one of id or url.

Request

Send your key in the x-api-key header.

curl
curl -G "https://api.socialscrape.io/v1/facebook/ad-library/ad/transcript" \
  -H "x-api-key: $SOCIALSCRAPE_API_KEY" \
  --data-urlencode 'id=352695862528588'
Python
import os
import requests

params = {
    "id": "352695862528588",
}
res = requests.get(
    "https://api.socialscrape.io/v1/facebook/ad-library/ad/transcript",
    headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
    params=params,
    timeout=60,
)
body = res.json()

if body["ok"]:
    print(body["data"])
else:
    print(body["error"]["code"], body["error"]["message"])
TypeScript
const url = new URL("https://api.socialscrape.io/v1/facebook/ad-library/ad/transcript");
url.search = new URLSearchParams({
  id: "352695862528588",
}).toString();
const res = await fetch(url, {
  headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();

if (body.ok) {
  console.log(body.data);
} else {
  console.error(body.error.code, body.error.message);
}
n8n
{
  "nodes": [
    {
      "name": "SocialScrape Facebook Ad Library ad transcript",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "method": "GET",
        "url": "https://api.socialscrape.io/v1/facebook/ad-library/ad/transcript",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "id",
              "value": "352695862528588"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
            }
          ]
        }
      }
    }
  ],
  "connections": {}
}

Parameters

NameTypeRequiredDescription
idstringone ofAd id in the library. Also accepted as ad_id, adId.
urlurlone ofAd Library URL (facebook.com/ads/library/?id=...).

Every request also accepts trim, raw and max_age_days.

Response

Sample from a recorded response, shortened. Values are public data, not yours.

Status 200Sample
{
  "ok": true,
  "credits_charged": 1,
  "credits_remaining": 4999,
  "cached": false,
  "cached_at": null,
  "request_id": "req_63eae290249d0c81df4c4ff3",
  "data": {
    "object": "transcript",
    "platform": "facebook",
    "video_id": "352695862528588",
    "url": "https://www.facebook.com/ads/library/?id=352695862528588",
    "language": "en",
    "source": "ai",
    "duration_seconds": 30,
    "text": "canned transcript for the fixture, not the ad's real audio",
    "segments": [
      {
        "start": 0,
        "end": 4,
        "text": "canned transcript for the fixture,"
      },
      {
        "start": 4,
        "end": 30,
        "text": "not the ad's real audio"
      }
    ],
    "available_languages": null,
    "extra": {
      "media_seconds": 30
    }
  },
  "cursor": null,
  "has_more": null
}

Fields

One Transcript in data.

A field the platform does not give is null, never made up. Extra platform details are in extra.

FieldTypeAlwaysNotes
object"transcript"
platformPlatformyes
video_idstring or null
urlstring or null
languagestring or nullBCP 47, "en"
source"captions" or "auto_captions" or "ai"yes
duration_secondsnumber or null
textstringyes
segmentsTranscriptSegment[] or null
available_languagesstring[] or null
extraobject or null

Full field list in the reference for this endpoint and the data models. Errors are listed under Errors.

Questions

Which errors can it return?

invalid_params (do not retry), unsupported_url (do not retry), not_found (do not retry), transcript_unavailable (do not retry). Account and platform errors from the errors list can also happen. A failure always costs 0 credits.

Is there an SDK call for it?

The preview Python client has client.facebook.ad_library_ad_transcript(...) and the TypeScript client client.facebook.adLibraryAdTranscript(). Both return the same envelope as the HTTP API. The packages are not published yet; plain HTTP works today in any language.

Can an AI agent call it?

Yes. The MCP server reaches every built endpoint, with the same prices.

Build on social data early.

Developers and agent builders get the first keys.

Get early access