# 400 Bad Request on Postmark API

**URL:** <https://community.postman.com/t/400-bad-request-on-postmark-api/38078>\
**Category:** Help Hub\
**Created:** [August 10, 2022, 1:25pm UTC](https://community.postman.com/t/400-bad-request-on-postmark-api/38078 "2022-08-10T13:25:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![descent-module-engi3](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@descent-module-engi3](https://community.postman.com/u/descent-module-engi3)\
**Post date:** [August 10, 2022, 1:25pm UTC](https://community.postman.com/t/400-bad-request-on-postmark-api/38078/1 "2022-08-10T13:25:55Z")

</div>

Hello folks,

I am trying to use Postman to query Postmark’s free DMARC API at [API Docs | Free DMARC Monitoring from Postmark](https://dmarc.postmarkapp.com/api/)

I’ve setup Postman to replicate what I used to curl manually, but when I run it with Postman I get a 400 Bad Request. If I copy and paste the cURL code snippet that Postman generated into Terminal on macOS, the query succeeds. What is Postman doing different that causes the call to fail?

```auto
curl -L -X GET 'https://dmarc.postmarkapp.com/records/my' \
-H 'Accept: application/json' \
-H 'X-Api-Token: MY_TOKEN'

```

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [August 11, 2022, 2:50pm UTC](https://community.postman.com/t/400-bad-request-on-postmark-api/38078/2 "2022-08-11T14:50:05Z")

</div>

Hi @descent-module-engi3

Could you screenshot what your Postman looks like?  
(Delete / Don’t share your X-Api-Token in the screenshot).

---

<div class="post-metadata">

**Author:** ![descent-module-engi3](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@descent-module-engi3](https://community.postman.com/u/descent-module-engi3)\
**Post date:** [August 11, 2022, 4:38pm UTC](https://community.postman.com/t/400-bad-request-on-postmark-api/38078/3 "2022-08-11T16:38:11Z")

</div>

Pretty simple…

 ![Screen Shot 2022-08-11 at 6.37.25 PM](https://us1.discourse-cdn.com/getpostman/original/2X/3/3fe27a99002b7a35c4c93a04af0517f32ffefe6d.png)  
 ![Screen Shot 2022-08-11 at 6.37.48 PM](https://us1.discourse-cdn.com/getpostman/original/2X/4/410a4730bc0bc709dfe60d3e845d6a44af41d75a.png)

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [August 11, 2022, 5:41pm UTC](https://community.postman.com/t/400-bad-request-on-postmark-api/38078/4 "2022-08-11T17:41:44Z")

</div>

Just read this in the documentation;

> All requests to Postmark’s API require you to authenticate yourself to the service. In order to do this you must send the correct HTTP header with the correct API token. Postmark has two types of API tokens:
> 
> - **Server Token —** `X-Postmark-Server-Token` Used for requests that require server level privileges. This token can be found from the API Tokens tab under your Postmark server.
> - **Account Token —** `X-Postmark-Account-Token` Used for requests that require account level privileges. This token is only accessible by the account owner, and can be found on the [API Tokens](https://account.postmarkapp.com/api_tokens) tab of your Postmark account.

This is separate from the PM API you have added already.

Also, I can’t find any reference to `https://dmarc.postmarkapp.com/records/my` in the documentation… Might be worth checking the URL against the available options in the atached documentation;

Example;

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/5/5a48f0e80dbdfac3d4dd2784ea2500c015734313.png)

> **[Overview | Postmark Developer Documentation](https://postmarkapp.com/developer/api/overview#authentication)**
>
> How to authenticate with the Postmark API and handle API responses.

---

<div class="post-metadata">

**Author:** ![descent-module-engi3](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@descent-module-engi3](https://community.postman.com/u/descent-module-engi3)\
**Post date:** [August 11, 2022, 5:53pm UTC](https://community.postman.com/t/400-bad-request-on-postmark-api/38078/5 "2022-08-11T17:53:16Z")

</div>

You’re looking at the docs for the main Postmark product, not their free DMARC service, those docs are here → [API Docs | Free DMARC Monitoring from Postmark](https://dmarc.postmarkapp.com/api) as posted on my original post

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [August 11, 2022, 6:10pm UTC](https://community.postman.com/t/400-bad-request-on-postmark-api/38078/6 "2022-08-11T18:10:43Z")

</div>

My bad …

For your {{PM\_FM}} variable, have you used a Postman API key or a DMARC API key?

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [August 11, 2022, 6:14pm UTC](https://community.postman.com/t/400-bad-request-on-postmark-api/38078/7 "2022-08-11T18:14:54Z")

</div>

This orange dot also means you haven’t saved your changes… which could explain why its not sending the right request.

![image](https://us1.discourse-cdn.com/getpostman/original/2X/7/71c1ce43a051ade111cc5c81be5a2af6a73ee95a.png)

You could also verify what it is actually sending in the console, located in the bottom left.

---

<div class="post-metadata">

**Author:** ![descent-module-engi3](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@descent-module-engi3](https://community.postman.com/u/descent-module-engi3)\
**Post date:** [August 11, 2022, 6:24pm UTC](https://community.postman.com/t/400-bad-request-on-postmark-api/38078/8 "2022-08-11T18:24:07Z")

</div>

Thanks for the console tip! Didn’t get much insight though? I did save it before hand, and yes, of course I’m using the Postmark key. It works via terminal, just not via Postman. Was hoping to automate some of my tasks.

 ![Screen Shot 2022-08-11 at 8.22.26 PM](https://us1.discourse-cdn.com/getpostman/original/2X/2/24d036ae44f51ccb137a60fe517a30ba967e1c74.png)

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [August 17, 2022, 11:07am UTC](https://community.postman.com/t/400-bad-request-on-postmark-api/38078/9 "2022-08-17T11:07:38Z")

</div>

My initial thoughts is that the problem is still something to do with the headers.

The blurb from the API documentation says it could be malformed JSON although it doesn’t appear that the get request against the /records/my end point request requires a JSON body or any other parameters than the two you’ve included.

Can you try a post request which doesn’t require authentication?

This does require a JSON request in the body. For example…

```auto
{
  "email": "email@domain.com",
  "domain": "activecampaign.com"
}

```
