class UrlFetchApp method .getHeaders()

UrlFetchApp is the Apps Script service.

.getHeaders() is the method name you will see after a dot in your code.

What it does

Returns the HTTP headers from a response.

Why it's used

  • Read rate-limit or auth headers from an API.
  • Debug content-type mismatches on webhook responses.

Common errors

  • Forgetting parentheses on getHeaders. Write UrlFetchApp.getHeaders(), not UrlFetchApp.getHeaders or getHeaders by itself.
  • Skipping dots between chained calls. Each step needs a dot, like UrlFetchApp.getHeaders().
  • Adding spaces where they do not belong. Write UrlFetchApp.getHeaders(), not UrlFetchApp .getHeaders(), UrlFetchApp.getHeaders (), or UrlFetchApp . getHeaders().
  • Wrong capitalization. Use UrlFetchApp and getHeaders, not urlfetchapp or getheaders.

Explore

Related methods

Better Sheets tutorials

No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.

Related blog posts

Written guides about UrlFetchApp.getHeaders().

Browse the blog