title: Got npm module: How to add bearer token to POST request
body: <p>I recently found out that <code>request</code> is no longer maintained, so the best alternative I found is <code>got</code>. I am trying to make an external API call to a REST Server but I am unsure as to how I can add a Bearer token in the authorization header of the POST request.</p>
  <p>This is my code:</p>
  <pre><code>const response = await got.post(
    &quot;https://${SERVER}/${SOME_ID}/conversations/${CONVERSATION_ID}/messages&quot;,
    {
      json: [
        {
          text: req.body.message,
          type: &quot;SystemMessage&quot;,
        }
      ],
      responseType: &quot;json&quot;,
      headers: {
          token: &quot;Bearer pXw4BpO95OOsZiDQS7mQvOjs&quot;
      }
    }
  );
  </code></pre>
  <p>This results in a <code>401 Unauthorized</code>. I was unable to find direction to such implementation in the documentation provided by GOT. And since there are not a lot of queries regarding this package, I was unsuccessful in finding anything on Google as well. If anyone can help me out in this regard, that would be very helpful!</p>