All jobs

Content Audit: Which Pages to Keep, Update or Cut

Content planning software gives each customer an agent that reads their Ahrefs data and sorts every blog page into keep, update, merge or cut for an editor.

Run this on RushOpens the console with this prompt ready to send. Connect Ahrefs there first.

What the agent does

This is for a company that sells content planning software to in-house marketing teams at B2B companies: a calendar, briefs, and a view of what the blog already has. Its customers ask for the same thing a few times a year. After three or four years of publishing, a blog has hundreds of posts, and nobody knows which still bring visitors, which have slipped, which say the same thing as another post, and which could go. A content audit answers that, and done by hand it is a week of exporting top pages, pasting them beside the sitemap and arguing over a spreadsheet. The software adds an Audit button that produces the first draft of that spreadsheet from the customer's own Ahrefs account.

The company connects an Ahrefs account of its own and saves the agent once as a template with POST /o/{org}/agents, naming "connections": ["ahrefs"] and instructions that it only reads. When a customer turns the audit on, the backend makes that customer's agent with {"template": "<template id>", "name": "audit-<workspace id>"} and starts the sign-in with POST /o/{org}/agents/{agent}/connections {"type": "mcp", "name": "ahrefs"}. The customer's Ahrefs admin opens the authorize_url in a popup and approves Ahrefs's consent screen, which creates a key with the MCP scope in their workspace. Ahrefs documents that its remote MCP server at https://api.ahrefs.com/mcp/mcp needs a Lite plan or higher, that each call uses the workspace's own API units, and that a key made through that consent defaults to a monthly limit of 200,000 units, which a workspace admin can change.

The agent starts with the list of pages that exist, which Ahrefs cannot give on its own because a page with no rankings is not in its top pages. It opens the site's public sitemap.xml from its own computer, follows any sitemap index, and keeps the URLs under the blog path with their lastmod. Then it calls site-explorer-top-pages with the blog path as target, mode prefix, today as date and the same day six months ago as date_compared, selecting url, sum_traffic, sum_traffic_prev, keywords, top_keyword, top_keyword_best_position and referring_domains, ordered by traffic. Ahrefs prices each field per row, so the template's instructions name only these fields and the agent asks the doc tool for a schema before its first call rather than guessing a parameter.

Each sitemap URL gets one of five labels. Keep: steady or rising traffic. Update: traffic down by at least a third against six months ago, or a top keyword at positions 4 to 20, where a refresh has the most room. Merge: two or more posts whose top_keyword is the same, each listed beside the other. Redirect candidate: no traffic and no ranking keywords, but referring domains that a redirect would keep. Cut candidate: no traffic, no keywords, no referring domains, and a lastmod more than a year old. Pages Ahrefs has no row for go in the last two groups only when the sitemap shows them; a URL that is in Ahrefs but missing from the sitemap is listed separately, because it may be an orphan or a page the sitemap forgot. The agent changes nothing on the site and nothing in Ahrefs.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "<agent id>",
  "input": "Run a content audit of the blog at https://www.northwind-payroll.example/blog/ for the content team. Read only: change nothing in Ahrefs. 1) Fetch https://www.northwind-payroll.example/sitemap.xml, follow any sitemap index, and keep every URL that starts with https://www.northwind-payroll.example/blog/ with its lastmod. 2) Ask the doc tool for the input schema of site-explorer-top-pages, then call it with target https://www.northwind-payroll.example/blog/, mode prefix, country us, date 2026-11-29, date_compared 2026-05-29, select url, sum_traffic, sum_traffic_prev, keywords, top_keyword, top_keyword_best_position, referring_domains, order_by sum_traffic:desc, limit 1000. Select no other field. 3) Label each sitemap URL: keep (traffic steady or up); update (traffic down 33% or more since 2026-05-29, or top_keyword_best_position from 4 to 20); merge (shares its top_keyword with another blog URL; name the other); redirect candidate (no traffic, no keywords, referring_domains above 0); cut candidate (no traffic, no keywords, no referring domains, lastmod before 2025-11-29). List URLs Ahrefs returns that the sitemap lacks under not_in_sitemap. 4) Write content-audit.csv (url, lastmod, label, traffic_now, traffic_6mo_ago, keywords, top_keyword, position, referring_domains, merge_with, reason) and summary.md with the counts per label and the 15 update pages with the most traffic lost. Return JSON {pages, keep, update, merge, redirect_candidates, cut_candidates, not_in_sitemap, units_note}."
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

