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:
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.