# Using pm.sendRequest with NTLM authentication

**URL:** <https://community.postman.com/t/using-pm-sendrequest-with-ntlm-authentication/1520>\
**Category:** Help Hub\
**Created:** [May 2, 2018, 10:53am UTC](https://community.postman.com/t/using-pm-sendrequest-with-ntlm-authentication/1520 "2018-05-02T10:53:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RyanHowardTest](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@RyanHowardTest](https://community.postman.com/u/RyanHowardTest)\
**Post date:** [May 2, 2018, 10:53am UTC](https://community.postman.com/t/using-pm-sendrequest-with-ntlm-authentication/1520/1 "2018-05-02T10:53:36Z")

</div>

Hi,

I’m new to pm.sendRequest and need some help with how to add NTLM authentication to the request headers

Here is what I have so far:

var EndPoint = pm.environment.get(“SoapEndpoint”)`;

```
const echoPostRequest = {
  url: EndPoint,
  method: 'POST',
  header: {
      'Content-Type':'text/xml',
      'SoapAction':pm.globals.get("SoapAction"),
  },
  
   body: {
    mode: 'raw',
    raw: pm.globals.get("GetXML")
  }
 };

```

pm.sendRequest(echoPostRequest, function (err, res) {  
console.log(err ? err : res);  
});

I have a UserName, Password and Domain in the Authentication tab of my request. Can I reference those if I execute pm.sendRequest in pre request of test or do I have to manually specify here too.

if I have to manually specify where/how do I do it?. Do I have to tell it to do NTLM authentication?

Thanks  
Ryan

---

<div class="post-metadata">

**Author:** ![kunagpal](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kunagpal/32/9_2.png) [@kunagpal](https://community.postman.com/u/kunagpal)\
**Post date:** [July 5, 2018, 8:14pm UTC](https://community.postman.com/t/using-pm-sendrequest-with-ntlm-authentication/1520/2 "2018-07-05T20:14:38Z")

</div>

Hey @RyanHowardTest, `pm.sendRequest` works with any valid Postman request structure, so you can use NTLM auth as follows:

```auto
pm.sendRequest({
  url: EndPoint,
  header: {
      'Content-Type': 'text/xml',
      SoapAction: pm.globals.get('SoapAction')
  },
  method: 'POST',
  auth: {
    type: 'ntlm',
    ntlm: {
      username: 'uname',
      password: 'pass',
      domain: 'domain',
      workstation: 'workstation'
   }
 },
 body: {
    mode: 'raw',
    raw: pm.globals.get('GetXML')
  }
});

```

---

<div class="post-metadata">

**Author:** ![felipeapj](https://avatars.discourse-cdn.com/v4/letter/f/2acd7d/32.png) [@felipeapj](https://community.postman.com/u/felipeapj)\
**Post date:** [June 24, 2022, 12:43pm UTC](https://community.postman.com/t/using-pm-sendrequest-with-ntlm-authentication/1520/3 "2022-06-24T12:43:07Z")

</div>

it works with GET requests? because i’m trying but without success…
