Documentation Index
Fetch the complete documentation index at: https://docs.pinata.cloud/llms.txt
Use this file to discover all available pages before exploring further.
Associate a CID with a payment instruction for x402 monetization
Usage
import { PinataSDK } from "pinata";
const pinata = new PinataSDK({
pinataJwt: process.env.PINATA_JWT!,
pinataGateway: "example-gateway.mypinata.cloud",
});
const association = await pinata.x402.addCid(
"01234567-89ab-cdef-0123-456789abcdef",
"bafkreih5aznjvttude6c3wbvqeebb6rlx5wkbzyppv7garjiubll2ceym4"
);
Returns
type CidAssociationResponse = {
data: CidAssociation;
};
type CidAssociation = {
payment_instruction_id: string;
cid: string;
created_at: string;
};
Parameters
paymentInstructionId (required)
The unique identifier of the payment instruction to associate the CID with
const association = await pinata.x402.addCid(
"01234567-89ab-cdef-0123-456789abcdef",
"bafkreih5aznjvttude6c3wbvqeebb6rlx5wkbzyppv7garjiubll2ceym4"
);
cid (required)
The IPFS CID to associate with the payment instruction. Once associated, accessing this content will require payment according to the payment instruction.
const association = await pinata.x402.addCid(
"01234567-89ab-cdef-0123-456789abcdef",
"bafkreih5aznjvttude6c3wbvqeebb6rlx5wkbzyppv7garjiubll2ceym4"
);