Intents API
The Intents API launches Shopify's native admin interfaces for creating and editing resources. When your extension calls an intent, merchants complete their changes using the standard admin UI, and your extension receives the result. This means you don't need to build custom forms.
Use this API to build workflows like adding products to collections from bulk actions, creating multiple related resources in sequence (like a product, collection, and discount for a promotion), opening specific resources for editing from custom buttons, or launching discount creation with pre-selected types.
If you do render a form on an intent screen, the screen can close and tear down the runtime before async saves settle. Return a promise from your submit handler and call event.waitUntil(promise). See Handle async submission on the Form reference.
Anchor to Use casesUse cases
- Resource creation: Launch Shopify's native creation forms for products, collections, discounts, and other resources directly from your app home page.
- Resource editing: Open existing resources for editing without building custom forms.
- Multi-step workflows: Chain intent invocations to create related resources in sequence, like a product, collection, and discount for a promotion.
- Settings management: Navigate merchants to specific Shopify settings pages like store details, order processing, or gift card expiration.
Anchor to invoke methodinvoke method
The invoke method launches a Shopify admin workflow for creating or editing resources. The method returns a promise that resolves to an activity handle you can await to get the workflow result.
The method accepts either:
- String query:
${action}:${type},${value}with optional second parameter () - Object: Properties for
action,type,value, anddata
IntentQueryOptions parameters
Optional parameters for the invoke method when using the string query format:
value(string): The resource identifier for edit operations (for example,). Required when editing existing resources. Omit for create operations.data({ [key: string]: unknown }): Additional context required by specific resource types. For example, discounts require a type, variants require a product ID, and metaobjects require a definition type.
Supported resources
The following tables show which resource types you can create or edit, and what values you need to pass for value and data for each operation.
Article
Articles are blog posts published on the Online Store. Use this to create or edit articles for merchant blogs.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | — |
edit | | | — |
Catalog
Catalogs are product groupings that organize products for different markets or channels. Use this to create or edit catalogs for B2B or multi-market selling.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | — |
edit | | | — |
Collection
Collections are groups of products organized manually or by automated rules. Use this to create or edit product collections.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | — |
edit | | | — |
Customer
Customers are profiles with contact information, order history, and metadata. Use this to create or edit customer accounts.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | — |
edit | | | — |
Delivery profile
Delivery profiles define shipping rates and rules for products across locations and zones. Use this to create or edit shipping configurations for different product groups.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | — |
edit | | | — |
Discount
Discounts are price reductions applied to products, orders, or shipping. Use this to create or edit discount codes and automatic discounts. Creating discounts requires specifying a discount type.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | { type: 'amount-off-product' | 'amount-off-order' | 'buy-x-get-y' | 'free-shipping' } |
edit | | | — |
Location
Locations are physical or virtual places where merchants store inventory and fulfill orders. Use this to create or edit locations for managing stock and fulfillment.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | — |
edit | | | — |
Market
Markets are geographic regions with customized pricing, languages, and domains. Use this to create or edit markets for international selling.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | — |
edit | | | — |
Menu
Menus are navigation structures for the Online Store. Use this to create or edit menu structures and links.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | — |
edit | | | — |
Metafield definition
Metafield definitions are schemas that define custom data fields for resources. Use this to create or edit metafield definitions that merchants can use to add structured data to products, customers, and other resources.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | |
edit | | | |
Metaobject
Metaobjects are custom structured data entries based on metaobject definitions. Use this to create or edit metaobject instances that store complex custom data. Requires a definition type.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | { type: 'shopify--color-pattern' } |
edit | | | { type: 'shopify--color-pattern' } |
Metaobject definition
Metaobject definitions are schemas that define the structure for metaobjects. Use this to create or edit metaobject definitions that determine the fields and data types for custom structured data.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | — |
edit | | — | |
Page
Pages are static content pages for the Online Store. Use this to create or edit pages like About Us, Contact, or custom informational pages.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | — |
edit | | | — |
Product
Products are items sold in the store with pricing, inventory, and variants. Use this to create or edit products.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | — |
edit | | | — |
Product variant
Product variants are specific combinations of product options like size and color. Use this to create or edit product variants. Creating variants requires a parent product ID.
| Action | Type | Value | Data |
|---|---|---|---|
create | | — | |
edit | | | |
Note: When editing products with variants, query the <a href="/docs/api/admin-graphql/latest/objects/Product#field-Product.fields.hasOnlyDefaultVariant"><code><span class="PreventFireFoxApplyingGapToWBR">product.has<wbr/>Only<wbr/>Default<wbr/>Variant</span></code></a> field first. If <code>true</code>, then use the <code><span class="PreventFireFoxApplyingGapToWBR">shopify<wbr/>/Product</span></code> edit intent. If <code>false</code>, then use the <code><span class="PreventFireFoxApplyingGapToWBR">shopify<wbr/>/Product<wbr/>Variant</span></code> edit intent for specific variants.
Settings
Settings are the configuration options for the store. Use this to invoke and edit settings.
| Action | Type | Value | Data |
|---|---|---|---|
edit | | — | — |
edit | | — | — |
edit | | — | — |
edit | | — | — |
edit | | — | — |
edit | | — | — |
edit | | — | — |
edit | | — | — |
edit | | — | — |
IntentQuery
A structured intent specification defining what workflow to launch. Use this format when you prefer object syntax over string query format.
- action
The operation to perform: `'create'` for new resources or `'edit'` for existing ones.
IntentAction - data
Additional context data required by specific intent types. For example, discount creation requires a discount type, variant creation requires a parent product ID, and [metaobject](/docs/apps/build/custom-data/metaobjects) creation requires a definition type.
{ [key: string]: unknown; } - type
The type of resource to create or edit (for example, `'shopify/Product'`).
IntentType - value
The resource identifier for edit operations (for example, `'gid://shopify/Product/123'`). Required when editing existing resources. Omit this for create operations.
string
IntentAction
The type of operation to perform: creating a new resource or editing an existing one.
'create' | 'edit'IntentType
The types of Shopify resources that support intent-based creation and editing workflows.
'shopify/Article' | 'shopify/Catalog' | 'shopify/Collection' | 'shopify/Customer' | 'shopify/Discount' | 'shopify/Location' | 'shopify/Market' | 'shopify/Menu' | 'shopify/MetafieldDefinition' | 'shopify/Metaobject' | 'shopify/MetaobjectDefinition' | 'shopify/Page' | 'shopify/Product' | 'shopify/ProductVariant'IntentActivity
A handle for tracking an in-progress intent workflow.
- complete
A Promise that resolves when the workflow completes. Await this to get the outcome and handle success, failure, or cancellation appropriately.
Promise<IntentResponse>
IntentResponse
The result of an intent workflow. Check the `code` property to determine the outcome: `'ok'` for success, `'error'` for failure, or `'closed'` if the merchant cancelled.
SuccessIntentResponse | ErrorIntentResponse | ClosedIntentResponseSuccessIntentResponse
The response returned when a merchant successfully completes the workflow. Use this to access the created or updated resource data.
- code
Indicates successful completion. When `'ok'`, the merchant completed the workflow and the resource was created or updated.
'ok' - data
Additional data returned by the workflow, such as the created or updated resource information with IDs and properties.
{ [key: string]: unknown; }
ErrorIntentResponse
The response returned when the workflow fails due to validation errors or other issues. Use this to display error messages and help merchants fix problems.
- code
Indicates the workflow failed. When `'error'`, the workflow encountered validation errors or other issues that prevented completion.
'error' - issues
Specific validation issues or field errors. Present when validation fails on particular fields, allowing you to show targeted error messages.
Issue[] - message
A general error message describing what went wrong. Use this to display feedback when specific field errors aren't available.
string
Issue
A structured issue describing a validation or workflow error.
- code
A machine-readable error code for this issue. Use this for programmatic error handling or logging.
string - message
A description of what's wrong with this field. Display this to help merchants understand how to fix the error.
string - path
The path to the field that has an error (for example, `['product', 'title']`). Use this to identify which field caused the validation failure.
string[]
ClosedIntentResponse
The response returned when a merchant closes or cancels the workflow without completing it. Check for this response to handle cancellation gracefully in your extension.
- code
Indicates the workflow was closed without completion. When `'closed'`, the merchant exited the workflow before finishing.
'closed'
IntentQueryOptions
Additional parameters for intent invocation when using the string query format. Use these options to provide resource IDs for editing or pass required context data for resource creation.
- data
Additional context data required by specific intent types. For example, discount creation requires a discount type, variant creation requires a parent product ID, and [metaobject](/docs/apps/build/custom-data/metaobjects) creation requires a definition type.
{ [key: string]: unknown; } - value
The resource identifier for edit operations (for example, `'gid://shopify/Product/123'`). Required when editing existing resources. Omit this for create operations.
string
Anchor to IntentResponseIntent Response
The result returned when an intent workflow completes. Check the code property to determine the outcome:
'ok': The merchant completed the workflow successfully.'error': The workflow failed due to validation or other errors.'closed': The merchant cancelled without completing.
SuccessIntentResponse | ErrorIntentResponse | ClosedIntentResponseSuccessIntentResponse | ErrorIntentResponse | ClosedIntentResponseClosedIntentResponse
- Anchor to codecodecode'closed''closed'
Indicates the workflow was closed without completion. When
'closed', the merchant exited the workflow before finishing.
ErrorIntentResponse
- Anchor to codecodecode'error''error'
Indicates the workflow failed. When
'error', the workflow encountered validation errors or other issues that prevented completion.- Anchor to issuesissuesissuesIssue[]Issue[]
Specific validation issues or field errors. Present when validation fails on particular fields, allowing you to show targeted error messages.
- Anchor to messagemessagemessagestringstring
A general error message describing what went wrong. Use this to display feedback when specific field errors aren't available.
SuccessIntentResponse
- Anchor to codecodecode'ok''ok'
Indicates successful completion. When
'ok', the merchant completed the workflow and the resource was created or updated.- Anchor to datadatadata{ [key: string]: unknown; }{ [key: string]: unknown; }
Additional data returned by the workflow, such as the created or updated resource information with IDs and properties.
Anchor to Best practicesBest practices
- Parse
ErrorIntentResponse.issuesarray for specific feedback: Whencode: 'error', theissuesarray contains structured validation errors with field paths and messages. Use this to show specific error feedback rather than generic error messages. - Distinguish
closedfromerror:code: 'closed'means the merchant cancelled, whilecode: 'error'means validation or save failures. Handle these differently. Closed isn't an error state. - Query
product.hasOnlyDefaultVariantbefore editing: If the value isfalse, then use theshopify/ProductVariantedit intent instead ofshopify/Productto edit specific variants. - Wait for in-flight saves before closing intent screens: When an intent screen contains a form, return a promise from your
submithandler and callevent.waitUntil(promise). Otherwise the screen might be torn down before the save settles. See the Handle async submission example on the Form reference.
Anchor to LimitationsLimitations
- Some resources require
datafor create operations. Discounts need{ type: 'amount-off-product' }, variants need{ productId: 'gid://...' }, and metaobjects need{ type: 'definition-type' }. Missing required data causes the intent to fail. - MetaobjectDefinition edit requires
{ data: { type: 'definition-type' }}instead of passing the GID invalue. It's the only resource with this pattern. - Intent workflows pause your extension until completion. You can't run other operations while an intent is open.
- The workflow UI can't be customized. Field order, labels, and validation messages are controlled by Shopify and can't be modified.
- Your extension only receives the final result. Intermediate workflow state and partial saves aren't communicated back to your extension.