# webhookSubscriptions - admin-graphql - QUERY
Version: 2024-10
## Description
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).
### Access Scopes
## Arguments
* [after](/docs/api/admin-graphql/2024-10/scalars/String): String - The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).
* [before](/docs/api/admin-graphql/2024-10/scalars/String): String - The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).
* [callbackUrl](/docs/api/admin-graphql/2024-10/scalars/URL): URL - Callback URL to filter by.
* [first](/docs/api/admin-graphql/2024-10/scalars/Int): Int - The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).
* [format](/docs/api/admin-graphql/2024-10/enums/WebhookSubscriptionFormat): WebhookSubscriptionFormat - Response format to filter by.
* [last](/docs/api/admin-graphql/2024-10/scalars/Int): Int - The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).
* [query](/docs/api/admin-graphql/2024-10/scalars/String): String - A filter made up of terms, connectives, modifiers, and comparators.
| name | type | description | acceptable_values | default_value | example_use |
| ---- | ---- | ---- | ---- | ---- | ---- |
| created_at | time |
| id | id | Filter by `id` range. | | | - `id:1234`
- `id:>=1234`
- `id:<=1234` |
| updated_at | time |
You can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax).
* [reverse](/docs/api/admin-graphql/2024-10/scalars/Boolean): Boolean - Reverse the order of the underlying list.
* [sortKey](/docs/api/admin-graphql/2024-10/enums/WebhookSubscriptionSortKeys): WebhookSubscriptionSortKeys - Sort the underlying list using a key. If your query is slow or returns an error, then [try specifying a sort key that matches the field used in the search](https://shopify.dev/api/usage/pagination-graphql#search-performance-considerations).
* [topics](/docs/api/admin-graphql/2024-10/enums/WebhookSubscriptionTopic): WebhookSubscriptionTopic - List of webhook subscription topics to filter by.
## Returns
* [edges](/docs/api/admin-graphql/2024-10/objects/WebhookSubscriptionEdge): WebhookSubscriptionEdge! The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node.
* [nodes](/docs/api/admin-graphql/2024-10/objects/WebhookSubscription): WebhookSubscription! A list of nodes that are contained in WebhookSubscriptionEdge. You can fetch data about an individual node, or you can follow the edges to fetch data about a collection of related nodes. At each node, you specify the fields that you want to retrieve.
* [pageInfo](/docs/api/admin-graphql/2024-10/objects/PageInfo): PageInfo! An object that’s used to retrieve [cursor information](https://shopify.dev/api/usage/pagination-graphql) about the current page.
## Examples
### Get the IDs, topics, and endpoints of the first 2 webhook subscriptions
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { webhookSubscriptions(first: 2) { edges { node { id topic endpoint { __typename ... on WebhookHttpEndpoint { callbackUrl } ... on WebhookEventBridgeEndpoint { arn } ... on WebhookPubSubEndpoint { pubSubProject pubSubTopic } } } } } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n webhookSubscriptions(first: 2) {\n edges {\n node {\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 }\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 webhookSubscriptions(first: 2) {\n edges {\n node {\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 }\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 webhookSubscriptions(first: 2) {\n edges {\n node {\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 }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n webhookSubscriptions(first: 2) {\n edges {\n node {\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 }\n }\n }\n}"
#### Graphql Input
null
#### Graphql Response
{
"data": {
"webhookSubscriptions": {
"edges": [
{
"node": {
"id": "gid://shopify/WebhookSubscription/892403750",
"topic": "ORDERS_CANCELLED",
"endpoint": {
"__typename": "WebhookHttpEndpoint",
"callbackUrl": "https://example.org/fully_loaded_1"
}
}
},
{
"node": {
"id": "gid://shopify/WebhookSubscription/901431826",
"topic": "APP_UNINSTALLED",
"endpoint": {
"__typename": "WebhookHttpEndpoint",
"callbackUrl": "https://apple.com/uninstall"
}
}
}
]
}
}
}
### Get the first two webhook subscriptions with an APP_UNINSTALLED topic
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { webhookSubscriptions(first: 2, topics: APP_UNINSTALLED) { edges { node { 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 webhookSubscriptions(first: 2, topics: APP_UNINSTALLED) {\n edges {\n node {\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 }`,\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 webhookSubscriptions(first: 2, topics: APP_UNINSTALLED) {\n edges {\n node {\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 }\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 webhookSubscriptions(first: 2, topics: APP_UNINSTALLED) {\n edges {\n node {\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 }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n webhookSubscriptions(first: 2, topics: APP_UNINSTALLED) {\n edges {\n node {\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}"
#### Graphql Input
null
#### Graphql Response
{
"data": {
"webhookSubscriptions": {
"edges": [
{
"node": {
"id": "gid://shopify/WebhookSubscription/901431826",
"topic": "APP_UNINSTALLED",
"endpoint": {
"__typename": "WebhookHttpEndpoint",
"callbackUrl": "https://apple.com/uninstall"
}
}
},
{
"node": {
"id": "gid://shopify/WebhookSubscription/1014196360",
"topic": "APP_UNINSTALLED",
"endpoint": {
"__typename": "WebhookHttpEndpoint",
"callbackUrl": "https://example.org/app_uninstalled"
}
}
}
]
}
}
}
### Retrieves a list of webhooks
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query WebhookSubscriptionList { webhookSubscriptions(first: 3) { edges { node { id topic endpoint { __typename ... on WebhookHttpEndpoint { callbackUrl } ... on WebhookEventBridgeEndpoint { arn } ... on WebhookPubSubEndpoint { pubSubProject pubSubTopic } } createdAt updatedAt apiVersion { handle } format includeFields metafieldNamespaces privateMetafieldNamespaces } } } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query WebhookSubscriptionList {\n webhookSubscriptions(first: 3) {\n edges {\n node {\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 createdAt\n updatedAt\n apiVersion {\n handle\n }\n format\n includeFields\n metafieldNamespaces\n privateMetafieldNamespaces\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 WebhookSubscriptionList {\n webhookSubscriptions(first: 3) {\n edges {\n node {\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 createdAt\n updatedAt\n apiVersion {\n handle\n }\n format\n includeFields\n metafieldNamespaces\n privateMetafieldNamespaces\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 WebhookSubscriptionList {\n webhookSubscriptions(first: 3) {\n edges {\n node {\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 createdAt\n updatedAt\n apiVersion {\n handle\n }\n format\n includeFields\n metafieldNamespaces\n privateMetafieldNamespaces\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query WebhookSubscriptionList {\n webhookSubscriptions(first: 3) {\n edges {\n node {\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 createdAt\n updatedAt\n apiVersion {\n handle\n }\n format\n includeFields\n metafieldNamespaces\n privateMetafieldNamespaces\n }\n }\n }\n}"
#### Graphql Input
null
#### Graphql Response
{
"data": {
"webhookSubscriptions": {
"edges": [
{
"node": {
"id": "gid://shopify/WebhookSubscription/892403750",
"topic": "ORDERS_CANCELLED",
"endpoint": {
"__typename": "WebhookHttpEndpoint",
"callbackUrl": "https://example.org/fully_loaded_1"
},
"createdAt": "2021-12-01T10:23:43Z",
"updatedAt": "2021-12-01T10:23:43Z",
"apiVersion": {
"handle": "unstable"
},
"format": "JSON",
"includeFields": [],
"metafieldNamespaces": [],
"privateMetafieldNamespaces": []
}
},
{
"node": {
"id": "gid://shopify/WebhookSubscription/901431826",
"topic": "APP_UNINSTALLED",
"endpoint": {
"__typename": "WebhookHttpEndpoint",
"callbackUrl": "https://apple.com/uninstall"
},
"createdAt": "2024-11-04T18:56:43Z",
"updatedAt": "2024-11-04T18:56:43Z",
"apiVersion": {
"handle": "unstable"
},
"format": "JSON",
"includeFields": [],
"metafieldNamespaces": [],
"privateMetafieldNamespaces": []
}
},
{
"node": {
"id": "gid://shopify/WebhookSubscription/1014196360",
"topic": "APP_UNINSTALLED",
"endpoint": {
"__typename": "WebhookHttpEndpoint",
"callbackUrl": "https://example.org/app_uninstalled"
},
"createdAt": "2024-11-04T18:56:43Z",
"updatedAt": "2024-11-04T18:56:43Z",
"apiVersion": {
"handle": "unstable"
},
"format": "JSON",
"includeFields": [],
"metafieldNamespaces": [],
"privateMetafieldNamespaces": []
}
}
]
}
}
}