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

ParameterDescription
HM_ACCESS_KEYHyperMint Access Key
HM_ACCESS_KEY_SECRETHyperMint Access Key Secret

Body

ParameterTypeRequiredDescription
mediafileYAccepted media types: JPG, JPEG, PNG, GIF or SVG.

Response

CodeMeaning
🟢 200: OKResponds with an interaction ID which can be used to check the status of the transaction
🟠 404: Not FoundThe token does not exist
🟠 404: Not FoundContract 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

ParameterDescription
HM_ACCESS_KEYHyperMint Access Key
HM_ACCESS_KEY_SECRETHyperMint Access Key Secret

Body

ParameterTypeRequiredDescription
mediafileYAccepted media types: JPG, JPEG, PNG, GIF or SVG.

Response

CodeMeaning
🟢 200: OKResponds with an interaction ID which can be used to check the status of the transaction
🟠 404: Not FoundThe token does not exist
🟠 404: Not FoundContract 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

ParameterDescription
HM_ACCESS_KEYHyperMint Access Key
HM_ACCESS_KEY_SECRETHyperMint Access Key Secret

Body

ParameterTypeRequiredDescription
mediafileYAccepted media types: MP4, WEBM, MP3, WAV, OGG, GLB, GLTF.

Response

CodeMeaning
🟢 200: OKResponds with an interaction ID which can be used to check the status of the transaction
🟠 404: Not FoundThe token does not exist
🟠 404: Not FoundContract 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.