Print

What is an API Header?

Contents

  1. What are API headers?
  2. What are common API request headers?
  3. How are headers structured ?
  4. How to enter headers in API Connector?

What are API headers?

In API requests, request headers are used to provide additional information for a server to process an API request. For example, they might specify that the data being sent is in JSON format, identify which version of the API to call, or provide an API key for authentication. Typically headers are used to provide some metadata related to the request, and don't directly specify which data you want to retrieve (that's handled by the API request URL).

The server responds with headers as well; it's a two-way exchange. 

What are common API request headers?

There are many possible headers, but these are some common examples:

  • Accept. Tells the API server which format you expect to receive back, e.g. JSON or XML
  • Authorization. Provides authentication details, such as an API key or user credentials
  • Content-type. Specifies the type of data being sent to the server in the request body
  • Cache-Control. Specifies whether and how a response should be cached.
  • User-Agent. Identifies the client making the request.

How are headers structured?

API headers typically have a key and a value. The key identifies the type of information being provided in the header, while the value provides the actual data or information. For example, a Content-Type header might be structured like this:

Content-Type:application/json

In this example, Content-Type is the key, and application/json is the value, which indicates that the request body contains data in JSON format.

API headers may also include additional parameters after the value. For example, a Cache-Control header might be structured like this:

Cache-Control:no-store, no-cache, must-revalidate

In this example, the Cache-Control key has three values that specify the caching rules for the response.

How to enter headers in API Connector?

To use headers in API Connector for Sheets (and most other no-code API tools), enter key-value pairs into the Headers section, like this:

headers-addheader

Leave a Comment

Jump To