Redirects API

The redirects API fetch the redirect chain with status code for any URL which has 3xx temporary or permanent redirect. The API will also capture browser redirects using JavaScript, meta tags or other client side redirect mechanism.

The /redirects API support both GET and POST methods and you’ll get the whole redirect chain in response JSON.

Code

See the request schema here

const fetch = require('node-fetch');

const body = {
  "url": "https://httpbin.org/redirect/2",
  "gotoOptions": {
    "timeout": 10000,
    "waitUntil": "load"
  }
};

fetch('https://browser.agenty.com/api/redirects?apiKey={{API_KEY}}', {
        method: 'post',
        body:    JSON.stringify(body),
        headers: { 'Content-Type': 'application/json' },
      })
      .then(res => res.json())
      .then(json => console.log(json));

Response

[
    {
        "url": "https://httpbin.org/redirect/2",
        "status": 302
    },
    {
        "url": "https://httpbin.org/relative-redirect/1",
        "status": 302
    },
    {
        "url": "https://httpbin.org/get",
        "status": 200
    }
]
14 days free trial

Automate your business with advanced, fully-featured agents on Agenty. Fast, scalable and no-code web automation tool for scraping, change monitoring and more...

Sign up for free →

No credit card required