A content audit spreadsheet comes back as content-audit.csv, with one labelled row for every blog URL. Each row has its label, its traffic now and six months ago, its keyword count, its top keyword and position, its referring domains, and a one-line reason for the label. summary.md gives the count in each group and the fifteen update candidates that lost the most traffic, which is usually where the content team starts. The software shows both in the customer's audit view and keeps the file with the date.

An editor makes every decision. Ahrefs's traffic is an estimate from rankings, not the site's own analytics, so a page labelled cut that the sales team sends to every prospect stays. A merge pair is two posts competing for one keyword, and the editor picks which one survives and what moves into it. A redirect candidate keeps its links only if someone sets the redirect, and a cut candidate may be a product page in the wrong folder. The agent removes, redirects and rewrites nothing.

When the sitemap cannot be fetched, or Ahrefs returns no rows for the blog path, the answer says which one and stops before labelling, so an empty audit is never mistaken for a clean blog.

Run it on every quarter, per customer blog

The software runs the audit when a customer presses the button and again each quarter: its scheduler calls POST /o/{org}/sessions with that customer's agent id as agent, their blog path, today and the date six months back in input, and a request_id that is a UUID v5 of the workspace id and the quarter, so a retried job starts no second run. Each customer's audit is its own run, so a hundred customers in the same week run side by side, each against its own Ahrefs workspace.

The key's webhook posts run.completed with execution_id; the software reads the session, downloads content-audit.csv from its artifacts, and puts it next to the last quarter's file so an editor can see which updates from last time paid off.

The use case this job follows, with its automation and trigger: Run an agent per customer task.

Why run it on Rush?

Each customer's Ahrefs sign-in stays in Rush's connection under that customer's agent. The software stores agent ids, never an Ahrefs key, registers no OAuth app with Ahrefs, and an audit for one customer cannot read another customer's workspace or spend their units. The session's accounts names the Ahrefs connection a run used, which answers a customer who asks what read their data.

An audit is an argument about which pages to delete, so every label has to be traceable. Each run keeps a transcript of the sitemap it read and every site-explorer-top-pages call with its arguments and rows, so an editor who doubts a cut can see the numbers behind it. Each run has its own computer and its own cost, which the software adds up per customer with GET /o/{org}/sessions?agent=<agent id>.

Frequently asked questions

What is a content audit?

A content audit lists every page a site has published and decides what to do with each: keep it, update it, merge it with another page, redirect it or remove it. This agent drafts that list from the sitemap and Ahrefs data. The decisions stay with the editor.

Why read the sitemap as well as Ahrefs?

Ahrefs's top pages list only pages that rank for something, so a post with no rankings is not in it. The sitemap supplies those pages, and they are often the ones a content audit is looking for. A page in Ahrefs but not in the sitemap is listed on its own, since the sitemap may be out of date.

How many Ahrefs units does an audit use?

Ahrefs charges per row returned and per field selected, from the customer's own allowance, and its doc tool states each tool's prices. The template selects seven fields, and one call asks for up to 1,000 pages within the rows per request the customer's plan allows. The run's transcript shows each call, so the software can show a customer what an audit drew.

Does it change the site or Ahrefs?

No. It fetches a public sitemap and reads Ahrefs, and the template's instructions forbid any change. Redirects, deletions and rewrites are made by the customer's team in their own CMS.

More Ahrefs jobs

More jobs like this: Run an agent per customer task

Keep reading