backlinks_backlinks
Retrieve and analyze backlinks for any domain, subdomain, or webpage to enhance SEO strategies. Group, filter, and sort results to identify key linking opportunities and optimize website performance.
Instructions
This endpoint will provide you with a list of backlinks and relevant data for the specified domain, subdomain, or webpage
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filters | No | array of results filtering parameters optional field you can add several filters at once (8 filters maximum) you should set a logical operator and, or between the conditions the following operators are supported: =, <>, in, not_in, like, not_like, ilike, not_ilike, regex, not_regex, match, not_match you can use the % operator with like and not_like to match any string of zero or more characters example: ["rank",">","80"] [["page_from_rank",">","55"], "and", ["dofollow","=",true]] [["first_seen",">","2017-10-23 11:31:45 +00:00"], "and", [["anchor","like","%seo%"],"or",["text_pre","like","%seo%"]]] | |
| limit | No | the maximum number of returned backlinks | |
| mode | No | results grouping type optional field possible grouping types: as_is – returns all backlinks one_per_domain – returns one backlink per domain one_per_anchor – returns one backlink per anchor default value: as_is | as_is |
| offset | No | offset in the results array of the returned backlinks optional field default value: 0 if you specify the 10 value, the first ten backlinks in the results array will be omitted and the data will be provided for the successive backlinks | |
| order_by | No | results sorting rules optional field you can use the same values as in the filters array to sort the results possible sorting types: asc – results will be sorted in the ascending order desc – results will be sorted in the descending order you should use a comma to set up a sorting type example: ["rank,desc"] note that you can set no more than three sorting rules in a single request you should use a comma to separate several sorting rules example: ["domain_from_rank,desc","page_from_rank,asc"] | |
| target | Yes | domain, subdomain or webpage to get backlinks for required field a domain or a subdomain should be specified without https:// and www. a page should be specified with absolute URL (including http:// or https://) |
Implementation Reference
- The core handler function of the BacklinksTool class that executes the tool logic by making a POST request to the DataForSEO Backlinks API endpoint '/v3/backlinks/backlinks/live' with the provided parameters.async handle(params: any): Promise<any> { try { const response = await this.client.makeRequest('/v3/backlinks/backlinks/live', 'POST', [{ target: params.target, mode: params.mode, limit: params.limit, offset: params.offset, filters: this.formatFilters(params.filters), order_by: this.formatOrderBy(params.order_by) }]); return this.validateAndFormatResponse(response); } catch (error) { return this.formatErrorResponse(error); } }
- Zod schema defining the input parameters for the backlinks_backlinks tool, including target, mode, limit, offset, filters, and order_by.getParams(): z.ZodRawShape { return { target: z.string().describe(`domain, subdomain or webpage to get backlinks for required field a domain or a subdomain should be specified without https:// and www. a page should be specified with absolute URL (including http:// or https://)`), mode: z.string().default("as_is").describe(`results grouping type optional field possible grouping types: as_is – returns all backlinks one_per_domain – returns one backlink per domain one_per_anchor – returns one backlink per anchor default value: as_is`), limit: z.number().min(1).max(1000).default(10).optional().describe("the maximum number of returned backlinks"), offset: z.number().min(0).optional().describe( `offset in the results array of the returned backlinks optional field default value: 0 if you specify the 10 value, the first ten backlinks in the results array will be omitted and the data will be provided for the successive backlinks` ), filters: z.array( z.union([ z.array(z.union([z.string(), z.number(), z.boolean()])).length(3), z.enum(["and", "or"]) ]) ).max(8).optional().describe( `array of results filtering parameters optional field you can add several filters at once (8 filters maximum) you should set a logical operator and, or between the conditions the following operators are supported: =, <>, in, not_in, like, not_like, ilike, not_ilike, regex, not_regex, match, not_match you can use the % operator with like and not_like to match any string of zero or more characters example: ["rank",">","80"] [["page_from_rank",">","55"], "and", ["dofollow","=",true]] [["first_seen",">","2017-10-23 11:31:45 +00:00"], "and", [["anchor","like","%seo%"],"or",["text_pre","like","%seo%"]]]` ), order_by: z.array(z.string()).optional().describe( `results sorting rules optional field you can use the same values as in the filters array to sort the results possible sorting types: asc – results will be sorted in the ascending order desc – results will be sorted in the descending order you should use a comma to set up a sorting type example: ["rank,desc"] note that you can set no more than three sorting rules in a single request you should use a comma to separate several sorting rules example: ["domain_from_rank,desc","page_from_rank,asc"]` ), }; }
- src/core/modules/backlinks/backlinks-api.module.ts:29-62 (registration)Registration of the BacklinksTool (backlinks_backlinks) in the BacklinksApiModule's getTools method, where it is instantiated and mapped to its name with description, params, and handler.getTools(): Record<string, ToolDefinition> { const tools = [ new BacklinksTool(this.dataForSEOClient), new BacklinksAnchorTool(this.dataForSEOClient), new BacklinksBulkBacklinksTool(this.dataForSEOClient), new BacklinksBulkNewLostReferringDomainsTool(this.dataForSEOClient), new BacklinksBulkNewLostBacklinksTool(this.dataForSEOClient), new BacklinksBulkRanksTool(this.dataForSEOClient), new BacklinksBulkReferringDomainsTool(this.dataForSEOClient), new BacklinksBulkSpamScoreTool(this.dataForSEOClient), new BacklinksCompetitorsTool(this.dataForSEOClient), new BacklinksDomainIntersectionTool(this.dataForSEOClient), new BacklinksDomainPagesSummaryTool(this.dataForSEOClient), new BacklinksDomainPagesTool(this.dataForSEOClient), new BacklinksPageIntersectionTool(this.dataForSEOClient), new BacklinksReferringDomainsTool(this.dataForSEOClient), new BacklinksReferringNetworksTool(this.dataForSEOClient), new BacklinksSummaryTool(this.dataForSEOClient), new BacklinksTimeseriesNewLostSummaryTool(this.dataForSEOClient), new BacklinksTimeseriesSummaryTool(this.dataForSEOClient), new BacklinksBulkPagesSummaryTool(this.dataForSEOClient), new BacklinksFiltersTool(this.dataForSEOClient) // Add more tools here ]; return tools.reduce((acc, tool) => ({ ...acc, [tool.getName()]: { description: tool.getDescription(), params: tool.getParams(), handler: (params: any) => tool.handle(params), }, }), {}); }
- Definition of the tool name 'backlinks_backlinks'.getName(): string { return 'backlinks_backlinks';
- Mapping of tool name 'backlinks_backlinks' to its filter path 'backlinks' used in the filters tool.private static readonly TOOL_TO_FILTER_MAP: { [key: string]: string } = { 'backlinks_content_duplicates': 'content_duplicates', 'backlinks_backlinks': 'backlinks', 'backlinks_domain_pages': 'domain_pages', 'backlinks_anchors': 'anchors', 'backlinks_referring_domains': 'referring_domains', 'backlinks_domain_intersection': 'domain_intersection', 'backlinks_page_intersection': 'page_intersection', 'backlinks_referring_networks': 'referring_networks', 'backlinks_domain_pages_summary': 'domain_pages_summary', 'backlinks_competitors': 'competitors' };