Pin Thing Mutation
Pin a "Thing" object (general entity) to IPFS for use in atom creation.
Endpoint and Authβ
Use the public gated pinning endpoint and send your Intuition pin API key in an apikey header:
https://pin.intuition.systems/v1/graphql
Keep the key in a trusted server runtime. Do not pass it in the URL or expose it in public browser environment variables.
Create an authenticated client before sending the mutation:
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!,
},
});
Mutation Structureβ
mutation PinThing($thing: PinThingInput!) {
pinThing(thing: $thing) {
uri
}
}
Variablesβ
{
"thing": {
"name": "TypeScript Programming Language",
"description": "A strongly typed programming language that builds on JavaScript",
"image": "ipfs://QmXnnyufdzAWL5CqZ2RnSNgPbvCc1ALT73s6epPrRnZ1Xy",
"url": "https://www.typescriptlang.org"
}
}
Responseβ
{
"data": {
"pinThing": {
"uri": "ipfs://QmYx8C3kNN1sFSx5b..."
}
}
}
Workflowβ
- Pin metadata using
pinThingmutation - Get IPFS URI from response
- Create atom on-chain using the URI
- Query the atom via GraphQL API
Best Practicesβ
- Upload images first if needed using
uploadImage - Include all metadata fields for rich display
- Store IPFS URI for future reference
- Wait for indexing before querying the atom