superagnt_
Meta Ads Library Search

Fetch Search Ads Pages (POST)

POST/fetch_search_ads_pages
priced per calljson responserest · mcp
01// about this endpoint

Access Facebook data through agntdata: Fetch Search Ads Pages (POST). This endpoint retrieves detailed information about ad pages based on a search query, returning up to 26 ads per request. Use the end_cursor parameter to retrieve additional ads if needed. Responses are structured JSON for AI agents, analytics, and automation — one API key instead of juggling upstream accounts. Ideal when you need page and group posts, marketplace listings, video content, and ad discovery programmatically.

02// code samples

Call it over REST

Authenticate with a bearer token against https://api.agntdata.dev. Swap the placeholders for your key and parameter values.

curlbash
curl -s -X POST "https://api.agntdata.dev/fetch_search_ads_pages" \
  -H "Authorization: Bearer <YOUR_AGNTDATA_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{ "query": "<string>", "ad_page_id": "<string>" }'
03// give it to your agent

Copy-paste prompt

Paste this into a coding agent. It connects the superagnt MCP server, finds the tool data_facebook_fetch_search_ads_pages_post, and runs a first call — with the REST fallback if MCP is unavailable.

agent prompttext
You are wiring up the agntdata "Facebook" API to use this endpoint: Fetch Search Ads Pages (POST).

1. CONNECT over MCP (preferred). Add the superagnt MCP server, then let the client
   run OAuth on first tool call — no token to paste:
     claude mcp add --scope user --transport http superagnt https://mcp.superagnt.com/mcp
     claude mcp login superagnt
   MCP endpoint: https://mcp.superagnt.com/mcp
   After connecting, the tool you want is named exactly:
     data_facebook_fetch_search_ads_pages_post
   Call agnt_tools_search or agnt_tools_list_enabled to confirm it is available.

2. REST fallback (if you are not using MCP):
     POST https://api.agntdata.dev/fetch_search_ads_pages
     Header: Authorization: Bearer <YOUR_AGNTDATA_API_KEY>
   Required parameters:
    - (none)
   Optional parameters:
    - query (string, optional) — Search query string
    - ad_page_id (string, optional) — Facebook Ad Page ID. Used only if query is not provided.
    - country (string, optional) — Country filter (e.g. ALL, US, GB)
    - activeStatus (string, optional) — Filter by active status (e.g. ALL, ACTIVE, INACTIVE)
    - end_cursor (string, optional) — Pagination cursor for next page of results
    - after_time (string, optional) — Filter ads created after this time
    - before_time (string, optional) — Filter ads created before this time
    - sort_data (string, optional) — Sort order for results

3. COST & KEY. This endpoint is priced per call in credits, and each successful response reports its own cost in its meta.costCents field. Only successful calls are charged.
   Get an agntdata API key at https://app.agntdata.dev.

4. TEST. Connect the server (or set the key), discover the tool
   (data_facebook_fetch_search_ads_pages_post), run one minimal call with just the required parameters,
   and report back the shape of the JSON response (top-level fields).

Reference (machine-readable variant): https://superagnt.com/docs/apis/social/facebook/endpoints/Fetch_Search_Ads_Pages__POST.md
mcp tool definitionjson
{
  "name": "fetch_search_ads_pages_post",
  "description": "This endpoint retrieves detailed information about ad pages based on a search query, returning up to 26 ads per request. Use the end_cursor parameter to retrieve additional ads if needed.",
  "parameters": {
    "type": "object",
    "properties": {
      "query": {
        "type": "string",
        "default": "",
        "description": "Search query string"
      },
      "ad_page_id": {
        "type": "string",
        "default": "1633779800049051",
        "description": "Facebook Ad Page ID. Used only if query is not provided."
      },
      "country": {
        "type": "string",
        "default": "ALL",
        "description": "Country filter (e.g. ALL, US, GB)"
      },
      "activeStatus": {
        "type": "string",
        "default": "ALL",
        "description": "Filter by active status (e.g. ALL, ACTIVE, INACTIVE)"
      },
      "end_cursor": {
        "type": "string",
        "default": "",
        "description": "Pagination cursor for next page of results"
      },
      "after_time": {
        "type": "string",
        "default": "",
        "description": "Filter ads created after this time"
      },
      "before_time": {
        "type": "string",
        "default": "",
        "description": "Filter ads created before this time"
      },
      "sort_data": {
        "type": "string",
        "default": "",
        "description": "Sort order for results"
      }
    },
    "required": []
  }
}
04// parameters
NameInTypeRequiredDescription
querybodystringoptionalSearch query string
ad_page_idbodystringoptionalFacebook Ad Page ID. Used only if query is not provided.
countrybodystringoptionalCountry filter (e.g. ALL, US, GB)
activeStatusbodystringoptionalFilter by active status (e.g. ALL, ACTIVE, INACTIVE)
end_cursorbodystringoptionalPagination cursor for next page of results
after_timebodystringoptionalFilter ads created after this time
before_timebodystringoptionalFilter ads created before this time
sort_databodystringoptionalSort order for results
05// responses

Successful response

200json
{
  "type": "object"
}
06// pricing
priced per call

This endpoint is priced per call and deducted from your agntdata balance; only a successful call is billed. Every billable response reports its own cost in meta.costCents.

Get a key at app.agntdata.dev.

07// related endpoints
08// more from Facebook

start calling

Point your client at https://mcp.superagnt.com/mcp and your agent has this endpoint, plus every other source on one balance.

Start free
Facebook APIFacebook data APIfetch search ads pages (post) APIAI agents data APIFacebook APIFacebook data APIFacebook for AI agents