Single Atom Query
Fetch detailed information about a specific atom using its term ID. This is the most efficient way to retrieve atom data using a primary key lookup.
Query Structureβ
query GetAtom($id: String!) {
atom(term_id: $id) {
term_id
data
label
image
emoji
type
created_at
creator {
id
label
image
}
}
}
Variablesβ
{
"id": "0x39ad516aba15924381204ce477cf4d2b5313200814691e5376961673866ba4e3"
}
Expected Responseβ
{
"data": {
"atom": {
"term_id": "0x39ad516aba15924381204ce477cf4d2b5313200814691e5376961673866ba4e3",
"data": "https://res.cloudinary.com/...",
"label": "Intuition",
"image": "https://res.cloudinary.com/dfpwy9nyv/image/upload/v1734057836/remix/l7ffhwwrbrrgrnqclvs1.png",
"emoji": "π§©",
"type": "Thing",
"created_at": "2025-11-01T05:19:50+00:00",
"creator": {
"id": "0x774657D5fFb9d169D65ac5dCeEdD0f566d9E7853",
"label": "0x7746...7853",
"image": null
}
}
}
}
Interactive Exampleβ
Query
query GetAtom($id: String!) {
atom(term_id: $id) {
term_id
data
label
image
emoji
type
created_at
creator {
id
label
image
}
}
}Variables
Click "Run Query" to execute the GraphQL query and see results
Use Casesβ
Display Atom Detailsβ
Fetch complete atom information for display in a UI:
import { GraphQLClient } from 'graphql-request'
import { API_URL_PROD } from '@0xintuition/graphql'
const client = new GraphQLClient(API_URL_PROD)
const query = `
query GetAtom($id: String!) {
atom(term_id: $id) {
term_id
label
image
type
}
}
`
const atomId = '0x...'
const data = await client.request(query, { id: atomId })
console.log(data.atom)
Verify Atom Existenceβ
Check if an atom exists before performing operations:
const query = `
query CheckAtomExists($id: String!) {
atom(term_id: $id) {
term_id
}
}
`
const data = await client.request(query, { id: atomId })
if (data.atom) {
console.log('Atom exists')
} else {
console.log('Atom not found')
}
Get Creator Informationβ
Fetch atom with creator details for attribution:
const query = `
query GetAtomWithCreator($id: String!) {
atom(term_id: $id) {
term_id
label
creator {
id
label
image
}
}
}
`
Performance Considerationsβ
- Primary key lookup: Most efficient way to fetch a single atom
- Index usage: Term ID queries use the primary index
- Field selection: Only request fields you need to minimize response size
Related Patternsβ
- List Atoms with Filtering - Filter atoms by type, creator, date
- Atom with Vault Details - Include vault information
- Atom with Triples - Find related triples
Common Errorsβ
Atom not found: Returns null if the term ID doesn't exist:
{
"data": {
"atom": null
}
}
Invalid term ID format: Ensure the ID is a valid hex string starting with "0x".
Best Practicesβ
- Use variables for the term ID instead of hardcoding
- Request only needed fields to minimize response size
- Cache results if the same atom is queried frequently
- Handle null responses when the atom doesn't exist
See Alsoβ
- SDK: Create Atoms - Create atoms to query
- Protocol: Atom Functions - Low-level atom creation
- Core Concepts: Atoms - Understanding atoms