# WebhookSubscription - admin-graphql - OBJECT Version: 2025-01 ## Description A webhook subscription is a persisted data object created by an app using the REST Admin API or GraphQL Admin API. It describes the topic that the app wants to receive, and a destination where Shopify should send webhooks of the specified topic. When an event for a given topic occurs, the webhook subscription sends a relevant payload to the destination. Learn more about the [webhooks system](https://shopify.dev/apps/webhooks). ### Access Scopes ## Fields * [apiVersion](/docs/api/admin-graphql/2025-01/objects/ApiVersion): ApiVersion! - The Admin API version that Shopify uses to serialize webhook events. This value is inherited from the app that created the webhook subscription. * [callbackUrl](/docs/api/admin-graphql/2025-01/scalars/URL): URL! - The destination URI to which the webhook subscription will send a message when an event occurs. * [createdAt](/docs/api/admin-graphql/2025-01/scalars/DateTime): DateTime! - The date and time when the webhook subscription was created. * [endpoint](/docs/api/admin-graphql/2025-01/unions/WebhookSubscriptionEndpoint): WebhookSubscriptionEndpoint! - The endpoint to which the webhook subscription will send events. * [filter](/docs/api/admin-graphql/2025-01/scalars/String): String - A constraint specified using search syntax that ensures only webhooks that match the specified filter are emitted. See our [guide on filters](https://shopify.dev/docs/apps/build/webhooks/customize/filters) for more details. * [format](/docs/api/admin-graphql/2025-01/enums/WebhookSubscriptionFormat): WebhookSubscriptionFormat! - The format in which the webhook subscription should send the data. * [id](/docs/api/admin-graphql/2025-01/scalars/ID): ID! - A globally-unique ID. * [includeFields](/docs/api/admin-graphql/2025-01/scalars/String): String! - An optional array of top-level resource fields that should be serialized and sent in the webhook message. If null, then all fields will be sent. * [legacyResourceId](/docs/api/admin-graphql/2025-01/scalars/UnsignedInt64): UnsignedInt64! - The ID of the corresponding resource in the REST Admin API. * [metafieldNamespaces](/docs/api/admin-graphql/2025-01/scalars/String): String! - The list of namespaces for any metafields that should be included in the webhook subscription. * [topic](/docs/api/admin-graphql/2025-01/enums/WebhookSubscriptionTopic): WebhookSubscriptionTopic! - The type of event that triggers the webhook. The topic determines when the webhook subscription sends a webhook, as well as what class of data object that webhook contains. * [updatedAt](/docs/api/admin-graphql/2025-01/scalars/DateTime): DateTime! - The date and time when the webhook subscription was updated. ## Connections ## Related queries * [webhookSubscription](/docs/api/admin-graphql/2025-01/queries/webhookSubscription) Returns a webhook subscription by ID. Building an app? If you only use app-specific webhooks, you won't need this. App-specific webhook subscriptions specified in your `shopify.app.toml` may be easier. They are automatically kept up to date by Shopify & require less maintenance. Please read [About managing webhook subscriptions](https://shopify.dev/docs/apps/build/webhooks/subscribe). * [webhookSubscriptions](/docs/api/admin-graphql/2025-01/queries/webhookSubscriptions) Returns a list of webhook subscriptions. Building an app? If you only use app-specific webhooks, you won't need this. App-specific webhook subscriptions specified in your `shopify.app.toml` may be easier. They are automatically kept up to date by Shopify & require less maintenance. Please read [About managing webhook subscriptions](https://shopify.dev/docs/apps/build/webhooks/subscribe). ## Related mutations * [eventBridgeWebhookSubscriptionCreate](/docs/api/admin-graphql/2025-01/mutations/eventBridgeWebhookSubscriptionCreate) Creates a new Amazon EventBridge webhook subscription. Building an app? If you only use app-specific webhooks, you won't need this. App-specific webhook subscriptions specified in your `shopify.app.toml` may be easier. They are automatically kept up to date by Shopify & require less maintenance. Please read [About managing webhook subscriptions](https://shopify.dev/docs/apps/build/webhooks/subscribe). * [eventBridgeWebhookSubscriptionUpdate](/docs/api/admin-graphql/2025-01/mutations/eventBridgeWebhookSubscriptionUpdate) Updates an Amazon EventBridge webhook subscription. Building an app? If you only use app-specific webhooks, you won't need this. App-specific webhook subscriptions specified in your `shopify.app.toml` may be easier. They are automatically kept up to date by Shopify & require less maintenance. Please read [About managing webhook subscriptions](https://shopify.dev/docs/apps/build/webhooks/subscribe). * [pubSubWebhookSubscriptionCreate](/docs/api/admin-graphql/2025-01/mutations/pubSubWebhookSubscriptionCreate) Creates a new Google Cloud Pub/Sub webhook subscription. Building an app? If you only use app-specific webhooks, you won't need this. App-specific webhook subscriptions specified in your `shopify.app.toml` may be easier. They are automatically kept up to date by Shopify & require less maintenance. Please read [About managing webhook subscriptions](https://shopify.dev/docs/apps/build/webhooks/subscribe). * [pubSubWebhookSubscriptionUpdate](/docs/api/admin-graphql/2025-01/mutations/pubSubWebhookSubscriptionUpdate) Updates a Google Cloud Pub/Sub webhook subscription. Building an app? If you only use app-specific webhooks, you won't need this. App-specific webhook subscriptions specified in your `shopify.app.toml` may be easier. They are automatically kept up to date by Shopify & require less maintenance. Please read [About managing webhook subscriptions](https://shopify.dev/docs/apps/build/webhooks/subscribe). * [webhookSubscriptionCreate](/docs/api/admin-graphql/2025-01/mutations/webhookSubscriptionCreate) Creates a new webhook subscription. Building an app? If you only use app-specific webhooks, you won't need this. App-specific webhook subscriptions specified in your `shopify.app.toml` may be easier. They are automatically kept up to date by Shopify & require less maintenance. Please read [About managing webhook subscriptions](https://shopify.dev/docs/apps/build/webhooks/subscribe). * [webhookSubscriptionUpdate](/docs/api/admin-graphql/2025-01/mutations/webhookSubscriptionUpdate) Updates a webhook subscription. Building an app? If you only use app-specific webhooks, you won't need this. App-specific webhook subscriptions specified in your `shopify.app.toml` may be easier. They are automatically kept up to date by Shopify & require less maintenance. Please read [About managing webhook subscriptions](https://shopify.dev/docs/apps/build/webhooks/subscribe). ## Related Unions ## Examples ### Get a single webhook subscription's ID, topic, and endpoint Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { webhookSubscription(id: \\\"gid://shopify/WebhookSubscription/892403750\\\") { id topic endpoint { __typename ... on WebhookHttpEndpoint { callbackUrl } ... on WebhookEventBridgeEndpoint { arn } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n id\n topic\n endpoint {\n __typename\n ... on WebhookHttpEndpoint {\n callbackUrl\n }\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n id\n topic\n endpoint {\n __typename\n ... on WebhookHttpEndpoint {\n callbackUrl\n }\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n id\n topic\n endpoint {\n __typename\n ... on WebhookHttpEndpoint {\n callbackUrl\n }\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n id\n topic\n endpoint {\n __typename\n ... on WebhookHttpEndpoint {\n callbackUrl\n }\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "webhookSubscription": { "id": "gid://shopify/WebhookSubscription/892403750", "topic": "ORDERS_CANCELLED", "endpoint": { "__typename": "WebhookHttpEndpoint", "callbackUrl": "https://example.org/fully_loaded_1" } } } } ### Get a specific webhook subscription using the `node` field and a GraphQL fragment Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { node(id: \\\"gid://shopify/WebhookSubscription/892403750\\\") { ... on WebhookSubscription { id createdAt updatedAt legacyResourceId topic format } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n node(id: \"gid://shopify/WebhookSubscription/892403750\") {\n ... on WebhookSubscription {\n id\n createdAt\n updatedAt\n legacyResourceId\n topic\n format\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n node(id: \"gid://shopify/WebhookSubscription/892403750\") {\n ... on WebhookSubscription {\n id\n createdAt\n updatedAt\n legacyResourceId\n topic\n format\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n node(id: \"gid://shopify/WebhookSubscription/892403750\") {\n ... on WebhookSubscription {\n id\n createdAt\n updatedAt\n legacyResourceId\n topic\n format\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n node(id: \"gid://shopify/WebhookSubscription/892403750\") {\n ... on WebhookSubscription {\n id\n createdAt\n updatedAt\n legacyResourceId\n topic\n format\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "node": { "id": "gid://shopify/WebhookSubscription/892403750", "createdAt": "2021-12-01T10:23:43Z", "updatedAt": "2021-12-01T10:23:43Z", "legacyResourceId": "892403750", "topic": "ORDERS_CANCELLED", "format": "JSON" } } } ### Get the dates a webhook subscription was created and updated Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { webhookSubscription(id: \\\"gid://shopify/WebhookSubscription/892403750\\\") { createdAt updatedAt } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n createdAt\n updatedAt\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n createdAt\n updatedAt\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n createdAt\n updatedAt\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n createdAt\n updatedAt\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "webhookSubscription": { "createdAt": "2021-12-01T10:23:43Z", "updatedAt": "2021-12-01T10:23:43Z" } } } ### Get the format in which the webhook subscription serializes the payload Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { webhookSubscription(id: \\\"gid://shopify/WebhookSubscription/892403750\\\") { format } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n format\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n format\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n format\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n format\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "webhookSubscription": { "format": "JSON" } } } ### Get the topic of a webhook subscription Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { webhookSubscription(id: \\\"gid://shopify/WebhookSubscription/892403750\\\") { topic } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n topic\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n topic\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n topic\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") {\n topic\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "webhookSubscription": { "topic": "ORDERS_CANCELLED" } } } ### Receive a single Webhook Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query WebhookSubscription($id: ID!) { webhookSubscription(id: $id) { id topic endpoint { __typename ... on WebhookHttpEndpoint { callbackUrl } ... on WebhookEventBridgeEndpoint { arn } ... on WebhookPubSubEndpoint { pubSubProject pubSubTopic } } apiVersion { handle } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/WebhookSubscription/892403750\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query WebhookSubscription($id: ID!) {\n webhookSubscription(id: $id) {\n id\n topic\n endpoint {\n __typename\n ... on WebhookHttpEndpoint {\n callbackUrl\n }\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n ... on WebhookPubSubEndpoint {\n pubSubProject\n pubSubTopic\n }\n }\n apiVersion {\n handle\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/WebhookSubscription/892403750\"\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query WebhookSubscription($id: ID!) {\n webhookSubscription(id: $id) {\n id\n topic\n endpoint {\n __typename\n ... on WebhookHttpEndpoint {\n callbackUrl\n }\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n ... on WebhookPubSubEndpoint {\n pubSubProject\n pubSubTopic\n }\n }\n apiVersion {\n handle\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/WebhookSubscription/892403750\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query WebhookSubscription($id: ID!) {\n webhookSubscription(id: $id) {\n id\n topic\n endpoint {\n __typename\n ... on WebhookHttpEndpoint {\n callbackUrl\n }\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n ... on WebhookPubSubEndpoint {\n pubSubProject\n pubSubTopic\n }\n }\n apiVersion {\n handle\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/WebhookSubscription/892403750\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query WebhookSubscription($id: ID!) {\n webhookSubscription(id: $id) {\n id\n topic\n endpoint {\n __typename\n ... on WebhookHttpEndpoint {\n callbackUrl\n }\n ... on WebhookEventBridgeEndpoint {\n arn\n }\n ... on WebhookPubSubEndpoint {\n pubSubProject\n pubSubTopic\n }\n }\n apiVersion {\n handle\n }\n }\n}" #### Graphql Input { "id": "gid://shopify/WebhookSubscription/892403750" } #### Graphql Response { "data": { "webhookSubscription": { "id": "gid://shopify/WebhookSubscription/892403750", "topic": "ORDERS_CANCELLED", "endpoint": { "__typename": "WebhookHttpEndpoint", "callbackUrl": "https://example.org/fully_loaded_1" }, "apiVersion": { "handle": "unstable" } } } }