How to find redirects with On-Page API?

Redirect is a URL forwarding to another URL. Once a website visitor or a search engine crawler gets to a page with a redirect, they will be sent to a different URL where the redirect is pointing.

Generally, redirects don’t cause any trouble. However, if they are set up incorrectly and point to the wrong destination URLs or form a redirect chain, it may lead to loss of traffic and link equity.

Scanning a website to check the setup of redirect URLs is always a smart idea as regular audits will help you to quickly spot and fix any issues.

To find redirects with DataForSEO On-Page API, you should register and get your api key necessary for authentication.

Learn more about Authentication in our docs >>

As soon as you have the API key, you can audit redirects in a few simple steps.

1 Set a task to On-Page API.


    "target": "",
    "max_crawl_pages": 10,
    "tag": "some_string_123",
    "pingback_url": "$id&tag=$tag"

2 Call the Summary endpoint to review collective stats for the website.


In the "checks" array, find the "is_redirect" counter. If this field shows a value greater than 0, our crawler found the indicated number of redirects on the target website.

3 To extract the list of redirects, call the Pages endpoint, and apply a filter as in the example.


    "id": "07281559-0695-0216-0000-c269be8b7592",
    "filters": ["resource_type", "=", "redirect"]

The results of the task will contain a list of redirecting URLs along with their status codes, target and source URLs, as well as on-page check-ups and performance metrics.

Useful read:

What are redirect chains and loops and how to check them with On-Page API?

Embed DataForSeo widget on your website

Embed code: