PUT: Upload Contract and Token Metadata Media
When using Hosted Metadata, the media can be uploaded to the HyperMint servers using the following endpoints.
These endpoints use the multipart/form-data
content type to upload the media.
Upload Contract Image
https://api.hypermint.com/v1/nft-contract/:contractId/metadata-image
This endpoint uses the multipart/form-data
content type to upload the media.
Accepted media types: JPG, JPEG, PNG, GIF or SVG.
Parameters
Header
Parameter | Description |
---|---|
HM_ACCESS_KEY | HyperMint Access Key |
HM_ACCESS_KEY_SECRET | HyperMint Access Key Secret |
Body
Parameter | Type | Required | Description |
---|---|---|---|
media | file | Y | Accepted media types: JPG, JPEG, PNG, GIF or SVG. |
Response
Code | Meaning |
---|---|
🟢 200: OK | Responds with an interaction ID which can be used to check the status of the transaction |
🟠 404: Not Found | The token does not exist |
🟠 404: Not Found | Contract does not exist or you do not have permission |
interface MediaUploadResponse {
success: boolean
}
Upload Token Image
https://api.hypermint.com/v1/nft-contract/:contractId/token/:tokenId/metadata-image
This endpoint uses the multipart/form-data
content type to upload the media.
Accepted media types: JPG, JPEG, PNG, GIF or SVG.
You must first set the token metadata for the target token before uploading its image
Parameters
Header
Parameter | Description |
---|---|
HM_ACCESS_KEY | HyperMint Access Key |
HM_ACCESS_KEY_SECRET | HyperMint Access Key Secret |
Body
Parameter | Type | Required | Description |
---|---|---|---|
media | file | Y | Accepted media types: JPG, JPEG, PNG, GIF or SVG. |
Response
Code | Meaning |
---|---|
🟢 200: OK | Responds with an interaction ID which can be used to check the status of the transaction |
🟠 404: Not Found | The token does not exist |
🟠 404: Not Found | Contract does not exist or you do not have permission |
interface MediaUploadResponse {
success: boolean
}
Upload Animation File
https://api.hypermint.com/v1/nft-contract/:contractId/token/:tokenId/metadata-animation
This endpoint uses the multipart/form-data
content type to upload the media.
Accepted media types: MP4, WEBM, MP3, WAV, OGG, GLB, GLTF.
You must first set the token metadata for the target token before uploading its image
Parameters
Header
Parameter | Description |
---|---|
HM_ACCESS_KEY | HyperMint Access Key |
HM_ACCESS_KEY_SECRET | HyperMint Access Key Secret |
Body
Parameter | Type | Required | Description |
---|---|---|---|
media | file | Y | Accepted media types: MP4, WEBM, MP3, WAV, OGG, GLB, GLTF. |
Response
Code | Meaning |
---|---|
🟢 200: OK | Responds with an interaction ID which can be used to check the status of the transaction |
🟠 404: Not Found | The token does not exist |
🟠 404: Not Found | Contract does not exist or you do not have permission |
interface MediaUploadResponse {
success: boolean
}
Sample Script to Upload Media via API
const formData = new FormData();
formData.append('media', path.resolve('./data', 'projects', 'my_project', 'image.png'));
const result = await axios.put(
`${HM_API}/nft-contract/${contractId}/token/${tokenId}/metadata-image`,
formData,
{ headers: this.getHeaders() }
);
console.log(_tokenId, result.data);
Feedback
Something not quite right, unclear or can't find what you are looking for? Please let us know at support.moonpay.com and we will get back to you as soon as we can.
Updated 7 months ago