Anchor to section titled 'undefined'

validationCreate
mutation

Requires write_validations access scope.

Creates a validation.


The input fields for a new validation.


Was this section helpful?

The list of errors that occurred from executing the mutation.

The created validation.


Was this section helpful?
Hide code
Mutation reference
Copy
mutation validationCreate($validation: ValidationCreateInput!) {
  validationCreate(validation: $validation) {
    userErrors {
      field
      message
    }
    validation {
      # Validation fields
    }
  }
}
Hide code
Input
Copy
{
  "validation": {
    "blockOnFailure": true,
    "enable": true,
    "functionId": "<your-functionId>",
    "metafields": [
      {
        "description": "<your-description>",
        "id": "gid://shopify/<objectName>/10079785100",
        "key": "<your-key>",
        "namespace": "<your-namespace>",
        "type": "<your-type>",
        "value": "<your-value>"
      }
    ]
  }
}
input ValidationCreateInput {
  blockOnFailure: Boolean
  enable: Boolean
  functionId: String!
  metafields: [MetafieldInput!]
}

input MetafieldInput {
  description: String
  id: ID
  key: String
  namespace: String
  type: String
  value: String
}