--- title: webhookSubscription - GraphQL Admin description: >- 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). api_version: 2026-01 api_name: admin type: query api_type: graphql source_url: html: >- https://shopify.dev/docs/api/admin-graphql/latest/queries/webhookSubscription md: >- https://shopify.dev/docs/api/admin-graphql/latest/queries/webhookSubscription.md --- # webhook​Subscription query 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). ## Arguments * id *** ## Possible returns * WebhookSubscription *** ## Examples * ### Get a single webhook subscription's ID, topic and URI #### Query ```graphql query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { id topic uri } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") { id topic uri } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { id topic uri } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { id topic uri } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { id topic uri } }`, }); ``` #### Response ```json { "webhookSubscription": { "id": "gid://shopify/WebhookSubscription/892403750", "topic": "ORDERS_CANCELLED", "uri": "https://example.org/fully_loaded_1" } } ``` * ### Get a specific webhook subscription using the node field and a GraphQL fragment #### Query ```graphql query { node(id: "gid://shopify/WebhookSubscription/892403750") { ... on WebhookSubscription { id createdAt updatedAt legacyResourceId topic } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { node(id: \"gid://shopify/WebhookSubscription/892403750\") { ... on WebhookSubscription { id createdAt updatedAt legacyResourceId topic } } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { node(id: "gid://shopify/WebhookSubscription/892403750") { ... on WebhookSubscription { id createdAt updatedAt legacyResourceId topic } } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { node(id: "gid://shopify/WebhookSubscription/892403750") { ... on WebhookSubscription { id createdAt updatedAt legacyResourceId topic } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { node(id: "gid://shopify/WebhookSubscription/892403750") { ... on WebhookSubscription { id createdAt updatedAt legacyResourceId topic } } }`, }); ``` #### Response ```json { "node": { "id": "gid://shopify/WebhookSubscription/892403750", "createdAt": "2021-12-01T10:23:43Z", "updatedAt": "2021-12-01T10:23:43Z", "legacyResourceId": "892403750", "topic": "ORDERS_CANCELLED" } } ``` * ### Get the dates a webhook subscription was created and updated #### Query ```graphql query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { createdAt updatedAt } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") { createdAt updatedAt } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { createdAt updatedAt } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { createdAt updatedAt } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { createdAt updatedAt } }`, }); ``` #### Response ```json { "webhookSubscription": { "createdAt": "2021-12-01T10:23:43Z", "updatedAt": "2021-12-01T10:23:43Z" } } ``` * ### Get the topic of a webhook subscription #### Query ```graphql query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { topic } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { webhookSubscription(id: \"gid://shopify/WebhookSubscription/892403750\") { topic } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { topic } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { topic } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { topic } }`, }); ``` #### Response ```json { "webhookSubscription": { "topic": "ORDERS_CANCELLED" } } ```