How to add Audio to your NFTs

This page explains how you can add audio files to your NFTs.

In this guide, we will look into how you can add an audio or multiple audio files to your NFTs. Note that adding the audio will happen during the creation of the token-type (NFT template).

๐Ÿ“˜

You need to have the URL of the audio address that you wish to add. When you still need to upload your media, then learn how to store your media/images on Venly Servers.

Prerequisites

  1. You already have an NFT collection (contract) created using the NFT-API. Click here to view the getting started guide if you haven't.
  2. contractAddress: The public address of your NFT contract.

Request Endpoint: reference

POST /api/v2/token-types/creations

Example Request

We will use the create token-type endpoint and within the request body, we will specify the animationUrls array.

POST /api/v2/token-types/creations

Request Body

๐Ÿ“˜

  • In the animationUrls array, we have defined the object with type: audio and its value(The URL of the audio address).
  • You can add multiple objects within the animationUrls array with images, videos, and even audio.
  • Click here to read more about animationUrls.
{
  "secretType": "MATIC",
  "contractAddress": "0xf5b11b4f458cc12a7989a146c5db2e7d500e2241",
  "creations": [{
    "name": "NFT with audio",
    "description": "This NFT has an audio",
    "image": "https://static.scientificamerican.com/sciam/cache/file/C91AC5AA-1F28-41E7-8E40EC59E66937D8_source.jpg?w=590&h=800&2113BA5E-A58F-4A28-ABDD0BE5C759F5B6",
    "externalUrl": "www.venly.io",
    "animationUrls": [{
      "type": "audio",
      "value": "https://storage-staging.venly.io/applications/a3079f3a-934c-4716-8d9a-195a0f3f5abb/brain-damage-148577.mp3"
    }]
  }]
}

Response Body

๐Ÿ“˜

The token-type was created successfully with an audio included. You can check its status using the result.creations.id param.

{
  "success": true,
  "result": {
    "creations": [
      {
        "id": "d4d3574c-fcd2-4242-974a-0c5b1296b750",
        "status": "PENDING",
        "tokenTypeId": 8,
        "metadata": {
          "name": "NFT with audio",
          "description": "This NFT has an audio",
          "image": "https://static.scientificamerican.com/sciam/cache/file/C91AC5AA-1F28-41E7-8E40EC59E66937D8_source.jpg?w=590&h=800&2113BA5E-A58F-4A28-ABDD0BE5C759F5B6",
          "imagePreview": "https://static.scientificamerican.com/sciam/cache/file/C91AC5AA-1F28-41E7-8E40EC59E66937D8_source.jpg?w=590&h=800&2113BA5E-A58F-4A28-ABDD0BE5C759F5B6",
          "imageThumbnail": "https://static.scientificamerican.com/sciam/cache/file/C91AC5AA-1F28-41E7-8E40EC59E66937D8_source.jpg?w=590&h=800&2113BA5E-A58F-4A28-ABDD0BE5C759F5B6",
          "animationUrl": "https://storage-staging.venly.io/applications/a3079f3a-934c-4716-8d9a-195a0f3f5abb/brain-damage-148577.mp3",
          "animation_url": "https://storage-staging.venly.io/applications/a3079f3a-934c-4716-8d9a-195a0f3f5abb/brain-damage-148577.mp3",
          "externalUrl": "www.venly.io",
          "external_url": "www.venly.io",
          "animationUrls": [
            {
              "type": "audio",
              "value": "https://storage-staging.venly.io/applications/a3079f3a-934c-4716-8d9a-195a0f3f5abb/brain-damage-148577.mp3"
            }
          ],
          "attributes": [
            {
              "type": "system",
              "name": "tokenTypeId",
              "value": "8",
              "traitType": "Token Type ID",
              "trait_type": "Token Type ID"
            }
          ],
          "contract": {
            "address": "0xf5b11b4f458cc12a7989a146c5db2e7d500e2241",
            "name": "Test",
            "symbol": "TE",
            "image": "string",
            "imageUrl": "string",
            "image_url": "string",
            "description": "Testing",
            "externalLink": "www.venly.io",
            "external_link": "www.venly.io",
            "externalUrl": "www.venly.io",
            "external_url": "www.venly.io",
            "media": [],
            "type": "ERC_1155"
          },
          "fungible": false
        }
      }
    ]
  }
}

Audio NFT Preview

Here is how the minted NFT will look with an audio file added. Please note that each platform might have a different way of visualizing the audio file to the user.

NFT with a video

NFT with Audio in the Venly Market