{"openapi":"3.0.3","info":{"title":"Ahrefs API","version":"1.0.0","description":"Ahrefs SEO metrics with stable schemas: keyword difficulty, SERP snapshots, keyword rank checks, website authority and broken links.","contact":{"email":"support@endpointry.com"},"termsOfService":"https://endpointry.com/legal/terms"},"servers":[{"url":"https://api.endpointry.com/v1/ahrefs"}],"tags":[{"name":"Ahrefs API","description":"Ahrefs SEO metrics with stable schemas: keyword difficulty, SERP snapshots, keyword rank checks, website authority and broken links."}],"components":{"schemas":{"ResponseMeta":{"type":"object","properties":{"request_id":{"type":"string","example":"req_9f2c4a1b8d3e0f6a7c5b9d1e"},"as_of":{"type":"string","format":"date-time","description":"When this snapshot of the data was taken (UTC)."},"cache":{"type":"string","enum":["HIT","MISS"]},"pagination":{"$ref":"#/components/schemas/PaginationMeta"},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/ResponseWarning"}}},"required":["request_id"]},"PaginationMeta":{"type":"object","properties":{"page":{"type":"integer"},"next_cursor":{"type":"string","nullable":true},"next_offset":{"type":"integer","nullable":true},"next_page":{"type":"integer","nullable":true},"limit":{"type":"integer"},"returned":{"type":"integer"},"total":{"type":"integer"}}},"ResponseWarning":{"type":"object","properties":{"code":{"type":"string"},"detail":{"type":"string"}},"required":["code","detail"]},"AhrefsSerpResult":{"type":"object","properties":{"position":{"type":"integer","example":1,"description":"Position in the results page. Non-organic blocks (local packs, ads) occupy positions too, so organic positions may have gaps."},"title":{"type":"string","nullable":true,"example":"Keyword Research: The Beginner’s Guide"},"url":{"type":"string","format":"uri","example":"https://example.com/blog/keyword-research"},"domain_rating":{"type":"number","nullable":true,"example":92,"description":"Domain Rating of the result’s website — backlink-profile strength, 0–100."},"url_rating":{"type":"number","nullable":true,"example":34,"description":"URL Rating of the page itself, 0–100."},"backlinks":{"type":"integer","nullable":true,"example":11653,"description":"Pages linking to this result."},"referring_domains":{"type":"integer","nullable":true,"example":3776,"description":"Unique websites linking to this result."},"traffic":{"type":"integer","nullable":true,"example":291387,"description":"Estimated monthly organic visits to this page."},"traffic_value":{"type":"integer","nullable":true,"example":669737,"description":"Estimated monthly value of that organic traffic, in USD."},"keywords":{"type":"integer","nullable":true,"example":3532,"description":"Keywords this page ranks for."},"top_keyword":{"type":"string","nullable":true,"example":"keyword research","description":"The keyword sending this page the most traffic."},"top_keyword_volume":{"type":"integer","nullable":true,"example":600000,"description":"Monthly search volume of that top keyword."},"word_count":{"type":"integer","nullable":true,"example":1712,"description":"Words on the page."}},"required":["position","title","url","domain_rating","url_rating","backlinks","referring_domains","traffic","traffic_value","keywords","top_keyword","top_keyword_volume","word_count"]},"Problem":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"code":{"type":"string"},"detail":{"type":"string"},"request_id":{"type":"string"}},"required":["type","title","status","code","request_id"]},"AhrefsBrokenBacklink":{"type":"object","properties":{"url_from":{"type":"string","format":"uri","example":"https://example.com/resources","description":"The page carrying the link."},"title":{"type":"string","nullable":true,"description":"Title of the linking page."},"domain_rating":{"type":"number","nullable":true,"example":69,"description":"Domain Rating of the linking website, 0–100."},"url_to":{"type":"string","format":"uri","description":"The dead URL the link points at."},"http_code":{"type":"integer","nullable":true,"example":404,"description":"Status the dead URL answers with."},"anchor":{"type":"string","nullable":true,"description":"The link’s anchor text."},"text_pre":{"type":"string","nullable":true,"description":"Text just before the anchor."},"text_post":{"type":"string","nullable":true,"description":"Text just after the anchor."}},"required":["url_from","title","domain_rating","url_to","http_code","anchor","text_pre","text_post"]},"AhrefsBrokenPage":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"The page containing the broken outgoing links."},"title":{"type":"string","nullable":true},"internal_links":{"type":"integer","nullable":true,"description":"Internal links on the page."},"external_links":{"type":"integer","nullable":true,"description":"External links on the page."},"links":{"type":"array","items":{"$ref":"#/components/schemas/AhrefsBrokenOutboundLink"}}},"required":["url","title","internal_links","external_links","links"]},"AhrefsBrokenOutboundLink":{"type":"object","properties":{"url_to":{"type":"string","format":"uri","description":"The dead URL the page links out to."},"anchor":{"type":"string","nullable":true},"http_code":{"type":"integer","nullable":true,"example":404},"text_pre":{"type":"string","nullable":true,"description":"Text just before the anchor."},"text_post":{"type":"string","nullable":true,"description":"Text just after the anchor."}},"required":["url_to","anchor","http_code","text_pre","text_post"]}},"parameters":{}},"paths":{"/keyword-difficulty":{"get":{"operationId":"ahrefs.keyword-difficulty","summary":"Check keyword difficulty","description":"Scores how hard it is to rank in the top 10 for a keyword, 0–100, with an estimate of the referring domains a page would need, and the organic results currently holding the top of the SERP. Returns `404 NOT_FOUND` for a keyword the source has no data on. `meta.as_of` is the time the underlying SERP snapshot was taken.","x-points":500,"tags":["Ahrefs API"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200,"example":"keyword research","description":"The keyword to analyze."},"required":true,"description":"The keyword to analyze.","name":"keyword","in":"query"},{"schema":{"type":"string","pattern":"^[A-Za-z]{2}$","default":"us","example":"us","description":"Two-letter code of the country whose search results to read."},"required":false,"description":"Two-letter code of the country whose search results to read.","name":"country","in":"query"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/ResponseMeta"},"data":{"type":"object","properties":{"keyword":{"type":"string","example":"keyword research"},"country":{"type":"string","example":"us"},"difficulty":{"type":"integer","minimum":0,"maximum":100,"example":92,"description":"How hard it is to rank in the top 10 for this keyword, 0 (easy) to 100 (hardest)."},"backlinks_needed":{"type":"integer","nullable":true,"example":932,"description":"Estimated number of websites that would need to link to a page for it to rank in the top 10."},"serp":{"type":"array","items":{"$ref":"#/components/schemas/AhrefsSerpResult"},"description":"The organic results currently holding the top of the SERP."}},"required":["keyword","country","difficulty","backlinks_needed","serp"]}},"required":["meta","data"]}}}},"default":{"description":"Error response (RFC 9457 problem+json)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/serp":{"get":{"operationId":"ahrefs.serp","summary":"Get a SERP snapshot","description":"Returns the organic results at the top of the search results page for a keyword in a chosen country, each with its position, title, URL and page-level metrics: domain and URL rating, backlinks, referring domains, estimated monthly traffic and its value, and the page’s strongest keyword. Non-organic blocks (local packs, ads) hold positions but are not returned, so positions may have gaps.","x-points":500,"tags":["Ahrefs API"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200,"example":"keyword research","description":"The keyword to analyze."},"required":true,"description":"The keyword to analyze.","name":"keyword","in":"query"},{"schema":{"type":"string","pattern":"^[A-Za-z]{2}$","default":"us","example":"us","description":"Two-letter code of the country whose search results to read."},"required":false,"description":"Two-letter code of the country whose search results to read.","name":"country","in":"query"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/ResponseMeta"},"data":{"type":"object","properties":{"keyword":{"type":"string","example":"keyword research"},"country":{"type":"string","example":"us"},"results":{"type":"array","items":{"$ref":"#/components/schemas/AhrefsSerpResult"},"description":"The organic results at the top of the SERP, with their source positions. Non-organic blocks are not included."}},"required":["keyword","country","results"]}},"required":["meta","data"]}}}},"default":{"description":"Error response (RFC 9457 problem+json)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/keyword-rank":{"get":{"operationId":"ahrefs.keyword-rank","summary":"Check a keyword rank","description":"Reports the best position a domain holds for a keyword in a chosen country — the position, the exact page holding it and its title — alongside the organic top of the SERP it was measured in. `position: null` means the domain is not in the measured part of the results.","x-points":500,"tags":["Ahrefs API"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200,"example":"keyword research","description":"The keyword to analyze."},"required":true,"description":"The keyword to analyze.","name":"keyword","in":"query"},{"schema":{"type":"string","minLength":4,"maxLength":253,"pattern":"^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$/i","example":"ahrefs.com","description":"The domain whose ranking to check, without scheme or path."},"required":true,"description":"The domain whose ranking to check, without scheme or path.","name":"domain","in":"query"},{"schema":{"type":"string","pattern":"^[A-Za-z]{2}$","default":"us","example":"us","description":"Two-letter code of the country whose search results to read."},"required":false,"description":"Two-letter code of the country whose search results to read.","name":"country","in":"query"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/ResponseMeta"},"data":{"type":"object","properties":{"keyword":{"type":"string","example":"keyword research"},"country":{"type":"string","example":"us"},"domain":{"type":"string","example":"ahrefs.com"},"position":{"type":"integer","nullable":true,"example":2,"description":"Best position the domain holds for this keyword. `null` means the domain is not in the measured part of the SERP."},"url":{"type":"string","nullable":true,"format":"uri","example":"https://ahrefs.com/keyword-generator","description":"The page holding that position."},"title":{"type":"string","nullable":true,"example":"Free Keyword Generator Tool"},"serp":{"type":"array","items":{"$ref":"#/components/schemas/AhrefsSerpResult"},"description":"The organic top of the SERP the position was measured in."}},"required":["keyword","country","domain","position","url","title","serp"]}},"required":["meta","data"]}}}},"default":{"description":"Error response (RFC 9457 problem+json)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/authority":{"get":{"operationId":"ahrefs.authority","summary":"Check website authority","description":"Returns a website’s Domain Rating (0–100) with its backlink profile in numbers: total backlinks, unique referring domains, and the dofollow share of each. Metrics are domain-level and include subdomains. A website the source has never seen reports zeros.","x-points":500,"tags":["Ahrefs API"],"parameters":[{"schema":{"type":"string","minLength":4,"maxLength":512,"pattern":"^\\S+\\.\\S+$","example":"ahrefs.com","description":"The website to evaluate — a bare domain or a full URL."},"required":true,"description":"The website to evaluate — a bare domain or a full URL.","name":"url","in":"query"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/ResponseMeta"},"data":{"type":"object","properties":{"target":{"type":"string","example":"ahrefs.com","description":"The website these metrics describe. Metrics are domain-level."},"domain_rating":{"type":"number","minimum":0,"maximum":100,"example":91,"description":"Domain Rating — the strength of the website’s backlink profile, 0–100."},"backlinks":{"type":"integer","example":22988620,"description":"Links pointing at the website, including its subdomains."},"referring_domains":{"type":"integer","example":110499,"description":"Unique websites linking to it."},"dofollow_backlinks_percent":{"type":"number","nullable":true,"example":75,"description":"Share of backlinks that are dofollow, 0–100."},"dofollow_referring_domains_percent":{"type":"number","nullable":true,"example":84,"description":"Share of referring domains with at least one dofollow link, 0–100."}},"required":["target","domain_rating","backlinks","referring_domains","dofollow_backlinks_percent","dofollow_referring_domains_percent"]}},"required":["meta","data"]}}}},"default":{"description":"Error response (RFC 9457 problem+json)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/broken-links":{"get":{"operationId":"ahrefs.broken-links","summary":"Find broken links","description":"Lists what is broken around a website, in both directions: inbound backlinks that land on dead pages of the target (with the linking page, its Domain Rating, anchor and surrounding text), and the target’s own pages that link out to dead URLs, grouped by page. Totals and dofollow shares accompany each list.","x-points":1000,"tags":["Ahrefs API"],"parameters":[{"schema":{"type":"string","minLength":4,"maxLength":512,"pattern":"^\\S+\\.\\S+$","example":"ahrefs.com","description":"The website to evaluate — a bare domain or a full URL."},"required":true,"description":"The website to evaluate — a bare domain or a full URL.","name":"url","in":"query"},{"schema":{"type":"string","enum":["exact","subdomains"],"default":"subdomains","example":"subdomains","description":"`exact` checks only the specified URL; `subdomains` checks the whole domain including its subdomains."},"required":false,"description":"`exact` checks only the specified URL; `subdomains` checks the whole domain including its subdomains.","name":"mode","in":"query"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/ResponseMeta"},"data":{"type":"object","properties":{"target":{"type":"string","example":"ahrefs.com"},"mode":{"type":"string","enum":["exact","subdomains"]},"inbound":{"type":"object","properties":{"total":{"type":"integer","nullable":true,"example":443934,"description":"Total broken backlinks pointing at the target."},"dofollow_percent":{"type":"number","nullable":true,"example":99,"description":"Share of those that are dofollow, 0–100."},"links":{"type":"array","items":{"$ref":"#/components/schemas/AhrefsBrokenBacklink"},"description":"The top broken backlinks."}},"required":["total","dofollow_percent","links"]},"outbound":{"type":"object","properties":{"total":{"type":"integer","nullable":true,"example":1448,"description":"Total broken outgoing links on the target."},"dofollow_percent":{"type":"number","nullable":true,"example":82,"description":"Share of those that are dofollow, 0–100."},"pages":{"type":"array","items":{"$ref":"#/components/schemas/AhrefsBrokenPage"},"description":"Pages with broken outgoing links, grouped by page."}},"required":["total","dofollow_percent","pages"]}},"required":["target","mode","inbound","outbound"]}},"required":["meta","data"]}}}},"default":{"description":"Error response (RFC 9457 problem+json)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}}}}