GraphQL API and Zapier Weebhooks | discountCodeBasic - HTTP Status Code: 400

Topic summary

Issue: User receives HTTP 400 error when creating discount codes via GraphQL API through Zapier webhooks, despite having proper write/read discount permissions.

Root Cause Identified:

  • The “Data Pass-Through” setting in Zapier is causing the 400 error
  • When disabled, the mutation works successfully
  • When enabled with dynamic data from previous steps, it fails

Testing Results:

  • Static hardcoded data works correctly when Data Pass-Through is off
  • Dynamic variables (code, startsAt, endsAt) pulled from previous Zapier steps trigger the error
  • Invalid DateTime errors appear when actual data issues exist, but the 400 error occurs even with valid data when pass-through is enabled

Current Status:

  • Problem isolated to Zapier’s Data Pass-Through feature interaction with GraphQL variables
  • User may need to investigate how Zapier formats/sends data when pass-through is active
  • No clear resolution yet for using dynamic data with pass-through enabled
Summarized with AI on November 12. AI used: claude-sonnet-4-5-20250929.

I’m trying to connect GraphQL API to create a discount (discountCodeBasic) but I keep getting
'Failed to create a request in Webhooks by Zapier | Bad Request (HTTP Status Code: 400)’

Allowed: write/read discount permissions in custom app.

API Version:
admin/api/2024-01/graphql.json

{
  "query": "mutation discountCodeBasicCreate($basicCodeDiscount: DiscountCodeBasicInput!) { discountCodeBasicCreate(basicCodeDiscount: $basicCodeDiscount) { codeDiscountNode { codeDiscount { ... on DiscountCodeBasic { title codes(first: 10) { nodes { code } } startsAt endsAt customerSelection { ... on DiscountCustomerAll { allCustomers } } customerGets { value { ... on DiscountPercentage { percentage } } items { ... on AllDiscountItems { allItems } } } appliesOncePerCustomer } } } userErrors { field code message } } }",
  "variables": {
    "basicCodeDiscount": {
      "title": "30% off Baby Model 24 Hrs Only",
      "code": "{{_GEN_1707882510278__randomCode}}",
      "startsAt": "{{_GEN_1707882510278__startDate}}",
      "endsAt": "{{_GEN_1707882510278__endDate}}",
      "customerSelection": {
        "all": true
      },
      "customerGets": {
        "value": {
          "percentage": 0.3
        },
        "items": {
          "all": true
        }
      },
      "appliesOncePerCustomer": true
    }
  }
}

Where Code, StartsAt, EndsAt are pulled from previous step generated by JS.

Looks like this:
“code”: CODE3753
“startsAt”: 2024-02-13T21:17:32.991Z
“endsAt”: 2024-02-14T21:17:32.991Z

I tried static data as well, same error.


Screenshot of the entire setup in Zapier:


If someone could advice what am I doing wrong! :expressionless_face:
Gemini/GPT both say it looks correct.

Thanks!

Try this static data, it worked for my in graphql:

mutation discountCodeBasicCreate {
  discountCodeBasicCreate(
    basicCodeDiscount: {
      title: "30% off Baby Model 24 Hrs Only",
      code: "UNIQUECODE123",
      startsAt: "2024-02-13T21:17:32Z",
      endsAt: "2024-02-14T21:17:32Z",
      customerSelection: {
        all: true
      },
      customerGets: {
        value: {
          percentage: 0.3
        },
        items: {
          all: true
        }
      },
      appliesOncePerCustomer: true
    }
  ) {
    codeDiscountNode {
      codeDiscount {
        ... on DiscountCodeBasic {
          title
          codes(first: 10) {
            nodes {
              code
            }
          }
          startsAt
          endsAt
          customerSelection {
            ... on DiscountCustomerAll {
              allCustomers
            }
          }
          customerGets {
            value {
              ... on DiscountPercentage {
                percentage
              }
            }
            items {
              ... on AllDiscountItems {
                allItems
              }
            }
          }
          appliesOncePerCustomer
        }
      }
    }
    userErrors {
      field
      message
    }
  }
}

Sorry, let me actually try a few more things.

After doing some testing, it looks like its the “Data Pass-Through” that is causing it. When turned off it works but when turned on, it does cause the 400 error.

If you are pulling data from previous steps then somehow this casuing it. I don’t think it’s the data, because I at least get an error back when the data is wrong:

errors
errors
1
1
message
message
Variable $basicCodeDiscount of type DiscountCodeBasicInput! was provided invalid value for startsAt (invalid DateTime ''), endsAt (invalid DateTime '')
locations
locations
1
1
line
line
1
column
column
34
extensions
extensions
value
value
title
title
30% off Baby Model 24 Hrs Only
code
code
startsAt
startsAt
endsAt
endsAt
customerSelection
customerSelection
all
all
true
customerGets
customerGets
value
value
percentage
percentage
0.3
items
items
all
all
true
appliesOncePerCustomer
appliesOncePerCustomer
true
problems
problems
1
1
path
path
1
1
startsAt
explanation
explanation
invalid DateTime ''
message
message
invalid DateTime ''
2
2
path
path
1
1
endsAt
explanation
explanation
invalid DateTime ''
message
message
invalid DateTime ''

So you might have to see what Zapier is doing when it turns on data pass-through.