Multiple API Keys in Header

A service that I am working with requires two values to be sent in the header.

Making a successful request requires authentication using request headers. Valid values for the request header attributes named x-api-key and x-security-key are required to ensure secure access to your data. The content of your header might look something like the following:

    "x-api-key": "your-supplied-api-key",
    "x-security-key": "your-supplied-security-key"

How do I add two keys to the header for authorization? I can do it per request, but trying to do it correctly so that this will apply to all of my requests in the collection.

My end goal is to make a Custom Connector for Power Apps, MS Flow, etc.

Hey @johngalt2,

Welcome to the Community! :wave:

You can add those at the Collection level in a Pre-request Script like this:

pm.request.headers.add({key: "x-api-key", value: "your-supplied-api-key" })

pm.request.headers.add({key: "x-security-key", value: "your-supplied-security-key" }) 

Each request in your Collection will then use these 2 Headers in every call.

You could even add these at the Folder level if you wanted to only do this for a subset of requests in the Collection.

1 Like