metaobjectByHandle
- Query
- Content and shop
Requires read_metaobjects access scope. About access scopes
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
handle | MetaobjectHandleInput! | Required |
Returns
Metaobject One entry of a custom content type, with its handle, display name and field values.
| Field | Type | Description |
|---|---|---|
capabilities | MetaobjectCapabilityData! | |
createdAt | DateTime! | |
createdBy | App! | |
createdByApp | App! | |
createdByStaff | StaffMember | |
definition | MetaobjectDefinition! | |
displayName | String! | |
field | MetaobjectField |
|
fields | [MetaobjectField!]! | |
handle | String! | |
id | ID! | |
referencedBy | MetafieldRelationConnection! | |
staffMember | StaffMember | Deprecated |
thumbnailField | MetaobjectField | |
type | String! | |
updatedAt | DateTime! | |
values | JSON! |
Example request
A starting point: required arguments as variables and a few fields of the result. Replace the placeholders.
Set STORE_ID and TANQORY_ACCESS_TOKEN in your environment first (Make your first API call).
curl
curl -X POST "https://api.tanqory.com/admin/2026-10/stores/$STORE_ID/graphql" \
-H "Authorization: Bearer $TANQORY_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
--data '{"query":"query MetaobjectByHandle($handle: MetaobjectHandleInput!) {\n metaobjectByHandle(handle: $handle) {\n createdAt\n createdBy { id }\n createdByApp { id }\n createdByStaff { id }\n definition { id }\n displayName\n handle\n id\n staffMember { id }\n type\n }\n}","variables":{"handle":{"handle":"","type":""}}}'Node.js
// Node.js 18 or later (fetch is built in). Save as request.mjs and run: node request.mjs
const query = `query MetaobjectByHandle(\$handle: MetaobjectHandleInput!) {
metaobjectByHandle(handle: \$handle) {
createdAt
createdBy { id }
createdByApp { id }
createdByStaff { id }
definition { id }
displayName
handle
id
staffMember { id }
type
}
}`;
const variables = {
"handle": {
"handle": "",
"type": ""
}
};
const res = await fetch(`https://api.tanqory.com/admin/2026-10/stores/${process.env.STORE_ID}/graphql`, {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + process.env.TANQORY_ACCESS_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify({ query, variables }),
});
console.log(res.status, JSON.stringify(await res.json(), null, 2));Python
# Python 3, standard library only. Save as request.py and run: python3 request.py
import json, os, urllib.request
query = """query MetaobjectByHandle($handle: MetaobjectHandleInput!) {
metaobjectByHandle(handle: $handle) {
createdAt
createdBy { id }
createdByApp { id }
createdByStaff { id }
definition { id }
displayName
handle
id
staffMember { id }
type
}
}"""
variables = json.loads("""{
"handle": {
"handle": "",
"type": ""
}
}""")
req = urllib.request.Request(
"https://api.tanqory.com/admin/2026-10/stores/" + os.environ["STORE_ID"] + "/graphql",
data=json.dumps({"query": query, "variables": variables}).encode(),
headers={
"Authorization": "Bearer " + os.environ["TANQORY_ACCESS_TOKEN"],
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(req) as res:
print(res.status, json.dumps(json.load(res), indent=2))