We are using cloud pages for hosting landing pages. We need to make a request to an api which is behind basic authentication.

I don't see in the programmatic marketing content get request docs (https://developer.salesforce.com/docs/atlas.en-us.mc-programmatic-content.meta/mc-programmatic-content/httpget.htm) examples of how to add the authorization header. Is this something that is possible via ampscript and if so, can someone post an example?

1 Answer 1


If you want to connect to SFMC SOAP API, you can do so with ampscript API functions, full documentation is avalible here.
If you plan to connect to external API or SFMC REST API you can use HTTP functions to send GET and POST requests.
If you need to define header for a GET request, you can perform the request with SSJS GET function and pass your response to ampsctipt with SetValue

  • So how do you add the authorization header to the get request .developer.salesforce.com/docs/…
    – findev
    Dec 16, 2018 at 13:07
  • Forgot that ampscript get won't allow to set header. I added a edit above explaining how to do it with SSJS and pass value to ampscript Dec 16, 2018 at 14:05
  • Thanks. Will test it. Is there a function for base64 encoding? => to set the value for the authorization header. Actually found it Base64Encode
    – findev
    Dec 16, 2018 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.