NFT Management API
Overview
Endpoints for managing existing NFTs, including retrieving details, updating metadata, transferring ownership, and burning tokens.
Get NFT Details
Retrieve detailed information about a specific NFT.
Copy GET api.bloclabs.com/v1/nfts/{token_id}
Response
Copy {
"status": "success",
"data": {
"token_id": "1234",
"collection_address": "0x789...def",
"owner_address": "0x123...abc",
"token_uri": "ipfs://Qm...",
"metadata": {
"name": "Artwork #1",
"description": "Description of the artwork",
"image": "ipfs://Qm...",
"attributes": [
{
"trait_type": "Background",
"value": "Blue"
}
]
},
"last_transfer_date": "2024-03-15T10:00:00Z",
"token_standard": "ERC721"
}
}
Transfer NFT
Transfer an NFT to a new owner.
Copy POST api.bloclabs.com/v1/nfts/{token_id}/transfer
Request
Copy {
"from_address": "0x123...abc",
"to_address": "0x789...def",
"amount": 1, // Required for ERC1155
"data": "0x..." // Optional: Additional data for transfer
}
Response
Copy {
"status": "success",
"data": {
"transaction_hash": "0xabc...123",
"token_id": "1234",
"collection_address": "0x789...def",
"from_address": "0x123...abc",
"to_address": "0x789...def",
"timestamp": "2024-03-15T10:00:00Z"
}
}
Burn NFT
Permanently destroy an NFT.
Copy DELETE api.bloclabs.com/v1/nfts/{token_id}
Request
Copy {
"owner_address": "0x123...abc",
"amount": 1 // Required for ERC1155
}
Response
Copy {
"status": "success",
"data": {
"transaction_hash": "0xdef...456",
"token_id": "1234",
"collection_address": "0x789...def",
"burned_by": "0x123...abc",
"burned_at": "2024-03-15T10:00:00Z"
}
}
Get NFT History
Retrieve the transaction history of an NFT.
Copy GET api.bloclabs.com/v1/nfts/{token_id}/history
Query Parameters
Copy {
"event_type": "all", // all, transfer, mint, burn
"from_date": "2024-01-01",
"to_date": "2024-03-15",
"limit": 10,
"offset": 0
}
Response
Copy {
"status": "success",
"data": {
"events": [
{
"event_type": "TRANSFER",
"from_address": "0x123...abc",
"to_address": "0x789...def",
"transaction_hash": "0xghi...789",
"timestamp": "2024-03-15T10:00:00Z",
"block_number": 15481234
}
],
"pagination": {
"total": 5,
"limit": 10,
"offset": 0
}
}
}
Error Responses
Token Not Found
Copy {
"status": "error",
"message": "NFT not found",
"code": "TOKEN_NOT_FOUND",
"data": {
"token_id": "1234",
"collection_address": "0x789...def"
}
}
Unauthorized Transfer
Copy {
"status": "error",
"message": "Not authorized to transfer token",
"code": "UNAUTHORIZED_TRANSFER",
"data": {
"owner_address": "0x123...abc",
"requester_address": "0x456...def"
}
}
Burn Failed
Copy {
"status": "error",
"message": "Failed to burn token",
"code": "BURN_FAILED",
"data": {
"reason": "Token already burned",
"token_id": "1234"
}
}
Notes
Transfer operations require approval or ownership
Burned tokens cannot be recovered
History is maintained even after burning
ERC1155 tokens require amount specification
Transfer events are emitted on-chain
Consider gas costs for operations
Last updated 2 months ago