Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use UrlFetchApp.fetch() to send an HTTP request from Google Apps Script to a screenshot provider’s documented endpoint. The provider determines the authentication method, request body, and whether the response is image bytes, JSON, or an asynchronous job. For a JSON POST, keep the API key in Script Properties, serialize the body with JSON.stringify(), and check the HTTP status before handling the result.

What you need before making the request

  • A screenshot API endpoint and its current request documentation. Confirm the HTTP method, authentication format, required fields, response type, and any account or permission requirements.
  • An API credential if the provider requires one. Apps Script authorization and the provider’s credential are separate: granting permission to fetch external URLs does not authenticate you with the screenshot service.
  • An Apps Script project authorized for external requests. If you explicitly declare OAuth scopes in the manifest, include https://www.googleapis.com/auth/script.external_request. Google explains the external-request permission in its External APIs guide and UrlFetchApp reference.

Google’s URL Fetch service sends HTTP and HTTPS requests using Google’s network infrastructure and returns an HTTPResponse. The provider, not Apps Script, decides what a successful screenshot response looks like. See Google’s Url Fetch service reference.

Send a JSON POST request

This reusable pattern is appropriate only when the provider documents a JSON POST, an API key in a header, and a response that can be read as text. Replace the endpoint, authentication header, and request fields with the provider’s actual specifications. The example does not assume a screenshot API’s response is JSON.

function requestScreenshot() {
  const apiKey = PropertiesService.getScriptProperties()
    .getProperty('SCREENSHOT_API_KEY');
  if (!apiKey) {
    throw new Error('Set SCREENSHOT_API_KEY in Script Properties.');
  }

  const endpoint = 'https://YOUR_PROVIDER.example/v1/screenshot';
  const requestData = {
    url: 'https://example.com'
    // Add only parameters documented by your provider.
  };

  const response = UrlFetchApp.fetch(endpoint, {
    method: 'post',
    contentType: 'application/json',
    headers: { 'X-API-KEY': apiKey },
    payload: JSON.stringify(requestData),
    muteHttpExceptions: true
  });

  const status = response.getResponseCode();
  const body = response.getContentText();
  if (status < 200 || status >= 300) {
    throw new Error(`Screenshot API returned ${status}: ${body}`);
  }

  // Parse only if the provider documents a JSON response.
  return body;
}
  1. In the Apps Script editor, open Project Settings and add a Script Property named SCREENSHOT_API_KEY with your provider credential. Avoid placing credentials in source code or logging their values.
  2. Replace endpoint, X-API-KEY, and requestData with the values required by the service. An API may instead use a bearer token, a query parameter, OAuth, or another documented method.
  3. Run requestScreenshot() from the editor and approve the external-request authorization prompt when asked. If the project declares scopes explicitly, make sure the external-request scope is included.
  4. Inspect the returned status and body. Once the request succeeds, handle its documented response type rather than assuming it contains JSON or image data.

For a JSON API, contentType: 'application/json' and payload: JSON.stringify(requestData) send a serialized JSON body. When the provider documents JSON output, parse response text with JSON.parse(response.getContentText()); otherwise use the method suitable for its result, such as getBlob() for binary content. Google documents these fetch options and response methods in the UrlFetchApp reference and shows JSON request and response handling in its External APIs guide.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Handle the provider’s actual response

Do not assume every screenshot API returns a finished image in the initial response. Depending on its contract, the service may return image bytes, a URL, JSON metadata, or a job identifier that must be collected later. Use getContentText() for textual responses and getBlob() when the provider returns binary image data. Check the status code before parsing or saving anything.

Save a directly returned image to Google Drive

If the provider documents that a successful response body is the image itself, a blob can be saved to Drive:

function saveScreenshotBlob(response) {
  const blob = response.getBlob().setName('screenshot.png');
  const file = DriveApp.createFile(blob);
  return file.getUrl();
}

Call this only after checking for a successful status and confirming the provider returns image bytes. Set a filename and MIME type appropriate to the actual output. If the provider returns JSON containing a download URL or job ID, follow that provider’s documented retrieval flow instead.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Handle asynchronous screenshot jobs

For an asynchronous API, the first response may confirm submission and provide a job ID rather than an image. Poll only at the interval and endpoint the provider documents, or use a webhook if it supports one. Avoid sleeping and polling for long periods inside one Apps Script execution: executions have a runtime limit. A later scheduled run or a provider webhook may be a better fit, subject to the provider’s design and the Apps Script deployment you choose.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Provider-specific example: ScreenshotCenter

ScreenshotCenter’s provider-hosted automation document describes a POST to https://api.screenshotcenter.com/v1/screenshot with an X-API-KEY header, JSON content type, and a JSON body containing a target url. It also describes optional steps for actions such as click, type, wait, and screenshot, plus hide_popups, hide_ads, and video options. The document says to submit the job and poll or use a webhook to collect the result. These are details of that provider’s example, not a general screenshot API contract; confirm the current API reference, response schema, account access, and terms before adapting it. ScreenshotCenter automation document.

