# appInstallation - admin-graphql - QUERY Version: 2025-01 ## Description Lookup an AppInstallation by ID or return the AppInstallation for the currently authenticated App. ### Access Scopes ## Arguments * [id](/docs/api/admin-graphql/2025-01/scalars/ID): ID - ID used to lookup AppInstallation. ## Returns * [accessScopes](/docs/api/admin-graphql/2025-01/objects/AccessScope): AccessScope! The access scopes granted to the application by a merchant during installation. * [activeSubscriptions](/docs/api/admin-graphql/2025-01/objects/AppSubscription): AppSubscription! The active application subscriptions billed to the shop on a recurring basis. * [app](/docs/api/admin-graphql/2025-01/objects/App): App! Application which is installed. * [channel](/docs/api/admin-graphql/2025-01/objects/Channel): Channel Channel associated with the installed application. * [id](/docs/api/admin-graphql/2025-01/scalars/ID): ID! A globally-unique ID. * [launchUrl](/docs/api/admin-graphql/2025-01/scalars/URL): URL! The URL to launch the application. * [metafield](/docs/api/admin-graphql/2025-01/objects/Metafield): Metafield A [custom field](https://shopify.dev/docs/apps/build/custom-data), including its `namespace` and `key`, that's associated with a Shopify resource for the purposes of adding and storing additional information. * [publication](/docs/api/admin-graphql/2025-01/objects/Publication): Publication The publication associated with the installed application. * [subscriptions](/docs/api/admin-graphql/2025-01/objects/AppSubscription): AppSubscription! Subscriptions charge to a shop on a recurring basis. * [uninstallUrl](/docs/api/admin-graphql/2025-01/scalars/URL): URL The URL to uninstall the application. ## Examples ### Get a metafield attached to an app installation 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 AppInstallationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { appInstallation(id: $ownerId) { apiKey: metafield(namespace: $namespace, key: $key) { value } } }\",\n \"variables\": {\n \"namespace\": \"secret_keys\",\n \"key\": \"api_key\",\n \"ownerId\": \"gid://shopify/AppInstallation/1002334195\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query AppInstallationMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n appInstallation(id: $ownerId) {\n apiKey: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n \"variables\": {\n \"namespace\": \"secret_keys\",\n \"key\": \"api_key\",\n \"ownerId\": \"gid://shopify/AppInstallation/1002334195\"\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 AppInstallationMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n appInstallation(id: $ownerId) {\n apiKey: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }\nQUERY\n\nvariables = {\n \"namespace\": \"secret_keys\",\n \"key\": \"api_key\",\n \"ownerId\": \"gid://shopify/AppInstallation/1002334195\"\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 AppInstallationMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n appInstallation(id: $ownerId) {\n apiKey: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n {\n variables: {\n \"namespace\": \"secret_keys\",\n \"key\": \"api_key\",\n \"ownerId\": \"gid://shopify/AppInstallation/1002334195\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query AppInstallationMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n appInstallation(id: $ownerId) {\n apiKey: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n}" #### Graphql Input { "namespace": "secret_keys", "key": "api_key", "ownerId": "gid://shopify/AppInstallation/1002334195" } #### Graphql Response { "data": { "appInstallation": { "apiKey": { "value": "aSBhbSBhIHNlY3JldCBrZXk=" } } } } ### Get metafields attached to an app installation 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 AppInstallationMetafields($ownerId: ID!) { appInstallation(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }\",\n \"variables\": {\n \"ownerId\": \"gid://shopify/AppInstallation/1002334195\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query AppInstallationMetafields($ownerId: ID!) {\n appInstallation(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"ownerId\": \"gid://shopify/AppInstallation/1002334195\"\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 AppInstallationMetafields($ownerId: ID!) {\n appInstallation(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"ownerId\": \"gid://shopify/AppInstallation/1002334195\"\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 AppInstallationMetafields($ownerId: ID!) {\n appInstallation(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"ownerId\": \"gid://shopify/AppInstallation/1002334195\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query AppInstallationMetafields($ownerId: ID!) {\n appInstallation(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n}" #### Graphql Input { "ownerId": "gid://shopify/AppInstallation/1002334195" } #### Graphql Response { "data": { "appInstallation": { "metafields": { "edges": [ { "node": { "namespace": "secret_keys", "key": "api_key", "value": "aSBhbSBhIHNlY3JldCBrZXk=" } } ] } } } } ### Get the URL used to launch the application 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 { appInstallation(id: \\\"gid://shopify/AppInstallation/1002334195\\\") { launchUrl } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") {\n launchUrl\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 appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") {\n launchUrl\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 appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") {\n launchUrl\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") {\n launchUrl\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "appInstallation": { "launchUrl": "https://snowdevil.myshopify.com/admin/api_permissions/1002334195/redirect" } } } ### Get the URL used to uninstall the application 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 { appInstallation(id: \\\"gid://shopify/AppInstallation/688276949\\\") { uninstallUrl } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n appInstallation(id: \"gid://shopify/AppInstallation/688276949\") {\n uninstallUrl\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 appInstallation(id: \"gid://shopify/AppInstallation/688276949\") {\n uninstallUrl\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 appInstallation(id: \"gid://shopify/AppInstallation/688276949\") {\n uninstallUrl\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n appInstallation(id: \"gid://shopify/AppInstallation/688276949\") {\n uninstallUrl\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "appInstallation": { "uninstallUrl": null } } } ### Get the access scopes associated with the app installation 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 { appInstallation(id: \\\"gid://shopify/AppInstallation/1002334195\\\") { accessScopes { handle description } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") {\n accessScopes {\n handle\n description\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 appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") {\n accessScopes {\n handle\n description\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 appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") {\n accessScopes {\n handle\n description\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") {\n accessScopes {\n handle\n description\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "appInstallation": { "accessScopes": [ { "handle": "write_content", "description": "Modify store content like articles, blogs, comments, pages, and redirects" }, { "handle": "write_themes", "description": "Modify theme templates and theme assets" }, { "handle": "write_products", "description": "Modify products, variants, and collections" }, { "handle": "write_customers", "description": "Modify customer details and customer groups" }, { "handle": "write_orders", "description": "Modify orders, transactions, and fulfillments" }, { "handle": "write_script_tags", "description": "Modify script tags in your store's theme template files" }, { "handle": "write_shipping", "description": "Modify shipping rates, countries, and provinces" }, { "handle": "read_content", "description": "Read store content like articles, blogs, comments, pages, and redirects" }, { "handle": "read_themes", "description": "Read theme templates and theme assets" }, { "handle": "read_products", "description": "Read products, variants, and collections" }, { "handle": "read_customers", "description": "Read customer details and customer groups" }, { "handle": "read_orders", "description": "Read orders, transactions, and fulfillments" }, { "handle": "read_script_tags", "description": "Read script tags in your store's theme template files" }, { "handle": "read_shipping", "description": "Read shipping rates, countries, and provinces" } ] } } } ### Get the active subscriptions for the app installation 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 { appInstallation(id: \\\"gid://shopify/AppInstallation/881878037\\\") { activeSubscriptions { id } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n appInstallation(id: \"gid://shopify/AppInstallation/881878037\") {\n activeSubscriptions {\n id\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 appInstallation(id: \"gid://shopify/AppInstallation/881878037\") {\n activeSubscriptions {\n id\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 appInstallation(id: \"gid://shopify/AppInstallation/881878037\") {\n activeSubscriptions {\n id\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n appInstallation(id: \"gid://shopify/AppInstallation/881878037\") {\n activeSubscriptions {\n id\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "appInstallation": { "activeSubscriptions": [ { "id": "gid://shopify/AppSubscription/1029266946" } ] } } } ### Get the app associated with the installation 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 { appInstallation(id: \\\"gid://shopify/AppInstallation/1002334195\\\") { app { id } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") {\n app {\n id\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 appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") {\n app {\n id\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 appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") {\n app {\n id\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") {\n app {\n id\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "appInstallation": { "app": { "id": "gid://shopify/App/1002334195" } } } } ### Retrieves all application credits 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 GetAppInstallationCredits($appInstallationId: ID!) { appInstallation(id: $appInstallationId) { credits(first: 10) { edges { node { amount { amount currencyCode } createdAt description id } } } } }\",\n \"variables\": {\n \"appInstallationId\": \"gid://shopify/AppInstallation/236444539\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query GetAppInstallationCredits($appInstallationId: ID!) {\n appInstallation(id: $appInstallationId) {\n credits(first: 10) {\n edges {\n node {\n amount {\n amount\n currencyCode\n }\n createdAt\n description\n id\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"appInstallationId\": \"gid://shopify/AppInstallation/236444539\"\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 GetAppInstallationCredits($appInstallationId: ID!) {\n appInstallation(id: $appInstallationId) {\n credits(first: 10) {\n edges {\n node {\n amount {\n amount\n currencyCode\n }\n createdAt\n description\n id\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"appInstallationId\": \"gid://shopify/AppInstallation/236444539\"\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 GetAppInstallationCredits($appInstallationId: ID!) {\n appInstallation(id: $appInstallationId) {\n credits(first: 10) {\n edges {\n node {\n amount {\n amount\n currencyCode\n }\n createdAt\n description\n id\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"appInstallationId\": \"gid://shopify/AppInstallation/236444539\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query GetAppInstallationCredits($appInstallationId: ID!) {\n appInstallation(id: $appInstallationId) {\n credits(first: 10) {\n edges {\n node {\n amount {\n amount\n currencyCode\n }\n createdAt\n description\n id\n }\n }\n }\n }\n}" #### Graphql Input { "appInstallationId": "gid://shopify/AppInstallation/236444539" } #### Graphql Response { "data": { "appInstallation": { "credits": { "edges": [] } } } }