Skip to main content

Single Account Query

Fetch detailed information about a specific account using its Ethereum address.

Query Structure​

query GetAccount($id: String!) {
account(id: $id) {
id
label
image
type
atom_id
atom {
term_id
data
type
}
created_at
updated_at
}
}

Variables​

{
"id": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
}

Response Fields​

FieldTypeDescription
idStringAccount address (primary key)
labelStringHuman-readable name (from atom or ENS)
imageStringProfile image URL
typeStringAccount type: Default, AtomWallet, ProtocolVault
atom_idStringLinked atom ID (if any)
atomAtomLinked atom details
created_atDateTimeFirst interaction timestamp
updated_atDateTimeLast activity timestamp

Expected Response​

{
"data": {
"account": {
"id": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"label": "vitalik.eth",
"image": "ipfs://QmXnnyufdzAWL5CqZ2RnSNgPbvCc1ALT73s6epPrRnZ1Xy",
"type": "AtomWallet",
"atom_id": "0x57d94c116a33bb460428eced262b7ae2ec6f865e7aceef6357cec3d034e8ea21",
"atom": {
"term_id": "0x57d94c116a33bb460428eced262b7ae2ec6f865e7aceef6357cec3d034e8ea21",
"data": "ipfs://Qm...",
"type": "Person"
},
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
}

Interactive Example​

Query

query GetAccount($id: String!) {
  account(id: $id) {
    id
    label
    image
    type
    created_at
  }
}

Variables

Click "Run Query" to execute the GraphQL query and see results

Use Cases​

Profile Page​

Display account profile information:

async function getAccountProfile(address: string) {
const query = `
query GetAccountProfile($id: String!) {
account(id: $id) {
id
label
image
type
atom {
type
data
}
created_at
}
}
`

const data = await client.request(query, { id: address })
return data.account
}

React Profile Component​

function AccountProfile({ address }: { address: string }) {
const { data, loading } = useQuery(GET_ACCOUNT, {
variables: { id: address }
})

if (loading) return <Spinner />
if (!data?.account) return <NotFound />

const { account } = data

return (
<div className="profile">
{account.image && (
<img src={resolveIpfs(account.image)} alt={account.label} />
)}
<h1>{account.label || truncateAddress(account.id)}</h1>
<span className="type">{account.type}</span>
<span className="address">{account.id}</span>
<time>Member since {formatDate(account.created_at)}</time>
</div>
)
}

Check Account Existence​

async function accountExists(address: string): Promise<boolean> {
const query = `
query CheckAccount($id: String!) {
account(id: $id) {
id
}
}
`

const data = await client.request(query, { id: address })
return data.account !== null
}

Best Practices​

  1. Normalize addresses - Always lowercase addresses before querying
  2. Handle null - Account may not exist for new addresses
  3. Resolve IPFS - Convert ipfs:// URLs to gateway URLs for images
  4. Fallback labels - Use truncated address if label is null