πŸ“ Metadata API

Host your token metadata using the Co:Create Metadata API

Metadata API Overview

The Co:Create Metadata APIs enable seamless management and control over NFT metadata on the CoCreate platform. Developers can use these APIs to create, retrieve, update, and manage metadata instances associated with NFTs, providing a powerful tool for tracking and manipulating asset-specific data. Additionally, the APIs support metadata override functions, allowing for tailored, token-specific metadata adjustments, thus offering enhanced flexibility for NFT management.

πŸ‘

Compatible with OpenSea

Co:Create Metadata APIs are compatible with OpenSea's metadata standards.

EndpointTypeDescription
Create NFT metadata instancePOSTThis endpoint allows you to create new metadata for a Non-Fungible Token (NFT).

NFTs are unique assets on a blockchain, and the metadata describes properties of the NFT, such as name, description, image, and other attributes. Using this endpoint, you can create a new set of these properties for an NFT.
List metadataGETThis endpoint allows you to retrieve a list of all metadata instances that have been created. This can be useful for getting an overview of all the NFT metadata that exists in your system.
Get metadataGETThis endpoint allows you to retrieve the metadata for a specific NFT using its cocreate_metadata_instance_id. This can be useful when you need to display or work with the properties of a specific NFT.
Update metadataPATCHThis endpoint allows you to change the metadata of an existing NFT. This can be useful if the attributes of the NFT change or if there were mistakes when the metadata was initially created. Note that changes to NFT metadata should be made carefully, as changing the metadata could potentially change the perceived value or meaning of the NFT.
Get metadata overrideGETThis endpoint allows you to get a metadata override for a specific NFT. Overrides allow for modifications to the base metadata on a per-token basis. This can be useful if you have a specific NFT that needs to have different metadata than what is specified in the base metadata.
Update metadata overridePATCHThis endpoint allows you to change the override metadata for a specific NFT. Like with the "Update metadata" endpoint, this should be done carefully as it changes the perceived attributes of the NFT. This can be useful if the specific override metadata for an NFT needs to be changed.

Metadata API Usage

Create NFT metadata instance

The first step in working with metadata is to create a new metadata instance. This is metadata that would apply to the full NFT collection as a default.

Endpoint: POST https://api.testcocrt.xyz/alpha/nft/metadata

Example using curl

The metadata instance pet_rocks is being created.

curl --request POST \
     --url https://api.testcocrt.xyz/alpha/nft/metadata \
     --header 'Authorization: Bearer <YOUR_API_KEY_HERE>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "cocreate_metadata_instance_id": "pet_rocks"
}
'

Example response:

{
  "data": {
    "cocreate_metadata_instance_id": "pet_rocks",
    "cocreate_max_token_id": 0,
    "name": null,
    "description": null,
    "external_url": null,
    "animation_url": null,
    "image": null,
    "youtube_url": null,
    "attributes": null,
    "custom_metadata": null
  }
}

Update NFT metadata instance

To update your metadata instance after it has been created, you can do so with this endpoint.

Endpoint: PATCH https://api.testcocrt.xyz/alpha/nft/metadata/{cocreate_metadata_instance_id}

Example using curl

The metadata instance pet_rocks is being updated to have the name Pet Rocks and media hosted via the Co:Create Media API.

curl --request PATCH \
     --url https://api.testcocrt.xyz/alpha/nft/metadata/pet_rocks \
     --header 'Authorization: Bearer <YOUR_API_KEY_HERE>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "name": "Pet Rocks",
  "image": "https://dev.cocrtcdn.com/media/charming_lalande_2061/file_1.png"
}
'

Example response:

{
  "data": {
    "cocreate_metadata_instance_id": "pet_rocks",
    "cocreate_max_token_id": 0,
    "name": "Pet Rocks",
    "description": null,
    "external_url": null,
    "animation_url": null,
    "image": "https://dev.cocrtcdn.com/media/charming_lalande_2061/file_1.png",
    "youtube_url": null,
    "attributes": null,
    "custom_metadata": null
  }
}

Update Metadata Override

If you would like a specific token to have unique properties, you can use the metadata override feature to do so.

Example using curl

Endpoint: PATCH https://api.testcocrt.xyz/alpha/nft/metadata/{cocreate_metadata_instance_id}/{token_id}

Here, token ID 2 of the Pet Rocks collection is being updated to have a unique media file, file_2.png. The rest of the collection's metadata remains unchanged.

curl --request PATCH \
     --url https://api.testcocrt.xyz/alpha/nft/metadata/pet_rocks/2 \
     --header 'Authorization: Bearer <YOUR_API_KEY_HERE>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "image": "https://dev.cocrtcdn.com/media/charming_lalande_2061/file_2.png"
}
'

Example response:

{
  "data": {
    "cocreate_metadata_instance_id": "pet_rocks",
    "cocreate_max_token_id": 0,
    "name": "Pet Rocks",
    "description": null,
    "external_url": null,
    "animation_url": null,
    "image": "https://dev.cocrtcdn.com/media/charming_lalande_2061/file_2.png",
    "youtube_url": null,
    "attributes": null,
    "custom_metadata": null,
    "token_id": 2
  }
}

Adding metadata to a Co:Create token

If you would like to apply your Co:Create hosted metadata to your Co:Create token collection, you can create or update a collection with the Co:Create metadata URI as the base_uri.

Metadata URIs are in the format:

πŸ“˜

Metadata URIs are the following formats:

Base URIs:

Metadata overrides:

Example using curl

The Pet Rocks collection is being created as an ERC721 with metadata URI listed as the base_uri property.

curl --request POST \
     --url https://api.testcocrt.xyz/alpha/erc721 \
     --header 'Authorization: Bearer zpka_89351a736479446bb3494d14dcf51576_1cb59dd4' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "name": "Pet Rocks",
  "symbol": "ROCKS",
  "base_uri": "https://dev.cocrtcdn.com/metadata/charming_lalande_2061/"
}
'

And now you should be able to view the collection with a GET request and see that the metadata URI is listed in the base_uri property.

{
  "data": [
    {
      "contract_address": "0x4ff70cbbc763b207821d8391ec821be5f7191416",
      "created_at": "2023-06-02T16:31:42.974939+00:00",
      "id": "b523270f-2b77-4efb-8511-f68dfb5dae51",
      "name": "Pet Rocks",
      "symbol": "ROCKS",
      "base_uri": "https://dev.cocrtcdn.com/metadata/charming_lalande_2061/",
      "is_transfer_allowlisted": false,
      "transfer_allowlist": []
    }
  ]
}

πŸ‘

Get Help

If you get stuck at any time, reach out to us on Discord or contact us via email at [email protected].


What’s Next