Skip to main content

Image & IPFS Operations

The Intuition GraphQL API provides mutations for uploading images and JSON data to IPFS (InterPlanetary File System). These operations return IPFS hashes that can be used in atom creation.

Available Operations​

OperationDescription
uploadImageUpload a base64-encoded image to IPFS
uploadImageFromUrlUpload an image from a URL to IPFS
uploadJsonToIpfsUpload JSON metadata to IPFS

Use Cases​

Atom Creation Workflow​

When creating atoms with images or metadata:

  1. Upload image using uploadImage or uploadImageFromUrl
  2. Upload JSON metadata using uploadJsonToIpfs
  3. Use returned IPFS hashes in atom creation

Profile Images​

Upload profile images for accounts:

  • Avatar images
  • Banner images
  • Organization logos

Metadata Storage​

Store structured metadata on IPFS:

  • Thing descriptions
  • Organization details
  • Person profiles

Quick Start​

import { GraphQLClient } from 'graphql-request'
import { API_URL_PROD } from '@0xintuition/graphql'

const client = new GraphQLClient(API_URL_PROD)

// Upload an image from URL
const imageResult = await client.request(`
mutation UploadImageFromUrl($url: String!) {
uploadImageFromUrl(url: $url) {
hash
url
size
}
}
`, {
url: 'https://example.com/image.png'
})

// Upload JSON metadata
const jsonResult = await client.request(`
mutation UploadJsonToIpfs($json: JSON!) {
uploadJsonToIpfs(json: $json) {
hash
url
}
}
`, {
json: {
name: 'My Atom',
description: 'Description here',
image: imageResult.uploadImageFromUrl.url
}
})

console.log('Metadata URL:', jsonResult.uploadJsonToIpfs.url)
// Use this URL when creating the atom

IPFS URL Format​

All uploaded content is accessible via IPFS:

ipfs://<hash>

The API returns both the raw hash and a gateway URL:

{
"hash": "QmXnnyufdzAWL5CqZ2RnSNgPbvCc1ALT73s6epPrRnZ1Xy",
"url": "ipfs://QmXnnyufdzAWL5CqZ2RnSNgPbvCc1ALT73s6epPrRnZ1Xy"
}

File Size Limits​

Upload TypeMaximum Size
Image (base64)5 MB
Image from URL10 MB
JSON1 MB

Supported Image Formats​

  • JPEG / JPG
  • PNG
  • GIF
  • WebP
  • SVG