Send Admin API request

The Send Admin API request action sends a mutation to the Shopify GraphQL Admin API. By doing so, you can do almost any action the API allows using Flow.

Fields

The Send Admin API request action contains the following fields.

Fields used in the Send Admin API request action.
FieldDescription
MutationRequired. The Shopify GraphQL Admin mutation that you want to call. A mutation is an API that takes action or updates data.
Mutation inputsRequired. The data (in JSON) that you need to send as part of your mutation request. Each mutation requires a different set of data, which is documented in the link provided for each mutation. To construct the necessary JSON, you can use Liquid or a Run code action.

Triggers

The Send Admin API request action can be used in any workflow, with any trigger, as long as the workflow provides the data necessary to construct the mutation inputs.

Examples

Example 1: Update the template used for a product

In this example, we'll use the Send Admin API request action to call the productUpdate mutation to update the template used for a product.

The id field is required and must be a valid product GID. Here, we set it with the {{product.id}} Liquid variable. This assumes that your workflow has a trigger that provides a product object.

The templateSuffix is the name of the template that you want to apply to the product. For example, if you want to apply the pre-order template, you would set the templateSuffix to pre-order.

{
  "input": {
    "templateSuffix": "pre-order",
    "id": "{{product.id}}"
  }
}

Example 2: Update a customer's tax exemption status

In this example, we'll use the Send Admin API request action to call the customerUpdate mutation to update a customer's tax exemption status.

The id field is required and must be a valid customer GID. Here, we set it with the {{order.customer.id}} Liquid variable. This assumes that your workflow has a trigger that provides an order object.

The taxExempt field is a boolean that indicates whether the customer is tax exempt. In this example, we set it to true.

{
  "input": {
    "id": "{{order.customer.id}}",
    "taxExempt": true
  }
}

Example 3: Update a customer's locale

In this example, we'll use the Send Admin API request action to call the customerUpdate mutation to update a customer's locale.

The id field is required and must be a valid customer GID. Here, we set it with the {{customer.id}} Liquid variable. This assumes that your workflow has a trigger that provides a customer object.

The locale field is a string that represents the customer's locale. In this example, we set it to en.

{
  "input": {
    "id": "{{customer.id}}",
    "locale": "en"
  }
}

Limitations

The Send Admin API request action has the following limitations:

  • The action doesn't return data into the Flow environment as a result of the mutation.
  • The action doesn't support GraphQL queries, only mutations.
  • The action doesn't support asynchronous mutations or mutations that return a Job type.
  • The action doesn't support mutations that are specific to certain apps, which include subscriptions and discount mutations.
  • The action will display a list of Mutations and Mutation inputs from a single Shopify API version, which is currently 2024-01.
  • When the API version is upgraded and contains a breaking change, it can cause this action to fail if you rely upon that field.
Can't find answers you're looking for? We're here to help you.