> **For coding agents and LLMs:** This is one page from the Social Fetch docs (markdown export). The sections below mirror the orientation block in [`/llms.txt`](https://www.socialfetch.dev/llms.txt); use [`/llms.json`](https://www.socialfetch.dev/llms.json) when you need a structured operation inventory. The catalog covers documented operations with on-site reference pages.

## This page

- **On-site (HTML):** [https://www.socialfetch.dev/docs/api/v1/facebook/ad-library/ads/get](https://www.socialfetch.dev/docs/api/v1/facebook/ad-library/ads/get)
- **Markdown (.mdx) URL:** [https://www.socialfetch.dev/docs/api/v1/facebook/ad-library/ads/get.mdx](https://www.socialfetch.dev/docs/api/v1/facebook/ad-library/ads/get.mdx)

## API base URL and authentication

- **API origin (from OpenAPI `servers`):** `https://api.socialfetch.dev`
- **Authentication:** send `x-api-key: sfk_...` on `/v1/**` routes unless the operation is explicitly anonymous (check OpenAPI `security`, the [API reference hub](https://www.socialfetch.dev/docs/api.mdx), [`/llms.txt`](https://www.socialfetch.dev/llms.txt), or [`/llms.json`](https://www.socialfetch.dev/llms.json) for each route).
- **OpenAPI JSON:** [https://www.socialfetch.dev/openapi.json](https://www.socialfetch.dev/openapi.json)

## Recommended docs entrypoints (this site)

- [Documentation overview](https://www.socialfetch.dev/docs.mdx) — top-level orientation (markdown).
- [Quickstart](https://www.socialfetch.dev/docs/quickstart.mdx) — authenticate with `x-api-key`, validate auth with `whoami`, and understand the JSON envelope.
- [SDK](https://www.socialfetch.dev/docs/sdk.mdx) — official TypeScript SDK guide, including `SocialFetchClient`, `Result`, and `unwrap()`.
- [SDK reference](https://www.socialfetch.dev/docs/sdk-reference.mdx) — exhaustive SDK method inventory and route mapping for agents, tooling, and power users.
- [Choose the right endpoint](https://www.socialfetch.dev/docs/choose-endpoint.mdx) — task-oriented route selection for smoke tests, profiles, list endpoints, and single-item lookups.
- [Capability matrix](https://www.socialfetch.dev/docs/capability-matrix.mdx) — fast comparison of identifiers, pagination, outcomes, media download, and SDK coverage.
- [`/llms.json`](https://www.socialfetch.dev/llms.json) — structured machine-readable operation inventory with parameter names, pagination, outcomes, credits, and SDK mapping.
- [API reference hub](https://www.socialfetch.dev/docs/api.mdx) — human-friendly index of operations with links into generated pages.
- [Errors](https://www.socialfetch.dev/docs/errors.mdx) — shared error envelope and HTTP status guidance.
- [Credits](https://www.socialfetch.dev/docs/credits.mdx) — metering, `402`, and planning batch jobs.
- Outcome semantics such as `found`, `not_found`, and `private` are documented in [Errors](https://www.socialfetch.dev/docs/errors.mdx) and on operation pages when present in the OpenAPI contract.

## Markdown docs convention

- Every docs page has a markdown twin: append **`.mdx`** to the docs pathname (for example `/docs/quickstart` → `/docs/quickstart.mdx`).
- Agents that send `Accept: text/markdown` on `/docs/**` HTML URLs may receive markdown directly (same URL, `Vary: Accept`).

---
# Get Facebook Ad Library ad (https://www.socialfetch.dev/docs/api/v1/facebook/ad-library/ads/get)

## Summary

Get a single Facebook Ad Library ad by archive id or public Ad Library URL.

**Tags:** `Facebook`

## HTTP

- **Method:** GET
- **Path:** `/v1/facebook/ad-library/ads`
- **Base URL:** `https://api.socialfetch.dev`

## Capability summary

- **SDK mapping:** `client.facebook.getAdLibraryAd({ adId?, url?, includeTranscript?, trim? })`
- **Accepted identifiers:** `url` (query)
- **Pagination:** none
- **Business outcome field:** `data.lookupStatus` with values `found`, `not_found`
- **Trimmed response mode:** supported via `trim=true`

## Credits

- **Base:** 1 credit per successful lookup.
- **Maximum on success (200):** 1 credit.
- **Normalization failure (502):** 1 credit charged.
- **Authoritative field:** `meta.creditsCharged`.

## Authentication

- **`x-api-key`**: API key (`sfk_...`)

## Parameters

### `adId` (query)

- **Required:** no
- **Constraints:** type `string`; minLength: 1; maxLength: 4096
- **Description:** Facebook Ad Library archive id for the ad.

### `url` (query)

- **Required:** no
- **Constraints:** type `string`; minLength: 1; maxLength: 4096
- **Description:** Public Facebook Ad Library URL for the ad.

### `includeTranscript` (query)

- **Required:** no
- **Constraints:** type `boolean`
- **Description:** When true, includes a plain-text transcript when available for the ad video.

### `trim` (query)

- **Required:** no
- **Constraints:** type `boolean`
- **Description:** When true, requests a smaller upstream payload before normalization.

## Behavior notes

- **`trim`**: When true, requests a smaller upstream payload before normalization.

## Responses (status codes)

- **200**: Ad Library ad detail (found or not found in body).
- **400**: Invalid query parameters
- **401**: Missing or invalid API key
- **402**: Insufficient credits
- **500**: Unexpected or billing error
- **502**: Lookup could not be completed from the response (unexpected or invalid data).
- **503**: Service temporarily unavailable; safe to retry with backoff.

## Response body (200)

Ad Library ad detail (found or not found in body).

### Field outline

- **data** (required) — type `object`. Endpoint-specific response payload.
  - **lookupStatus** (required) — type `string`; enum: found, not_found. Whether the ad was found in the Ad Library.
  - **ad** (required) — type `object`; nullable. Ad details when found; otherwise null.
    - **id** (required) — type `string`; minLength: 1. Stable identifier for the ad.
    - **adId** (required) — type `string`; nullable. Platform ad id when available.
    - **url** (required) — type `string`; nullable. Public Facebook Ad Library URL for this ad when available.
    - **page** (required) — type `object`. Advertiser page summary for this ad.
      - **id** (required) — type `string`; nullable. Facebook page id for the advertiser when available.
      - **name** (required) — type `string`; nullable. Display name for the advertiser page when available.
      - **url** (required) — type `string`; nullable. Public Facebook URL for the advertiser page when available.
      - **isDeleted** (required) — type `boolean`; nullable. Whether the advertiser page is marked deleted.
      - **profilePictureUrl** (required) — type `string`; nullable. Profile picture URL for the advertiser page when available.
      - **likeCount** (required) — type `integer`; minimum: 0; nullable. Advertiser page like count when available.
      - **categories** (required) — type `array`. Public categories for the advertiser page when available.
        - _items:_
          - type `string`; minLength: 1
    - **campaign** (required) — type `object`. Campaign collation metadata for this ad.
      - **collationId** (required) — type `string`; nullable. Campaign collation id when available.
      - **collationCount** (required) — type `integer`; minimum: 0; nullable. Number of ads in the campaign collation when available.
    - **isActive** (required) — type `boolean`. Whether the ad is currently active.
    - **publisherPlatforms** (required) — type `array`. Publisher platforms where the ad ran or is running.
      - _items:_
        - type `string`; minLength: 1
    - **startedAt** (required) — type `string`; nullable. ISO-8601 timestamp for when the ad started, when available.
    - **endedAt** (required) — type `string`; nullable. ISO-8601 timestamp for when the ad ended, when available.
    - **categories** (required) — type `array`. Ad categories reported by the platform.
      - _items:_
        - type `string`; minLength: 1
    - **countries** (required) — type `array`. Countries targeted or reached by the ad when available.
      - _items:_
        - type `string`; minLength: 1
    - **impressions** (required) — type `object`; nullable. Impressions metadata when available.
      - **text** (required) — type `string`; nullable. Human-readable impressions label when available.
      - **index** (required) — type `integer`; nullable. Impressions index when available.
    - **spend** (required) — type `object`; nullable. Spend metadata when available.
      - **amount** (required) — type `string`; nullable. Spend amount text when available.
      - **currency** (required) — type `string`; nullable. Currency code for spend when available.
    - **creative** (required) — type `object`. Creative content for this ad.
      - **bodyText** (required) — type `string`; nullable. Primary ad body text when available.
      - **title** (required) — type `string`; nullable. Ad title when available.
      - **caption** (required) — type `string`; nullable. Ad caption when available.
      - **linkUrl** (required) — type `string`; nullable. Primary link URL when available.
      - **linkDescription** (required) — type `string`; nullable. Link description when available.
      - **callToAction** (required) — type `string`; nullable. Call-to-action label when available.
      - **callToActionType** (required) — type `string`; nullable. Call-to-action type when available.
      - **displayFormat** (required) — type `string`; nullable. Display format for the creative when available.
      - **images** (required) — type `array`. Image assets attached to the creative.
        - _items:_
          - **url** (required) — type `string`; nullable. Image URL when available.
          - **resizedUrl** (required) — type `string`; nullable. Resized image URL when available.
          - **watermarkedResizedUrl** (required) — type `string`; nullable. Watermarked resized image URL when available.
      - **videos** (required) — type `array`. Video assets attached to the creative.
        - _items:_
          - **hdUrl** (required) — type `string`; nullable. High-definition video URL when available.
          - **sdUrl** (required) — type `string`; nullable. Standard-definition video URL when available.
          - **previewImageUrl** (required) — type `string`; nullable. Video preview image URL when available.
      - **cards** (required) — type `array`. Carousel cards attached to the creative.
        - _items:_
          - **title** (required) — type `string`; nullable. Card title when available.
          - **body** (required) — type `string`; nullable. Card body text when available.
          - **caption** (required) — type `string`; nullable. Card caption when available.
          - **linkUrl** (required) — type `string`; nullable. Card link URL when available.
          - **imageUrl** (required) — type `string`; nullable. Card image URL when available.
          - **videoUrl** (required) — type `string`; nullable. Card video URL when available.
  - **transcript** (required) — type `string`; nullable. Plain transcript text when requested and available. May be null when speech is not detected, the video exceeds supported length, or transcription is otherwise unavailable.
- **meta** (required) — type `object`. Metadata describing the request and billing outcome.
  - **requestId** (required) — type `string`; minLength: 1. Unique request identifier for tracing this API call.
  - **creditsCharged** (required) — type `integer`; minimum: 0. Credits charged for this request.
  - **version** (required) — type `string`; enum: v1. Public API version that served the response.

### Example JSON (found)

```json
{
  "data": {
    "lookupStatus": "found",
    "ad": {
      "id": "902134546059754",
      "adId": null,
      "url": "https://www.facebook.com/ads/library?id=902134546059754",
      "page": {
        "id": "170229159669841",
        "name": "Zomato",
        "url": "https://www.instagram.com/_u/hey.sanober",
        "isDeleted": false,
        "profilePictureUrl": "https://scontent-bos5-1.cdninstagram.com/v/t51.82787-19/657785441_17969434809013326_9108915003959285985_n.jpg?stp=dst-jpg_s206x206_tt6&_nc_cat=1&ccb=7-5&_nc_sid=525117&efg=eyJ2ZW5jb2RlX3RhZyI6InByb2ZpbGVfcGljLnd3dy42OTguQzMifQ%3D%3D&_nc_ohc=T-S3Zr46rmsQ7kNvwHfzZP8&_nc_oc=AdpOZ7tvtiEqmMadIZhRnDjUZDFTIJakC6HowQb7lsbVnq8bJI93SzJg7Yd-yleze14&_nc_zt=24&_nc_ht=scontent-bos5-1.cdninstagram.com&_nc_gid=QNUmkXHO6pdr5iCn_xiF3w&_nc_ss=7e289&oh=00_Af73xXQgM6A98t088fi7MRUOmqCTLPwMFZMEbNmDoI12sw&oe=6A135F97",
        "likeCount": 0,
        "categories": [
          "Profile"
        ]
      },
      "campaign": {
        "collationId": null,
        "collationCount": null
      },
      "isActive": true,
      "publisherPlatforms": [
        "facebook",
        "instagram"
      ],
      "startedAt": "2026-03-11T07:00:00.000Z",
      "endedAt": "2026-05-19T07:00:00.000Z",
      "categories": [
        "UNKNOWN"
      ],
      "countries": [],
      "impressions": {
        "text": null,
        "index": -1
      },
      "spend": null,
      "creative": {
        "bodyText": "Some days the hustle barely leaves room for lunch. That’s when I refuel with @zomato \n\nThe grind shouldn’t stop just because you’re hungry. 🍽️✨\n\n#zomato #ad",
        "title": null,
        "caption": "play.google.com",
        "linkUrl": "http://play.google.com/store/apps/details?id=com.application.zomato",
        "linkDescription": null,
        "callToAction": "Install now",
        "callToActionType": "INSTALL_MOBILE_APP",
        "displayFormat": "video",
        "images": [],
        "videos": [
          {
            "hdUrl": "https://video-bos5-1.xx.fbcdn.net/o1/v/t2/f2/m367/AQPOJ0rdHWbvKnGrmnLH4fXgNtAuaCO02CwFRR3lv4pOj_c8UKe-igTIQWUlizoiVh1QywSV30K0yS4qraL5SC2qeVBpicu27jnQl-xHFQ.mp4?_nc_cat=106&_nc_sid=8bf8fe&_nc_ht=video-bos5-1.xx.fbcdn.net&_nc_ohc=HoErQUm6xO8Q7kNvwGCB6Ll&efg=eyJ2ZW5jb2RlX3RhZyI6Inhwdl9wcm9ncmVzc2l2ZS5WSV9VU0VDQVNFX1BST0RVQ1RfVFlQRS4uQzMuNzIwLnByb2dyZXNzaXZlX2gyNjQtYmFzaWMtZ2VuMl83MjBwIiwieHB2X2Fzc2V0X2lkIjoxNzk2NTI0MTQ5MzAxMzMyNiwiYXNzZXRfYWdlX2RheXMiOjc4LCJ2aV91c2VjYXNlX2lkIjoxMDA5OSwiZHVyYXRpb25fcyI6MjUsInVybGdlbl9zb3VyY2UiOiJ3d3cifQ%3D%3D&ccb=17-1&_nc_gid=QNUmkXHO6pdr5iCn_xiF3w&_nc_ss=7e289&_nc_zt=28&oh=00_Af6Bt5qmoYbhCLmECLOdehrLw6zhAV_2XiGnZHDw63qMeQ&oe=6A136D58",
            "sdUrl": "https://video-bos5-1.xx.fbcdn.net/o1/v/t2/f2/m367/AQMVefbS2ttuIJC8Oa_BBsrjByLjf_emvT42zj7ZsbGnex9__UCOHkNDPHN6DGoqrYmCKom3UjBWTiFT1Oaviq0Cf9Ev2aMCv_mG_ifgHw.mp4?_nc_cat=102&_nc_sid=8bf8fe&_nc_ht=video-bos5-1.xx.fbcdn.net&_nc_ohc=PIInzVOSQ8wQ7kNvwGfyhdp&efg=eyJ2ZW5jb2RlX3RhZyI6Inhwdl9wcm9ncmVzc2l2ZS5WSV9VU0VDQVNFX1BST0RVQ1RfVFlQRS4uQzMuMzYwLnByb2dyZXNzaXZlX2gyNjQtYmFzaWMtZ2VuMl8zNjBwIiwieHB2X2Fzc2V0X2lkIjoxNzk2NTI0MTQ5MzAxMzMyNiwiYXNzZXRfYWdlX2RheXMiOjc4LCJ2aV91c2VjYXNlX2lkIjoxMDA5OSwiZHVyYXRpb25fcyI6MjUsInVybGdlbl9zb3VyY2UiOiJ3d3cifQ%3D%3D&ccb=17-1&_nc_gid=QNUmkXHO6pdr5iCn_xiF3w&_nc_ss=7e289&_nc_zt=28&oh=00_Af6qJZzlBXiILYAikEfajoM7nd6qWLWwbIyXhcppCP03TA&oe=6A136CE4",
            "previewImageUrl": "https://scontent-bos5-1.xx.fbcdn.net/v/t39.35426-6/649376900_978249861203086_2417192780715376312_n.jpg?_nc_cat=109&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=HRJFID7echsQ7kNvwFg44gg&_nc_oc=AdqPXkDOWlmsTotpUK6JbhrbvaLuAgVKZrLEJhKXfGX5IXfwvQX7vTd8YBA8N5x_4A0&_nc_zt=14&_nc_ht=scontent-bos5-1.xx&_nc_gid=QNUmkXHO6pdr5iCn_xiF3w&_nc_ss=7e289&oh=00_Af6Q-75n7Vj7ldBhf3l9sCfDHE1qNNs_t9Kb7E4mTZUBUA&oe=6A136CCB"
          }
        ],
        "cards": []
      }
    },
    "transcript": null
  },
  "meta": {
    "requestId": "req_01example",
    "creditsCharged": 1,
    "version": "v1"
  }
}
```

### Example JSON (withTranscript)

```json
{
  "data": {
    "lookupStatus": "found",
    "ad": {
      "id": "902134546059754",
      "adId": null,
      "url": "https://www.facebook.com/ads/library?id=902134546059754",
      "page": {
        "id": "170229159669841",
        "name": "Zomato",
        "url": "https://www.instagram.com/_u/hey.sanober",
        "isDeleted": false,
        "profilePictureUrl": "https://scontent-lga3-3.cdninstagram.com/v/t51.82787-19/657785441_17969434809013326_9108915003959285985_n.jpg?stp=dst-jpg_s206x206_tt6&_nc_cat=1&ccb=7-5&_nc_sid=525117&efg=eyJ2ZW5jb2RlX3RhZyI6InByb2ZpbGVfcGljLnd3dy42OTguQzMifQ%3D%3D&_nc_ohc=T-S3Zr46rmsQ7kNvwHdJsFM&_nc_oc=AdoiPEr5llETnXfs_rf-8Q2EsKdk_y_xot2CDqB-Z_5ZqCvFPYGnd58R3ny6s4VVCVU&_nc_zt=24&_nc_ht=scontent-lga3-3.cdninstagram.com&_nc_gid=djzVdTl37Q6nr4O7QmDJDw&_nc_ss=7e289&oh=00_Af4FwEcgaxhYLbZpoCUdHwMiDDt3FRsL_hcdaUIwQMHk-Q&oe=6A135F97",
        "likeCount": 0,
        "categories": [
          "Profile"
        ]
      },
      "campaign": {
        "collationId": null,
        "collationCount": null
      },
      "isActive": true,
      "publisherPlatforms": [
        "facebook",
        "instagram"
      ],
      "startedAt": "2026-03-11T07:00:00.000Z",
      "endedAt": "2026-05-19T07:00:00.000Z",
      "categories": [
        "UNKNOWN"
      ],
      "countries": [],
      "impressions": {
        "text": null,
        "index": -1
      },
      "spend": null,
      "creative": {
        "bodyText": "Some days the hustle barely leaves room for lunch. That’s when I refuel with @zomato \n\nThe grind shouldn’t stop just because you’re hungry. 🍽️✨\n\n#zomato #ad",
        "title": null,
        "caption": "play.google.com",
        "linkUrl": "http://play.google.com/store/apps/details?id=com.application.zomato",
        "linkDescription": null,
        "callToAction": "Install now",
        "callToActionType": "INSTALL_MOBILE_APP",
        "displayFormat": "video",
        "images": [],
        "videos": [
          {
            "hdUrl": "https://video-lga3-3.xx.fbcdn.net/o1/v/t2/f2/m367/AQPOJ0rdHWbvKnGrmnLH4fXgNtAuaCO02CwFRR3lv4pOj_c8UKe-igTIQWUlizoiVh1QywSV30K0yS4qraL5SC2qeVBpicu27jnQl-xHFQ.mp4?_nc_cat=106&_nc_sid=8bf8fe&_nc_ht=video-lga3-3.xx.fbcdn.net&_nc_ohc=HoErQUm6xO8Q7kNvwGP4ANB&efg=eyJ2ZW5jb2RlX3RhZyI6Inhwdl9wcm9ncmVzc2l2ZS5WSV9VU0VDQVNFX1BST0RVQ1RfVFlQRS4uQzMuNzIwLnByb2dyZXNzaXZlX2gyNjQtYmFzaWMtZ2VuMl83MjBwIiwieHB2X2Fzc2V0X2lkIjoxNzk2NTI0MTQ5MzAxMzMyNiwiYXNzZXRfYWdlX2RheXMiOjc4LCJ2aV91c2VjYXNlX2lkIjoxMDA5OSwiZHVyYXRpb25fcyI6MjUsInVybGdlbl9zb3VyY2UiOiJ3d3cifQ%3D%3D&ccb=17-1&_nc_gid=djzVdTl37Q6nr4O7QmDJDw&_nc_ss=7e289&_nc_zt=28&oh=00_Af4UjTL6KMBfx43jiXYZj6k5nyjH6JWvnJ7tt-4W0qAWCA&oe=6A136D58",
            "sdUrl": "https://video-lga3-3.xx.fbcdn.net/o1/v/t2/f2/m367/AQMVefbS2ttuIJC8Oa_BBsrjByLjf_emvT42zj7ZsbGnex9__UCOHkNDPHN6DGoqrYmCKom3UjBWTiFT1Oaviq0Cf9Ev2aMCv_mG_ifgHw.mp4?_nc_cat=102&_nc_sid=8bf8fe&_nc_ht=video-lga3-3.xx.fbcdn.net&_nc_ohc=PIInzVOSQ8wQ7kNvwFr4N8F&efg=eyJ2ZW5jb2RlX3RhZyI6Inhwdl9wcm9ncmVzc2l2ZS5WSV9VU0VDQVNFX1BST0RVQ1RfVFlQRS4uQzMuMzYwLnByb2dyZXNzaXZlX2gyNjQtYmFzaWMtZ2VuMl8zNjBwIiwieHB2X2Fzc2V0X2lkIjoxNzk2NTI0MTQ5MzAxMzMyNiwiYXNzZXRfYWdlX2RheXMiOjc4LCJ2aV91c2VjYXNlX2lkIjoxMDA5OSwiZHVyYXRpb25fcyI6MjUsInVybGdlbl9zb3VyY2UiOiJ3d3cifQ%3D%3D&ccb=17-1&_nc_gid=djzVdTl37Q6nr4O7QmDJDw&_nc_ss=7e289&_nc_zt=28&oh=00_Af6E1rWpLNCZ2lSlvgDB_m5NMNi_n-u1hS17_l_whgI_Vw&oe=6A136CE4",
            "previewImageUrl": "https://scontent-lga3-1.xx.fbcdn.net/v/t39.35426-6/649376900_978249861203086_2417192780715376312_n.jpg?_nc_cat=109&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=HRJFID7echsQ7kNvwEPvDE9&_nc_oc=Ado4DIQpNWR0y-C1URv5M-PxcZrww8K9m3VWVwJeEkPKDM1qqJ7Xs_OBxj9LVkqWiU4&_nc_zt=14&_nc_ht=scontent-lga3-1.xx&_nc_gid=djzVdTl37Q6nr4O7QmDJDw&_nc_ss=7e289&oh=00_Af79rIczKdLtDPLfcvBIJQhZtC3vlX-QPC-W5QE5D2BVtg&oe=6A136CCB"
          }
        ],
        "cards": []
      }
    },
    "transcript": "Nobody tells you that running a business means sometimes you just don't have time to eat. I just mean you don't wanna deal with me when I'm hungry. Luckily I have my mom with me who cooks all the meals for me and feeds my soul, but when she's not around you know who sorts me out. You know who, who else? So when I'm all neck deep in work, I don't really pause. I refuel without breaking my rhythm with Zomato. Do you?"
  },
  "meta": {
    "requestId": "req_01example",
    "creditsCharged": 1,
    "version": "v1"
  }
}
```

### Example JSON (not_found)

```json
{
  "data": {
    "lookupStatus": "not_found",
    "ad": null,
    "transcript": null
  },
  "meta": {
    "requestId": "req_01example",
    "creditsCharged": 1,
    "version": "v1"
  }
}
```

### Machine-readable error codes

When an error JSON body is returned, it may include one of these `error.code` values (derived from the OpenAPI schemas for this operation; additional codes may exist at runtime):

- `bad_request`

## Error handling & retries

Interpret HTTP status codes using the descriptions below. Do not assume a JSON body unless the OpenAPI schema defines one for that status.

- **400**: Invalid query parameters **Retry:** Fix the request; retrying the same invalid payload will not help.
- **401**: Missing or invalid API key **Retry:** Fix the API key first; retrying without changes will not help.
- **402**: Insufficient credits **Retry:** Do not retry without resolving billing/credits (retrying the same request will not help).
- **500**: Unexpected or billing error
- **502**: Lookup could not be completed from the response (unexpected or invalid data). **Retry:** May be transient; a few retries with backoff are reasonable.
- **503**: Service temporarily unavailable; safe to retry with backoff. **Retry:** Usually safe to retry with exponential backoff and jitter.

### Suggested client defaults

- Send the API key using the `x-api-key` header on every request.
- On `503` (and sometimes `502`), retry with backoff; cap retries and surface a clear error to the user.
- On `402`, surface an actionable billing message rather than blind retries.

## Examples

### TypeScript SDK

```typescript
import { SocialFetchClient } from "@socialfetch/sdk";

const client = new SocialFetchClient({
  apiKey: process.env.SOCIALFETCH_API_KEY!,
});

const result = await client.facebook.getAdLibraryAd();

if (!result.ok) {
  console.error(result.error);
} else {
  console.log(result.value.data);
}
```

### Node.js

```javascript
const response = await fetch(
  "https://api.socialfetch.dev/v1/facebook/ad-library/ads",
  {
    headers: {
      "x-api-key": "YOUR_API_KEY",
    }
  }
);

const data = await response.json();
console.log(data);
```

### cURL

```bash
curl "https://api.socialfetch.dev/v1/facebook/ad-library/ads" \
  -H "x-api-key: YOUR_API_KEY"
```

### Python

```python
import requests

response = requests.get(
    "https://api.socialfetch.dev/v1/facebook/ad-library/ads",
    headers={"x-api-key": "YOUR_API_KEY"},
)
data = response.json()
print(data)
```

### Example: optional query parameters

First request illustrating common optional query flags (adjust values to your integration):

```javascript
const url = "https://api.socialfetch.dev/v1/facebook/ad-library/ads?trim=true";
const response = await fetch(url, {
  headers: { "x-api-key": "YOUR_API_KEY" },
});
const data = await response.json();
```