Headers

The headers sent as part of the HTTP request include the x-api-key for authorization and specifies the accepted Content-Type of the API response. Optionally, the header can also include the Prefer header parameter which specifies the amount of detail returned in the response body for JSON content-types.

The following example of the HTTP headers of an API request includes the Accept Header, X-Api-Key Header, and Prefer Header parameters.

Copy
-H  "accept: application/json" -H  "X-Api-Key: 0ccf882053e84aec9ce629517dcf85e3" -H "Prefer: return=representation"

Accept Header

The HTTP request header includes the accept parameter to specify the acceptable format of the data returned in the API response, identified as the content-type in the response header.

The majority of API responses are in JSON format, which is the default content type. Some endpoints, such as /invoices/{invoice_id}/content/{id}, can return files for download.

The following values are allowed:

  • application/json — (default) The API response returns a payload in JSON format. The majority of API responses are returned in JSON format.

  • application/pdf — The API response returns a PDF file to download.

  • application/xml — The API response returns an XML file to download.

  • application/zip — The API response returns a ZIP file to download.

  • text/csv — The API response returns a TXT or CSV file to download.

X-Api-Key Header

The HTTP request header includes an x-api-key to ensure the request is made by a valid user who has authorized access to the API.

Refer to Authentication for more information about x-api-keys and user access.

 

Prefer Header

The HTTP request header can include the optional Prefer setting to specify the amount of detail to return in the response body when the content-type is JSON.

The following Prefer header values are available:

  • return=representation — The API response returns the maximum level of detail in the payload, with expandable entities returned as expanded.

    This returns the same level of detail as including the query parameter return=FULL.

  • return=minimal — The API response returns the minimum detail in the payload, with expandable entities returned as not expanded.

    This returns the same level of detail as including the query parameter return=SIMPLE.

The Prefer header is considered optional as the Return query parameter also specifies the amount of detail to return in the response body and is added to all API requests with a value of FULL, by default

 

 

 

Topic Updated: 4/2025.