Quotas, size limits, and reliability

Google’s quotas page, last updated September 3, 2026, lists URL Fetch limits of 20,000 calls per day for consumer accounts and 100,000 per day for Google Workspace accounts, with a six-minute maximum script runtime per execution for both. It also lists a 50 MB maximum per URL Fetch response and per POST, up to 100 headers, an 8 KB total header limit, and a 2 KB URL length limit. Google says quotas may change without notice; check the current quotas page before deployment. Quotas are per user and reset 24 hours after the first request.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  • Budget for both Apps Script limits and the screenshot provider’s own rate limits, pricing, and response-size restrictions.
  • Large full-page images can exceed response-size limits. Consider whether the provider supports a smaller viewport, image format, or other output controls.
  • For batches, account for every API call, any polling requests, and the six-minute execution ceiling. Process work in bounded chunks instead of a single long-running loop.
  • If the provider restricts access by source IP, Apps Script requests come from a pool of Google IP ranges; consult Google’s published IP range information via the UrlFetchApp reference.
  • Before sending private or authenticated target pages to a third-party screenshot service, check the provider’s data handling and terms as well as whether you are permitted to capture that page.

Troubleshooting common failures

Authorization or scope error

Run the function interactively to trigger authorization. If OAuth scopes are explicitly listed in the manifest, add https://www.googleapis.com/auth/script.external_request. This is Google permission for outbound fetching, not an API key for the screenshot service.

401 or 403 response

Check that the provider credential exists in Script Properties, is current, and is sent exactly as documented. Confirm the endpoint and account permissions. Do not assume an X-API-KEY header is correct for another provider.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

400 response or invalid request

Compare the method, content type, JSON field names, and field types against the provider’s current API docs. Ensure the request body is serialized with JSON.stringify() when JSON is required. Check the response body with muteHttpExceptions: true enabled.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Apps Script throws before the response is available

Network, DNS, or connection failures may prevent an HTTP response from being returned, so there may be no status code or response body to inspect. Verify the endpoint is reachable, correctly spelled, and HTTPS-capable, then try a simple documented request.

Success status but no image appears

The success response may be JSON, a download link, or an asynchronous job acknowledgement rather than image bytes. Inspect the provider’s response schema and retrieve the result using its documented flow before calling getBlob() or saving a file.

Timeout, oversized response, or execution limit

Reduce batch size, avoid excessive polling, and check both Google’s current quotas and the provider’s time and size limits. A large screenshot may hit the 50 MB URL Fetch response cap listed by Google; an asynchronous job or smaller capture may be more suitable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Provider requires OAuth rather than an API key

Do not substitute an API-key header. Implement the provider’s documented OAuth flow; Google’s External APIs guide points to OAuth libraries and notes service-account authentication as an option for some use cases.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo offers a screenshot API that can be called from Apps Script with UrlFetchApp.fetch(). Cookie banners are accepted and removed before capture, along with known newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers say the page verdict and billing status. ScreenshotNeo also has an MCP server for AI agents, and its free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots. See the ScreenshotNeo documentation for current request options.

function screenshotWithScreenshotNeo() {
  const apiKey = PropertiesService.getScriptProperties()
    .getProperty('SCREENSHOTNEO_API_KEY');
  if (!apiKey) {
    throw new Error('Set SCREENSHOTNEO_API_KEY in Script Properties.');
  }

  const response = UrlFetchApp.fetch(
    'https://api.screenshotneo.com/v1/shot?access_key=' +
      encodeURIComponent(apiKey) +
      '&url=' + encodeURIComponent('https://example.com'),
    { muteHttpExceptions: true }
  );

  const status = response.getResponseCode();
  if (status < 200 || status >= 300) {
    throw new Error(`ScreenshotNeo returned ${status}: ${response.getContentText()}`);
  }

  const file = DriveApp.createFile(
    response.getBlob().setName('screenshot.webp')
  );
  return file.getUrl();
}

Add SCREENSHOTNEO_API_KEY as a Script Property, replacing the example target URL with the page you want to capture. The response is saved as a WebP file; see the ScreenshotNeo docs for API options and response details. Sign up for 1,000 free screenshots a month with no card.

Frequently Asked Questions

Can Google Apps Script call a screenshot API that returns a PNG or JPEG?

Yes. Use the response handling documented by the provider and Apps Script, such as reading the response as a blob for binary image data; verify the returned format and MIME type before saving it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I use a screenshot API that authenticates with OAuth?

Yes, if you implement the provider’s required OAuth flow. Apps Script’s external-request authorization does not replace provider authentication.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.