A developer is unable to retrieve metafield definitions for CUSTOMER and BLOG owner types via Shopify’s GraphQL Admin API, despite successfully querying other types (PRODUCT, PRODUCTVARIANT, COLLECTION, LOCATION, PAGE). The query returns empty results without errors, even though metafields are visible and editable in the Admin UI.
Likely cause: Missing API access scopes
CUSTOMER metafields require read_customers scope
BLOG metafields require read_content scope
Suggested troubleshooting steps:
Verify API credentials have correct access scopes
Confirm admin API token has sufficient permissions
Test with singular metafieldDefinition query using a specific ID
Check for active namespace or visibility filters
Additional notes:
The query syntax appears correct
For blog posts, the owner type may be ARTICLE rather than BLOG_POST in the API
The issue remains unresolved pending scope verification and API version confirmation
Summarized with AI on October 29.
AI used: claude-sonnet-4-5-20250929.
Hi All. I am trying to query the Shopify Metafields using the graphql admin api. I can get the PRODUCT, PRODUCTVARIANT, COLLECTION, LOCATION and PAGE metafielddefinitions.
Whenever I try to retrieve the metafielddefinitions for ownerType CUSTOMER or BLOG (or BLOG POSTS but I don’t know that ownerType as it is not documented that I can find) I don’t get any data returned even though via the Admin UI I can see there are metafields there and I can view them and modify them from the UI.
This is probably something really simple but I am not receiving ANY Errors just and empty response.
The most likely explanation is that you need to specify the correct access scopes in your API credentials. Metafield definitions for CUSTOMER specifically require the read_customers scope, and for BLOG they require read_content scope.
Here are a few troubleshooting steps to try:
Double-check the API access scopes associated with your app/API credentials
Verify you’re using a valid admin API token with sufficient permissions
Try retrieving just one metafield definition at a time with a known ID
Check if there are any namespace or visibility filters active
Your query syntax itself looks correct. You could also try using the metafieldDefinition (singular) query with a specific ID to see if that works:
query retrieveMetaField {
metafieldDefinition(id: "gid://shopify/MetafieldDefinition/YOUR_METAFIELD_ID") {
id
name
description
namespace
key
ownerType
}
}
For BLOG posts specifically, the owner type is likely ARTICLE in the API (not BLOG_POST), though this would need to be confirmed with Shopify’s documentation.
If you’re still having trouble after checking these things, could you share which API version you’re using and whether you’re able to successfully query other types of metafield definitions?