Overview
Endpoints for managing NFT metadata, properties, and attributes. These endpoints enable you to update, retrieve, and store metadata for NFTs.
Retrieve the metadata for a specific NFT.
GET api.bloclabs.com/v1/nfts/{token_id}/metadata
Response
{
"status": "success",
"data": {
"token_id": "1234",
"collection_address": "0x789...def",
"metadata": {
"name": "Artwork #1",
"description": "Description of the artwork",
"image": "ipfs://Qm...",
"external_url": "https://example.com/nft/1234",
"attributes": [
{
"trait_type": "Background",
"value": "Blue"
},
{
"trait_type": "Rarity",
"value": "Legendary",
"display_type": "string"
}
],
"animation_url": "ipfs://Qm...", // Optional
"youtube_url": "https://..." // Optional
},
"last_updated": "2024-03-15T10:00:00Z"
}
}
Update the metadata for an NFT.
POST api.bloclabs.com/v1/nfts/{token_id}/metadata
Request
{
"name": "Updated Artwork #1",
"description": "New description",
"image": "ipfs://Qm...",
"attributes": [
{
"trait_type": "Background",
"value": "Red"
}
],
"external_url": "https://example.com/nft/1234"
}
Response
{
"status": "success",
"data": {
"token_id": "1234",
"collection_address": "0x789...def",
"metadata_uri": "ipfs://Qm...",
"updated_at": "2024-03-15T10:00:00Z",
"transaction_hash": "0xabc...123" // If on-chain update
}
}
Upload media files (images, videos) for NFT metadata.
POST api.bloclabs.com/v1/nfts/media/upload
Request
# Multipart form data
Content-Type: multipart/form-data
file: <binary_data>
type: "image" # image, video, animation
Response
{
"status": "success",
"data": {
"media_uri": "ipfs://Qm...",
"mime_type": "image/png",
"size": 1024576,
"gateway_url": "https://ipfs.io/ipfs/Qm..."
}
}
Get Collection Properties
Retrieve all properties/traits used in a collection.
GET api.bloclabs.com/v1/nfts/collections/{collection_id}/properties
Response
{
"status": "success",
"data": {
"properties": [
{
"trait_type": "Background",
"values": ["Blue", "Red", "Green"],
"occurrence": {
"Blue": 50,
"Red": 30,
"Green": 20
}
},
{
"trait_type": "Rarity",
"values": ["Common", "Rare", "Legendary"],
"occurrence": {
"Common": 70,
"Rare": 25,
"Legendary": 5
}
}
],
"total_items": 100
}
}
Error Responses
{
"status": "error",
"message": "Invalid metadata format",
"code": "INVALID_METADATA",
"data": {
"validation_errors": [
"Image URL is required",
"Name exceeds maximum length"
]
}
}
Upload Failed
{
"status": "error",
"message": "Media upload failed",
"code": "UPLOAD_FAILED",
"data": {
"reason": "File size exceeds limit",
"max_size": "100MB"
}
}
{
"status": "error",
"message": "Failed to update metadata",
"code": "UPDATE_FAILED",
"data": {
"reason": "Not authorized to update"
}
}
Notes
Metadata should follow OpenSea metadata standards
Images should be hosted on IPFS for permanence
Maximum file size for uploads is 100MB
Supported media formats: PNG, JPG, GIF, MP4, WEBM
Properties are case-sensitive
Consider gas costs for on-chain metadata updates
Metadata updates may take time to reflect on marketplaces
Last updated