--- 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: 2025-10 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 [ID!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID) required The ID of the `WebhookSubscription` to return. *** ## Possible returns * Webhook​Subscription [Webhook​Subscription](https://shopify.dev/docs/api/admin-graphql/latest/objects/WebhookSubscription) 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). *** ## 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/2025-10/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/2025-10/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/2025-10/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/2025-10/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" } } ``` [Open in GraphiQL](http://localhost:3457/graphiql?query=query%20%7B%0A%20%20webhookSubscription\(id%3A%20%22gid%3A%2F%2Fshopify%2FWebhookSubscription%2F892403750%22\)%20%7B%0A%20%20%20%20id%0A%20%20%20%20topic%0A%20%20%20%20uri%0A%20%20%7D%0A%7D) ```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; } ``` ##### GQL ``` query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { id topic uri } } ``` ##### cURL ``` curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/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 ``` 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; } ``` ##### Node.js ``` const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { webhookSubscription(id: "gid://shopify/WebhookSubscription/892403750") { id topic uri } }`, }); ``` ##### 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) ``` ## Response JSON ```json { "webhookSubscription": { "id": "gid://shopify/WebhookSubscription/892403750", "topic": "ORDERS_CANCELLED", "uri": "https://example.org/fully_loaded_1" } } ```