# AppInstallation - admin-graphql - OBJECT Version: 2024-10 ## Description Represents an installed application on a shop. ### Access Scopes ## Fields * [accessScopes](/docs/api/admin-graphql/2024-10/objects/AccessScope): AccessScope! - The access scopes granted to the application by a merchant during installation. * [activeSubscriptions](/docs/api/admin-graphql/2024-10/objects/AppSubscription): AppSubscription! - The active application subscriptions billed to the shop on a recurring basis. * [app](/docs/api/admin-graphql/2024-10/objects/App): App! - Application which is installed. * [channel](/docs/api/admin-graphql/2024-10/objects/Channel): Channel - Channel associated with the installed application. * [id](/docs/api/admin-graphql/2024-10/scalars/ID): ID! - A globally-unique ID. * [launchUrl](/docs/api/admin-graphql/2024-10/scalars/URL): URL! - The URL to launch the application. * [metafield](/docs/api/admin-graphql/2024-10/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. * [privateMetafield](/docs/api/admin-graphql/2024-10/objects/PrivateMetafield): PrivateMetafield - Returns a private metafield by namespace and key that belongs to the resource. * [publication](/docs/api/admin-graphql/2024-10/objects/Publication): Publication - The publication associated with the installed application. * [subscriptions](/docs/api/admin-graphql/2024-10/objects/AppSubscription): AppSubscription! - Subscriptions charge to a shop on a recurring basis. * [uninstallUrl](/docs/api/admin-graphql/2024-10/scalars/URL): URL - The URL to uninstall the application. ## Connections * [allSubscriptions](/docs/api/admin-graphql/2024-10/connections/AppSubscriptionConnection): AppSubscriptionConnection! * [credits](/docs/api/admin-graphql/2024-10/connections/AppCreditConnection): AppCreditConnection! * [metafields](/docs/api/admin-graphql/2024-10/connections/MetafieldConnection): MetafieldConnection! * [oneTimePurchases](/docs/api/admin-graphql/2024-10/connections/AppPurchaseOneTimeConnection): AppPurchaseOneTimeConnection! * [privateMetafields](/docs/api/admin-graphql/2024-10/connections/PrivateMetafieldConnection): PrivateMetafieldConnection! * [revenueAttributionRecords](/docs/api/admin-graphql/2024-10/connections/AppRevenueAttributionRecordConnection): AppRevenueAttributionRecordConnection! ## Related queries * [appInstallation](/docs/api/admin-graphql/2024-10/queries/appInstallation) Lookup an AppInstallation by ID or return the AppInstallation for the currently authenticated App. * [currentAppInstallation](/docs/api/admin-graphql/2024-10/queries/currentAppInstallation) Return the AppInstallation for the currently authenticated App. * [appInstallations](/docs/api/admin-graphql/2024-10/queries/appInstallations) A list of app installations. To use this query, you need to contact [Shopify Support](https://partners.shopify.com/current/support/) to grant your custom app the `read_apps` access scope. Public apps can't be granted this access scope. ## Related mutations ## Related Unions * [MetafieldReferencer](/docs/api/admin-graphql/2024-10/unions/MetafieldReferencer) Types of resources that may use metafields to reference other resources. ## Examples ### Get a metafield attached to an app installation 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 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/2024-10/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/2024-10/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/2024-10/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/2024-10/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/2024-10/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/2024-10/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" } } } }