const response = await fetch("https://staging.crossmint.com/api/v1/ip/collections/{collectionId}/ipassets", {
method: "POST",
headers: {
"X-API-KEY": "<YOUR_API_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
owner: 'email:creator@example.com:story-testnet',
nftMetadata: {
name: 'Art #123',
description: 'A unique story NFT',
image: 'https://example.com/nft/123.png'
},
ipAssetMetadata: {
title: 'Harry Potter and the Philosopher\'s Stone',
createdAt: '1997-06-26T00:00:00',
ipType: 'literature',
creators: [
{
name: 'JK Rowling',
email: 'JKRowling@example.com',
address: '0x123',
description: 'Author',
contributionPercent: 80,
socialMedia: [
{
platform: 'Wikipedia',
url: 'https://en.wikipedia.org/wiki/J._K._Rowling'
}
]
},
{
name: 'Thomas Taylor',
email: 'ThomasTaylor@example.com',
crossmintUserLocator: 'email:ThomasTaylor@example.com:story-testnet',
description: 'Illustrator',
contributionPercent: 15
},
{
name: 'Bloomsbury Publishing',
email: 'BloomsburyPublishing@example.com',
address: '0x123',
description: 'Publisher',
contributionPercent: 5,
socialMedia: [
{
platform: 'Website',
url: 'https://www.bloomsbury.com/'
}
]
}
],
media: [
{
name: 'ePub',
url: 'link_to_epub',
mimeType: 'application/epub+zip'
},
{
name: 'Book Summary PDF',
url: 'link_to_book_summary_pdf',
mimeType: 'application/pdf'
}
],
attributes: [
{
key: 'ISBN',
value: '978-0-7475-3269-0'
},
{
key: 'Genre',
value: 'Fantasy'
}
]
}
})
});
const ipAsset = await response.json();
console.log("IP Asset:", ipAsset);