Skip to main content
Solved

error 401 on webhook in flow

  • June 3, 2025
  • 3 replies
  • 97 views

Forum|alt.badge.img
  • Contributor I
  • 1 reply

I’m trying to create an auto-suppression flow with a webhook using the steps in https://medium.com/klaviyo-developers/solution-recipe-9-use-klaviyo-flow-webhooks-to-automate-suppressions-using-segments-and-a-custom-d431c247e96d.

As far as I can tell, I set up everything correctly, but when I try a test, I get “Error: status code 401 received when sending webhook.” Any ideas?

Headers:

Authorization: Klaviyo-API-Key [my private key]

accept: application/json

content-type: application/json

revision: 2024-07-15

JSON body:

{
  "data": {
    "type": "profile-suppression-bulk-create-job",
    "attributes": {
      "suppressions": [
        {
          "email": "{{ person.email }}"
        }
      ]
    }
  }
}

I have tried getting help through the chatbot and email, so this is my last hope:)

Best answer by NicolineLage

Hi ​@AnnaL

Thank you for reaching out to the community. 

Your settings looks right. Have you created a private API-key? 

Try adding this code snippet instead of the one you added:

{
  "data": {
    "type": "profile-suppression-bulk-create-job",
    "attributes": {
      "profiles": {
        "data": [
          {
            "type": "profile",
            "attributes": {
              "email": "{{person.email}}"
            }
          }
        ]
      }
    }
  }
}
 

This guide also takes you through setting up the suppression webhook: https://www.klaviyo.com/blog/solution-recipe-9-use-klaviyo-flow-webhooks-to-automate-suppressions-using-segments-and-klaviyos-apis

 

Best of luck :-)

3 replies

NicolineLage
Partner - Gold
Forum|alt.badge.img+5
  • Partner - Gold
  • 23 replies
  • Answer
  • June 4, 2025

Hi ​@AnnaL

Thank you for reaching out to the community. 

Your settings looks right. Have you created a private API-key? 

Try adding this code snippet instead of the one you added:

{
  "data": {
    "type": "profile-suppression-bulk-create-job",
    "attributes": {
      "profiles": {
        "data": [
          {
            "type": "profile",
            "attributes": {
              "email": "{{person.email}}"
            }
          }
        ]
      }
    }
  }
}
 

This guide also takes you through setting up the suppression webhook: https://www.klaviyo.com/blog/solution-recipe-9-use-klaviyo-flow-webhooks-to-automate-suppressions-using-segments-and-klaviyos-apis

 

Best of luck :-)


Forum|alt.badge.img
  • Author
  • Contributor I
  • 1 reply
  • June 4, 2025

Hi Nicoline

thank you for your reply, thanks to it i noticed i had put in the wrong Api key, so my flow is now working


NicolineLage
Partner - Gold
Forum|alt.badge.img+5
  • Partner - Gold
  • 23 replies
  • June 5, 2025

Hi Nicoline

thank you for your reply, thanks to it i noticed i had put in the wrong Api key, so my flow is now working

I am glad you found a solution. Sometimes it is trial and error. Can you share how you discovered that it was the wrong API-key? Is there something in the guide that could be optimized around this?