Search API Connector Documentation


Include Headers

See below for details on including headers for API Requests using the API Connector add-on for Google Sheets.


What are API Headers?

Headers are key-value pairs that send extra information about your request to the API server. The server responds with headers as well; it’s a two-way exchange. Headers typically aren’t directly related to the content of the request, but instead provide metadata to describe the request and handle authorization.

There are many custom headers, but here are a few of the most common:

  • Accept. Tells the API server which format you expect to receive back, e.g. text/html, application/xml, application/json.
  • Authorization. Include authorization credentials like an API key or token.
  • Content-type. Describes the format of the current request or response.

Add a Header

Required headers and header values are generally available in the developer section of your platform. The exact values and syntax for the header depend on each API, so check your API’s documentation to see the requirements.

To enter a header, enter the key-value pair into the Headers section of the API Connector form.

Add Multiple Headers

You may need to include multiple headers in your API request.

Simply add them, one under the other, in the Headers section of API Connector’s Create Request screen:

Delete Headers

If you need to delete a header, you may do so by clicking the red “x” icon that appears on hover.

Reference a Cell

As an alternative to typing in your headers directly, you can input them into a sheet cell instead, and then reference the cell, e.g. +++Inputs!A1+++ (info).

Previous Connect to an OAuth API
Next Set Request Method

11 thoughts on “Include Headers”

  1. The API i’m calling requires that an “Authorization” header is added with “Bearer ” + access_token, however I don’t know how to reference the token provided by the Custom OAuth2 functionality. Is there a way to access the token dynamically?

    • Hey Jay! Sure, you can reference the cell containing the token using +++ syntax (info). You can also schedule your requests to run in sequence to make sure that the access token is returned before your second request needs it. However this sounds like you’re setting up OAuth2, in which case the custom OAuth2 feature probably makes more sense since it will refresh the access token for you.

    • When I use the +++ syntax, it only makes the request for the first header (ie the first bearer token/user account)

      I am trying to aggregate a few user accounts. Each user account has a unique Bearer Token. What should my header section look like to make the same endpoint request but swapping out the Bearer Token each time so that I am getting the results for each user? It

      • Sorry, you can only cycle through multiple URLs or multiple request bodies, not multiple headers. You would need to create separate requests for these.

    • You can have the raw API data dump to a source sheet, then pull the data you want into cell D29 in a second summary sheet. Sheets provides a lot of functions for this (VLOOKUP is probably the most popular).

      Another option would be our IMPORTAPI custom function, which lets you run API queries from any cell.


Leave a Comment

Table of Contents