Image & IPFS Operations
The Intuition GraphQL API provides mutations for uploading images and JSON data to IPFS (InterPlanetary File System). Image uploads return cached image URLs, while JSON uploads return IPFS hashes that can be used in atom creation.
Pinning endpoint and API key
Image and JSON upload mutations use the public gated pinning endpoint, https://pin.intuition.systems/v1/graphql, and require an apikey request header. Keep the API key server-side.
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 the returned image URL and metadata IPFS hash 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 { PIN_API_URL } from '@0xintuition/graphql';
const client = new GraphQLClient(PIN_API_URL, {
headers: {
apikey: process.env.INTUITION_PIN_API_KEY!,
},
});
// Upload an image from URL
const imageResult = await client.request(
`
mutation UploadImageFromUrl($image: UploadImageFromUrlInput!) {
uploadImageFromUrl(image: $image) {
images {
url
safe
}
}
}
`,
{
image: { url: 'https://example.com/image.png' },
},
);
// Upload JSON metadata
const jsonResult = await client.request(
`
mutation UploadJsonToIpfs($json: jsonb!) {
uploadJsonToIpfs(json: $json) {
hash
name
size
}
}
`,
{
json: {
name: 'My Atom',
description: 'Description here',
image: imageResult.uploadImageFromUrl.images[0].url,
},
},
);
console.log('Metadata URI:', `ipfs://${jsonResult.uploadJsonToIpfs.hash}`);
// Use this URI when creating the atom
IPFS Response Formatβ
Uploaded JSON content is accessible via IPFS:
ipfs://<hash>
The exact response shape depends on the mutation. JSON uploads return the raw hash, which you can convert to an IPFS URI:
{
"hash": "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