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.
Anchor to Use casesUse cases
- Extension communication: Enable communication between extensions through intents.
- Navigation triggers: Handle navigation requests from other extensions.
- Workflow coordination: Coordinate workflows across multiple extensions.
- Deep linking: Support deep linking and cross-extension navigation.
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 | | | — |
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 | | | — |
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.
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 issuesissuesissues{ path?: string[]; message?: string; code?: string; }[]{ path?: string[]; message?: string; code?: string; }[]
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.
SuccessIntentResponse
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.
{ path?: string[]; message?: string; code?: string; }[] - message
A general error message describing what went wrong. Use this to display feedback when specific field errors aren't available.
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'
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, use theshopify/ProductVariantedit intent instead ofshopify/Productto edit specific variants.
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.