--- title: appInstallation - GraphQL Admin description: |- Look up an app installation by ID or return the app installation for the currently authenticated app. Use the `appInstallation` query to: - Fetch current access scope permissions for your app - Retrieve active subscription details and billing status - Validate installation state during app initialization - Display installation-specific information in your app interface Learn more about [app installation](https://shopify.dev/docs/apps/build/authentication-authorization/app-installation). api_version: 2025-10 api_name: admin type: query api_type: graphql source_url: html: https://shopify.dev/docs/api/admin-graphql/latest/queries/appInstallation?example=Get+the+access+scopes+associated+with+the+app+installation md: https://shopify.dev/docs/api/admin-graphql/latest/queries/appInstallation.md?example=Get+the+access+scopes+associated+with+the+app+installation --- # app​Installation query Look up an app installation by ID or return the app installation for the currently authenticated app. Use the `appInstallation` query to: * Fetch current access scope permissions for your app * Retrieve active subscription details and billing status * Validate installation state during app initialization * Display installation-specific information in your app interface Learn more about [app installation](https://shopify.dev/docs/apps/build/authentication-authorization/app-installation). ## Arguments * id [ID](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID) ID used to lookup AppInstallation. *** ## Possible returns * App​Installation [App​Installation](https://shopify.dev/docs/api/admin-graphql/latest/objects/AppInstallation) Represents an installed application on a shop. *** ## Examples * ### Get a metafield attached to an app installation #### Description Get the metafield value identified by \`secret\_keys.api\_key\` on a specific app installation. #### Query ```graphql query AppInstallationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { appInstallation(id: $ownerId) { apiKey: metafield(namespace: $namespace, key: $key) { value } } } ``` #### Variables ```json { "namespace": "secret_keys", "key": "api_key", "ownerId": "gid://shopify/AppInstallation/1002334195" } ``` #### 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 AppInstallationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { appInstallation(id: $ownerId) { apiKey: metafield(namespace: $namespace, key: $key) { value } } }", "variables": { "namespace": "secret_keys", "key": "api_key", "ownerId": "gid://shopify/AppInstallation/1002334195" } }' ``` #### 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 AppInstallationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { appInstallation(id: $ownerId) { apiKey: metafield(namespace: $namespace, key: $key) { value } } }`, { variables: { "namespace": "secret_keys", "key": "api_key", "ownerId": "gid://shopify/AppInstallation/1002334195" }, }, ); 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 AppInstallationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { appInstallation(id: $ownerId) { apiKey: metafield(namespace: $namespace, key: $key) { value } } } QUERY variables = { "namespace": "secret_keys", "key": "api_key", "ownerId": "gid://shopify/AppInstallation/1002334195" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query AppInstallationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { appInstallation(id: $ownerId) { apiKey: metafield(namespace: $namespace, key: $key) { value } } }`, "variables": { "namespace": "secret_keys", "key": "api_key", "ownerId": "gid://shopify/AppInstallation/1002334195" }, }, }); ``` #### Response ```json { "appInstallation": { "apiKey": { "value": "aSBhbSBhIHNlY3JldCBrZXk=" } } } ``` * ### Get metafields attached to an app installation #### Description Get a page of metafields attached to a specific app installation. #### Query ```graphql query AppInstallationMetafields($ownerId: ID!) { appInstallation(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } } ``` #### Variables ```json { "ownerId": "gid://shopify/AppInstallation/1002334195" } ``` #### 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 AppInstallationMetafields($ownerId: ID!) { appInstallation(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }", "variables": { "ownerId": "gid://shopify/AppInstallation/1002334195" } }' ``` #### 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 AppInstallationMetafields($ownerId: ID!) { appInstallation(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }`, { variables: { "ownerId": "gid://shopify/AppInstallation/1002334195" }, }, ); 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 AppInstallationMetafields($ownerId: ID!) { appInstallation(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } } QUERY variables = { "ownerId": "gid://shopify/AppInstallation/1002334195" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query AppInstallationMetafields($ownerId: ID!) { appInstallation(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }`, "variables": { "ownerId": "gid://shopify/AppInstallation/1002334195" }, }, }); ``` #### Response ```json { "appInstallation": { "metafields": { "edges": [ { "node": { "namespace": "secret_keys", "key": "api_key", "value": "aSBhbSBhIHNlY3JldCBrZXk=" } } ] } } } ``` * ### Get the URL used to launch the application #### Description The following query retrieves the launchUrl associated with the appInstallation. #### Query ```graphql query { appInstallation(id: "gid://shopify/AppInstallation/1002334195") { launchUrl } } ``` #### 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 { appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") { launchUrl } }" }' ``` #### 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 { appInstallation(id: "gid://shopify/AppInstallation/1002334195") { launchUrl } }`, ); 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 { appInstallation(id: "gid://shopify/AppInstallation/1002334195") { launchUrl } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { appInstallation(id: "gid://shopify/AppInstallation/1002334195") { launchUrl } }`, }); ``` #### Response ```json { "appInstallation": { "launchUrl": "https://snowdevil.myshopify.com/admin/api_permissions/1002334195/redirect" } } ``` * ### Get the URL used to uninstall the application #### Description The following query retrieves the uninstallUrl associated with the appInstallation. #### Query ```graphql query { appInstallation(id: "gid://shopify/AppInstallation/688276949") { uninstallUrl } } ``` #### 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 { appInstallation(id: \"gid://shopify/AppInstallation/688276949\") { uninstallUrl } }" }' ``` #### 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 { appInstallation(id: "gid://shopify/AppInstallation/688276949") { uninstallUrl } }`, ); 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 { appInstallation(id: "gid://shopify/AppInstallation/688276949") { uninstallUrl } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { appInstallation(id: "gid://shopify/AppInstallation/688276949") { uninstallUrl } }`, }); ``` #### Response ```json { "appInstallation": { "uninstallUrl": null } } ``` * ### Get the access scopes associated with the app installation #### Description The following query returns all the access scopes that were granted to the application during installation. #### Query ```graphql query { appInstallation(id: "gid://shopify/AppInstallation/1002334195") { accessScopes { handle description } } } ``` #### 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 { appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") { accessScopes { handle description } } }" }' ``` #### 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 { appInstallation(id: "gid://shopify/AppInstallation/1002334195") { accessScopes { handle description } } }`, ); 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 { appInstallation(id: "gid://shopify/AppInstallation/1002334195") { accessScopes { handle description } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { appInstallation(id: "gid://shopify/AppInstallation/1002334195") { accessScopes { handle description } } }`, }); ``` #### Response ```json { "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 #### Description The following query returns the IDs of the active subscriptions billed by the application. Returns an "access denied" error if the user is not allowed to approve application charges. #### Query ```graphql query { appInstallation(id: "gid://shopify/AppInstallation/881878037") { activeSubscriptions { id } } } ``` #### 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 { appInstallation(id: \"gid://shopify/AppInstallation/881878037\") { activeSubscriptions { id } } }" }' ``` #### 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 { appInstallation(id: "gid://shopify/AppInstallation/881878037") { activeSubscriptions { id } } }`, ); 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 { appInstallation(id: "gid://shopify/AppInstallation/881878037") { activeSubscriptions { id } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { appInstallation(id: "gid://shopify/AppInstallation/881878037") { activeSubscriptions { id } } }`, }); ``` #### Response ```json { "appInstallation": { "activeSubscriptions": [ { "id": "gid://shopify/AppSubscription/1029266946" } ] } } ``` * ### Get the app associated with the installation #### Description The following query retrieves the application associated with the installation, returning the associated ID. #### Query ```graphql query { appInstallation(id: "gid://shopify/AppInstallation/1002334195") { app { id } } } ``` #### 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 { appInstallation(id: \"gid://shopify/AppInstallation/1002334195\") { app { id } } }" }' ``` #### 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 { appInstallation(id: "gid://shopify/AppInstallation/1002334195") { app { id } } }`, ); 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 { appInstallation(id: "gid://shopify/AppInstallation/1002334195") { app { id } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { appInstallation(id: "gid://shopify/AppInstallation/1002334195") { app { id } } }`, }); ``` #### Response ```json { "appInstallation": { "app": { "id": "gid://shopify/App/1002334195" } } } ``` * ### Retrieves all application credits #### Query ```graphql query GetAppInstallationCredits($appInstallationId: ID!) { appInstallation(id: $appInstallationId) { credits(first: 10) { edges { node { amount { amount currencyCode } createdAt description id } } } } } ``` #### Variables ```json { "appInstallationId": "gid://shopify/AppInstallation/236444539" } ``` #### 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 GetAppInstallationCredits($appInstallationId: ID!) { appInstallation(id: $appInstallationId) { credits(first: 10) { edges { node { amount { amount currencyCode } createdAt description id } } } } }", "variables": { "appInstallationId": "gid://shopify/AppInstallation/236444539" } }' ``` #### 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 GetAppInstallationCredits($appInstallationId: ID!) { appInstallation(id: $appInstallationId) { credits(first: 10) { edges { node { amount { amount currencyCode } createdAt description id } } } } }`, { variables: { "appInstallationId": "gid://shopify/AppInstallation/236444539" }, }, ); 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 GetAppInstallationCredits($appInstallationId: ID!) { appInstallation(id: $appInstallationId) { credits(first: 10) { edges { node { amount { amount currencyCode } createdAt description id } } } } } QUERY variables = { "appInstallationId": "gid://shopify/AppInstallation/236444539" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query GetAppInstallationCredits($appInstallationId: ID!) { appInstallation(id: $appInstallationId) { credits(first: 10) { edges { node { amount { amount currencyCode } createdAt description id } } } } }`, "variables": { "appInstallationId": "gid://shopify/AppInstallation/236444539" }, }, }); ``` #### Response ```json { "appInstallation": { "credits": { "edges": [] } } } ``` [Open in GraphiQL](http://localhost:3457/graphiql?query=query%20AppInstallationMetafield\(%24namespace%3A%20String!%2C%20%24key%3A%20String!%2C%20%24ownerId%3A%20ID!\)%20%7B%0A%20%20appInstallation\(id%3A%20%24ownerId\)%20%7B%0A%20%20%20%20apiKey%3A%20metafield\(namespace%3A%20%24namespace%2C%20key%3A%20%24key\)%20%7B%0A%20%20%20%20%20%20value%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D\&variables=%7B%0A%20%20%22namespace%22%3A%20%22secret_keys%22%2C%0A%20%20%22key%22%3A%20%22api_key%22%2C%0A%20%20%22ownerId%22%3A%20%22gid%3A%2F%2Fshopify%2FAppInstallation%2F1002334195%22%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 AppInstallationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { appInstallation(id: $ownerId) { apiKey: metafield(namespace: $namespace, key: $key) { value } } }`, { variables: { "namespace": "secret_keys", "key": "api_key", "ownerId": "gid://shopify/AppInstallation/1002334195" }, }, ); const json = await response.json(); return json.data; } ``` ## Input variables JSON ```json { "namespace": "secret_keys", "key": "api_key", "ownerId": "gid://shopify/AppInstallation/1002334195" } ``` ## Response JSON ```json { "appInstallation": { "apiKey": { "value": "aSBhbSBhIHNlY3JldCBrZXk=" } } } ```