Ad Swipe File public API
A small JSON API over the Ad Swipe File ad library, for accounts on Pro, Agency or their 7-day free trial. Account endpoints cover your saved ads, boards and followed brands.
Every list returns every page, through limit and cursor. Every ad comes as a card:
- What Meta's Ad Library stores for it: status and run dates, platforms, copy, call to action, advertiser, image and video.
- Its brand, niche, formats, standard tags and page URL.
The MCP server reads the same library, and the same token works there.
Authentication
Every /api/v1 request needs one of:
- An API key:
Authorization: Bearer asf_…. Make one at https://adswipefile.com/app/api-keys while signed in. It is shown once. A key acts as your account, with its plan and allowance, for reads and writes alike. It works on the MCP server too. Revoke it there when a script no longer needs it. - A signed-in session, in the browser: sign in and call the API from a page on https://adswipefile.com. The session cookie is sent automatically. A session writes only from the site's own pages (
Sec-Fetch-Site: same-origin), never from another site. - An OAuth 2.1 access token:
Authorization: Bearer <token>. The MCP flow issues it, so a client already connected over MCP can reuse it.
Getting a token, for a client of your own:
- Discover: a request without credentials answers
401withWWW-Authenticate: Bearer resource_metadata="…". That document names the authorization server. Its metadata is at https://adswipefile.com/.well-known/oauth-authorization-server. - Register a client with
POST https://adswipefile.com/api/auth/oauth2/register. Dynamic client registration is open. - Authorize with code and PKCE (S256) at https://adswipefile.com/api/auth/oauth2/authorize. Send
resource=https://adswipefile.com/api/mcpandscope=mcp:read. Addmcp:writefor the account endpoints'POSTandDELETE, andoffline_accessfor a refresh token. The person signs in by email link, code or Google, and approves the access asked for. - Exchange the code at https://adswipefile.com/api/auth/oauth2/token.
Tokens are bound to the audience https://adswipefile.com/api/mcp and the scope mcp:read, for this API and the MCP server alike. Changing saves, boards and follows also needs mcp:write.
- A missing, invalid or expired token, or a revoked key, is a
401problem. - So is a token whose app the person disconnected at https://adswipefile.com/app/connect, from its next call. Its refresh token stops too: authorize again.
- A token without
mcp:readis a403. - A write with a token without
mcp:writeis a403. ItsWWW-Authenticatecarrieserror="insufficient_scope", scope="mcp:read mcp:write": authorize again with both scopes.
A token approved before mcp:write existed reads only until you do.
The machine-readable description is https://adswipefile.com/openapi.json (OpenAPI 3.1; every operation has an operationId, so it imports as function-calling tools).
Endpoints
Every operation has its own page, with its parameters, an example and its responses. This list is generated from https://adswipefile.com/openapi.json, so it is the whole API.
Library
The ad library as JSON.
- GET /api/v1/searchSearch ads, brands, niches and formats
- GET /api/v1/adsThe newest ads, optionally by brand, niche, format and standard tags
- GET /api/v1/visual-formatsThe standard visual formats in use
- GET /api/v1/formatsThe visual formats, with their page URLs
- GET /api/v1/formats/{slug}A visual format's guide
- GET /api/v1/niches/{slug}A niche in brief
- GET /api/v1/hooks/{slug}A hook tactic in brief
- GET /api/v1/hooksThe hook tactics in use
- GET /api/v1/trendsA niche's rising formats, hooks and asset types
- GET /api/v1/brands/by-domainFind a brand by its website
- GET /api/v1/ads/batchSeveral ads in full
- GET /api/v1/ads/{id}One ad in full
- GET /api/v1/ads/{id}/similarAds like one ad, from other brands
- GET /api/v1/brandsThe library's brands
- GET /api/v1/nichesThe library's niches
- GET /api/v1/ads/countsAds by visual format, hook tactic or niche
- GET /api/v1/brands/{slug}A brand's profile, stats and patterns
- GET /api/v1/brands/{slug}/activityWhat a brand changed each week
Saved ads
A workspace's saved ads and the notes on them. Listing them counts like listAds; saving, unsaving and notes are free. Writes need an API key, an OAuth token with mcp:write, or a session on the site's own pages.
- GET /api/v1/saved-adsA workspace's saved ads
- POST /api/v1/saved-adsSave an ad
- DELETE /api/v1/saved-ads/{id}Unsave an ad
- PUT /api/v1/saved-ads/{id}/noteWrite a note on a saved ad
Boards
The account's boards: create, rename, delete, share by link, and the ads on them. Free. Writes need an API key, an OAuth token with mcp:write, or a session on the site's own pages.
- GET /api/v1/boardsA workspace's boards
- POST /api/v1/boardsCreate a board
- PATCH /api/v1/boards/{board}Rename a board
- DELETE /api/v1/boards/{board}Delete a board
- POST /api/v1/boards/{board}/shareTurn on a board's share link
- DELETE /api/v1/boards/{board}/shareTurn off a board's share link
- POST /api/v1/boards/{board}/adsAdd an ad to a board
- DELETE /api/v1/boards/{board}/ads/{id}Remove an ad from a board
Following
The brands the account follows and their newest ads. Following is free; the ads count like listAds.
- GET /api/v1/following/brandsThe brands a workspace follows
- GET /api/v1/following/adsNew ads from followed brands
- GET /api/v1/ads/followedEvery ad of the followed brands, filtered and paged
- POST /api/v1/brands/{slug}/followFollow a brand, in the library or any on Meta
- DELETE /api/v1/brands/{slug}/followStop following a brand
Briefs
A workspace's creative briefs, the documents its team writes and approves in the app. Reading one or the list counts like listAds; writing and setting a status are free. Writes need an API key, an OAuth token with mcp:write, or a session on the site's own pages.
- GET /api/v1/briefsA workspace's briefs
- POST /api/v1/briefsStart a brief
- GET /api/v1/briefs/{brief}Read a brief
- PUT /api/v1/briefs/{brief}Save a new version of a brief
- PATCH /api/v1/briefs/{brief}Set a brief's properties
- GET /api/v1/briefs/{brief}/versionsA brief's versions
- POST /api/v1/briefs/{brief}/versions/{version}/restoreRestore a brief's version
Workspace brand
The reader's own brand, the one they make ads for (Your brand), not a library brand or a followed competitor: name, niche, site, Meta page and markdown notes on what it sells, who buys it and how it sounds. Free. Writes need an API key, an OAuth token with mcp:write, or a session on the site's own pages.
- GET /api/v1/workspace/brandThe reader's own brand
- PATCH /api/v1/workspace/brandUpdate the reader's own brand
Account
The account's calls left this period, and its organization's workspaces (what workspace takes on the saved-ads, boards and following endpoints). Free.
Pages
Any page as markdown.
Ops
Service status.
Search and names
GET /api/v1/search?q=:
qneeds at least 2 characters. A longer query is cut to 64. The MCP toolsearch_librarytakes longer queries, so send a long question there.limitis 1 to 25, and 10 when left out. It counts one call per 10 results asked for.
/ads, /trends and /brands accept a plain name, an alias or a niche group wherever they take a slug. When they read a name differently from how it was written, the answer says so:
/ads:corrected_filtersandunused_filters, with ahint./trends:corrected_filters./brands:corrected_filtersand ahint.
GET /api/v1/ads/batch?ids= reads up to 25 ads in one request. Pass ids, page URLs or 8-character prefixes. Each ad counts one call. With compact=true it answers each ad as its /ads card instead, at one call per 10 ads, as a list page. Ads it could not find are listed under missing.
Ad cards
Every card, in a list or read alone, carries what Meta's Ad Library stores for the ad, from our stored copy of it (as of run.last_seen, not a fresh request to Meta):
run:active,started,ended,last_seenanddays_running.platforms: where it ran, e.g.Facebook,Instagram.copy: itsheadlineandbody(the primary text).cta: the button'stext, itstype(Meta's enum, e.g.SHOP_NOW) and the landing pageurl.advertiser: the Facebook page that ran it (page_id,name,ad_library_url).image: the creative (a video's poster) on our CDN.video: a video ad's page, where it plays; never the file.
An ad imported before tracking has them null or empty, except its copy when read alone.
GET /api/v1/ads/{id} returns one ad's card, plus:
why_it_works: the mechanism of its hook, format and offer, from its tags: why it works.breakdown, once the ad is read: what it says, its traits, its units, its structure and itsremixscript.remix_spec, with the breakdown on the plan: the ad as a spec to build from, as MCPget_ad.compact=truekeeps the script once, there.duplicates: the other ads showing the same creative, the same file or the same image re-encoded or resized. Other brands come first.meta, for an ad tracked on Meta:platforms,cta,display_formatandvariants. It addsbrand_median_run_daysandbrand_tracked_adswhen the brand has at least 5 tracked ads.
With brand, GET /api/v1/ads adds brand_patterns: read counts per type, the trait shares (from 5 read ads), and the top structure, format and hook, and brand_mix: its offers, landing pages and angles. It takes what MCP list_ads takes, from the same body: query, followed (with per_brand and workspace), distinct, fields (angle, lands_on) and sort=most_variants.
Every card carries the ad's standard tags:
visual_formats: up to three.hook_tacticandhook_line, the hook as written.asset_type,offer_type,seasonandtalent.awareness: how much the viewer is assumed to know, fromunawaretomost-aware.
They are empty or null until the library has tagged the ad. awareness is also null on ads tagged before it was added. They describe the creative.
Your saves, boards and followed brands
The saved-ads, boards, following and account endpoints above read or change your account only. None counts against the allowance except the two lists of ads: saved ads and new ads from followed brands.
The writes (POST, PUT, PATCH, DELETE) take an API key, a token with mcp:write, or a session on the site's own pages. They have their own window of 30 a minute per account.
No input names an owner. Every call reads or changes one workspace of your organization: a client or brand, with its own saves, notes, boards and follows.
- Add
?workspace=with a workspace's id or exact name, in any case, to any of these endpoints. Without it, the call acts in your current workspace, the one you last opened in the app. - Every answer names the workspace it acted in as
workspace(id,name). - A workspace your organization does not have is a
404 workspace_not_found. One past your plan's workspaces is a403 workspace_locked. - A board is named by its id or its exact name, inside that workspace. Another workspace's board answers
404.
curl -s -X POST -H "Authorization: Bearer $ADSWIPEFILE_API_KEY" -H 'content-type: application/json' -d '{"name":"March brief"}' 'https://adswipefile.com/api/v1/boards'
curl -s -X POST -H "Authorization: Bearer $ADSWIPEFILE_API_KEY" 'https://adswipefile.com/api/v1/brands/glossier/follow?workspace=Acme'
curl -s -H "Authorization: Bearer $ADSWIPEFILE_API_KEY" 'https://adswipefile.com/api/v1/workspaces'
curl -s -H "Authorization: Bearer $ADSWIPEFILE_API_KEY" 'https://adswipefile.com/api/v1/account/usage'Slugs are the last part of a page URL: https://adswipefile.com/niches/beauty is the niche beauty. Find them with search.
curl -s -H "Authorization: Bearer $ADSWIPEFILE_API_KEY" 'https://adswipefile.com/api/v1/search?q=protein'
curl -s -H "Authorization: Bearer $ADSWIPEFILE_API_KEY" 'https://adswipefile.com/api/v1/ads?niche=beauty&format=ugc&limit=5'
curl -s -H "Authorization: Bearer $ADSWIPEFILE_API_KEY" 'https://adswipefile.com/api/v1/ads?visual_format=testimonial&season=black-friday'Rate limits
60 requests a minute per account, over a sliding window. Every authenticated response says where you stand:
RateLimit-Policy: "account";q=60;w=60
RateLimit: "account";r=59;t=42(RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset carry the same numbers.) Past the limit the answer is 429 with the code rate_limited and Retry-After in seconds.
Allowance: monthly on Pro and Agency
Every MCP tool call and every /api/v1 request counts against the allowance of the account's plan. It resets in UTC. The allowance is 10,000 a month on Pro and 50,000 a month on Agency. It is 200 a day during the 7-day free trial of either.
A paid month also has a daily ceiling, so it cannot all go in one day. The ceiling is 1,000 on Pro and 3,000 on Agency. A call refused at the ceiling does not count against the month.
get_ad and get_ads read ads in full: each ad counts one call. Lists and searches answer summary cards, with no full copy, transcript or breakdown: on Pro and Agency, a list_ads or search_library page, or a get_ads call with compact: true, counts one call per 10 ads asked for. A limit of 50 counts 5. So list or search first, and read in full only the ads you will analyse.
Some calls are free of the allowance. The library's map is free: list_niches, list_formats, list_visual_formats, list_hooks and their /api/v1 endpoints. Your own boards, followed brands, workspaces and usage are free too: list_boards, list_followed_brands, list_workspaces, get_usage and their /api/v1 endpoints. So is every write: saves, notes, follows, boards, briefs and submit_feedback. Reading briefs counts: list_briefs and get_brief are one call each.
An account that never had a plan gets a preview of 20 calls in all. Each MCP list or search is cut to its first 10 results, without breakdowns. Past the 20 calls, every call that counts is refused, with a link to the plans page. Once a plan or its trial ends, there is no preview: every call that counts is refused, with a link to choose a plan again.
Past the allowance, the API answers 429 with the code quota_exceeded and Retry-After set to the reset. The reset is in UTC: the first of next month on Pro and Agency. MCP tools answer with a message instead of results. Both say when the allowance resets and how to raise it, with the link.
See pricing.
Errors
Every error is application/problem+json (RFC 9457), including unknown paths under /api/. Responses are never cached (Cache-Control: private, no-store).
{ "type": "https://adswipefile.com/docs/api#errors", "title": "Not found", "status": 404,
"detail": "No niche with slug \"beuty\".", "code": "not_found",
"resolution": "Find slugs with /api/v1/search?q=<name>, …" }Branch on code (one of not_found, bad_request, unauthorized, forbidden, plan_limit, workspace_not_found, workspace_locked, method_not_allowed, rate_limited, conflict, read_only, quota_exceeded, not_acceptable, service_unavailable), show detail, follow resolution.
Markdown instead of JSON
Add .md to any page URL for that page as markdown (https://adswipefile.com/niches.md, https://adswipefile.com/index.md for the home page). The page URL itself also answers Accept: text/markdown with the same markdown: curl -H 'Accept: text/markdown' https://adswipefile.com/niches. A client that accepts neither markdown nor HTML gets 406.