Anchor to appInstallationapp
appInstallation
query
Lookup an AppInstallation by ID or return the AppInstallation for the currently authenticated App.
Anchor to Possible returnsPossible returns
- Anchor to AppInstallationApp•
Installation Represents an installed application on a shop.
Was this section helpful?
- Get a metafield attached to an app installation
- Get metafields attached to an app installation
- Get the URL used to launch the application
- Get the URL used to uninstall the application
- Get the access scopes associated with the app installation
- Get the active subscriptions for the app installation
- Get the app associated with the installation
- Retrieves all application credits
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 query AppInstallationMetafield($namespace: String!, $key: String!, $ownerId: ID!) {6 appInstallation(id: $ownerId) {7 apiKey: metafield(namespace: $namespace, key: $key) {8 value9 }10 }11 }`,12 {13 variables: {14 "namespace": "secret_keys",15 "key": "api_key",16 "ownerId": "gid://shopify/AppInstallation/1002334195"17 },18 },19);2021const data = await response.json();22
query AppInstallationMetafield($namespace: String!, $key: String!, $ownerId: ID!) {
appInstallation(id: $ownerId) {
apiKey: metafield(namespace: $namespace, key: $key) {
value
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/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"
}
}'
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 data = await response.json();
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"
},
},
});
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)
Input variables
JSON1{2 "namespace": "secret_keys",3 "key": "api_key",4 "ownerId": "gid://shopify/AppInstallation/1002334195"5}
Response
JSON1{2 "appInstallation": {3 "apiKey": {4 "value": "aSBhbSBhIHNlY3JldCBrZXk="5 }6 }7}