--- title: "Send a synchronous GET / POST request" slug: "xhr-get-post" updated: 2025-08-26T07:13:20Z published: 2025-08-26T07:13:20Z canonical: "helpcenter.autify.com/xhr-get-post" --- > ## Documentation Index > Fetch the complete documentation index at: https://helpcenter.autify.com/llms.txt > Use this file to discover all available pages before exploring further. # Send GET / POST request synchronously Sends a GET / POST request to the specified API endpoint. Since these codes are samples, please set appropriate values for the header and body according to the specifications of the API to be requested. ## **Send GET request to a URL** ```typescript const url = "API URL"; // Send GET request const response = await page.request.get(url); // Check status code if (response.status() !== 200) {  throw new Error("Error " + response.status()); } // Parse JSON and output log const data = await response.json(); console.log(data); ``` ## **Send POST request to a URL** ```typescript const url = "API URL"; // Send POST request const response = await page.request.post(url, {  headers: {    "Content-Type": "application/x-www-form-urlencoded",  },  data: "key=value",  // Form data }); // Check status code if (response.status() !== 200) {  throw new Error("Error " + response.status()); } // Parse JSON and output log const data = await response.json(); console.log(data); ```