In the following example, let's say that a ServiceCallout policy is in the API proxy request, and the callout response contains multiple headers of the same name (Set-Cookie). Assuming the Service Callout's response variable is the default calloutResponse, the following policy gets the second Set-Cookie header value.

<AssignMessage continueOnError="false" enabled="true" name="get-header">
    <Payload contentType="application/json">
      {"Cookies from Service Callout":" {calloutResponse.header.Set-Cookie.2}"}
  <AssignTo createNew="false" transport="http" type="request"/>

To list all header values, use the following variable instead: