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β
| Operation | Description |
|---|---|
uploadImage | Upload a base64-encoded image to IPFS |
uploadImageFromUrl | Upload an image from a URL to IPFS |
uploadJsonToIpfs | Upload JSON metadata to IPFS |
Use Casesβ
Atom Creation Workflowβ
When creating atoms with images or metadata:
- Upload image using
uploadImageoruploadImageFromUrl - Upload JSON metadata using
uploadJsonToIpfs - 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 Type | Maximum Size |
|---|---|
| Image (base64) | 5 MB |
| Image from URL | 10 MB |
| JSON | 1 MB |
Supported Image Formatsβ
- JPEG / JPG
- PNG
- GIF
- WebP
- SVG
Related Documentationβ
- Upload Image - Base64 image upload
- Upload Image from URL - URL-based upload
- Upload JSON to IPFS - JSON metadata upload
- Pin Mutations - Pin entities to IPFS