Setu Recipes: reusable digital workers across every app.Browse templates

Integrations / Ahrefs

Ahrefs

SEO data from Ahrefs: domain rating, backlinks, organic keywords, top pages and API usage.

8 actions API key 8 read0 write Calls api.ahrefs.com

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "ahrefs" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

This toolkit uses a single credential and requests no scopes.

Actions

Get domain ratingreadahrefs.domain_ratingGet the Ahrefs Domain Rating and Ahrefs Rank of a domain or URL on a date.
InputTypeDescription
targetstringRequiredDomain or URL to analyse, e.g. ahrefs.com
datestringRequiredDate to report on, YYYY-MM-DD
TypeScript
await setu.execute({
  userId: "user_1",
  action: "ahrefs.domain_rating",
  input: {
    "target": "<target>",
    "date": "<date>"
  },
});
Get subscription limits and usagereadahrefs.limits_and_usageGet the Ahrefs subscription plan, API unit limits and usage this month, and the API key expiry.

No input.

TypeScript
await setu.execute({
  userId: "user_1",
  action: "ahrefs.limits_and_usage",
  input: {},
});
List organic keywordsreadahrefs.organic_keywordsList the keywords a target ranks for in organic search on a date, with positions, volumes and traffic.
InputTypeDescription
targetstringRequiredDomain or URL to analyse, e.g. ahrefs.com
selectstringRequiredComma-separated columns to return
limitintegerOptionalNumber of rows (default 1000)
order_bystringOptionalColumn to order by, e.g. sum_traffic:desc
modestringOptionalScope of the target (default subdomains)
datestringRequiredDate to report on, YYYY-MM-DD
countrystringOptionalTwo-letter country code to limit to
TypeScript
await setu.execute({
  userId: "user_1",
  action: "ahrefs.organic_keywords",
  input: {
    "target": "<target>",
    "select": "<select>",
    "date": "<date>"
  },
});
List referring domainsreadahrefs.referring_domainsList domains that link to a target, with their Domain Rating and number of links.
InputTypeDescription
targetstringRequiredDomain or URL to analyse, e.g. ahrefs.com
selectstringRequiredComma-separated columns to return
limitintegerOptionalNumber of rows (default 1000)
order_bystringOptionalColumn to order by, e.g. sum_traffic:desc
modestringOptionalScope of the target (default subdomains)
historystringOptionallive, since:<date> or all_time (default all_time)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "ahrefs.referring_domains",
  input: {
    "target": "<target>",
    "select": "<select>"
  },
});
Get site metricsreadahrefs.site_metricsGet organic and paid search metrics for a target on a date: estimated traffic, keywords and traffic cost.
InputTypeDescription
targetstringRequiredDomain or URL to analyse, e.g. ahrefs.com
datestringRequiredDate to report on, YYYY-MM-DD
modestringOptionalScope of the target (default subdomains)
countrystringOptionalTwo-letter country code to limit to
TypeScript
await setu.execute({
  userId: "user_1",
  action: "ahrefs.site_metrics",
  input: {
    "target": "<target>",
    "date": "<date>"
  },
});
List top pagesreadahrefs.top_pagesList a target's top pages by organic traffic on a date, with keyword counts and top keyword.
InputTypeDescription
targetstringRequiredDomain or URL to analyse, e.g. ahrefs.com
selectstringRequiredComma-separated columns to return
limitintegerOptionalNumber of rows (default 1000)
order_bystringOptionalColumn to order by, e.g. sum_traffic:desc
modestringOptionalScope of the target (default subdomains)
datestringRequiredDate to report on, YYYY-MM-DD
countrystringOptionalTwo-letter country code to limit to
TypeScript
await setu.execute({
  userId: "user_1",
  action: "ahrefs.top_pages",
  input: {
    "target": "<target>",
    "select": "<select>",
    "date": "<date>"
  },
});