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">
  <Set>
    <Payload contentType="application/json">
      {"Cookies from Service Callout":" {calloutResponse.header.Set-Cookie.2}"}
    </Payload>
  </Set>
  <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
  <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

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

{calloutResponse.header.Set-Cookie.values}