How to create discount codes via Shopify Flow using discountCodeBasicCreate mutation?

Hi everyone,

I’m trying to create discount codes automatically using Shopify Flow with the “Send Admin API request” action and the discountCodeBasicCreate mutation.

However, I’m getting this error:

“La mutación ‘discountCodeBasicCreate’ no existe en la versión unstable de la API”

According to the official GraphQL documentation, this mutation exists and should work, but Flow seems to be using the “unstable” API version.

My questions:

  1. Is there a way to specify the API version in Shopify Flow’s “Send Admin API request” action?

  2. Has anyone successfully created discount codes via Flow using this mutation?

  3. Is there an alternative approach to programmatically create discount codes from Flow?

What I’m trying to achieve:

  • Trigger: Customer abandons checkout

  • Action 1: Save abandoned cart products to customer metafield (this works)

  • Action 2: Create a discount code with expiration date (this fails)

  • Action 3: Send email with the discount code

Any help would be greatly appreciated!

Thanks!

Interesting.
Last official word was 2025-10:

https://help.shopify.com/en/manual/shopify-flow/concepts/admin-api

You’d probably need an App for “Send email”. Or create gift cards instead – they are sent automatically.

I’ve just created a discount code without problems:

Customer abandons checkout previously used the unstable version, but should now use the same version as the rest of Flow tasks.