πŸŽ₯ Media API

Host your token media using the Co:Create Media API

Media APIs Overview

The CoCreate Media APIs provide a comprehensive suite of endpoints for managing media associated with Non-Fungible Tokens (NFTs). They enable the creation, retrieval, updating, and deletion of NFT media instances. These APIs form an integral part of any NFT platform, allowing developers to handle all aspects of media interaction and manipulation

EndpointTypeDescription
Create NFT media instancePOSTThis endpoint allows you to create a new media instance for a Non-Fungible Token (NFT). This could include uploading media content such as images, audio, or video that are associated with a specific NFT.

Standard data formats accepted. Examples:
- Image: JPEG, PNG, GIF, BMP, SVG, WebP
- Video: MP4, AVI, MOV, MKV, FLV, WMV
- Audio: MP3, WAV, AAC, FLAC, OGG
- Documents: PDF

Max file size is 50MB
List mediaGETThis endpoint provides the ability to retrieve a list of all media instances that have been created. This can be useful for browsing, managing, or displaying all NFT media in a user interface.
Get mediaGETThis endpoint enables you to retrieve details of a specific media instance associated with an NFT. This could include the media content itself, as well as any metadata or properties associated with it.
Update mediaPATCHThis endpoint gives developers the ability to update the details of a specific media instance. This could be used to change the media content or alter associated metadata.
Delete mediaDELETEThis endpoint allows developers to delete a specific media instance. This could be used when an NFT is burned, transferred, or if the associated media content needs to be removed for any reason.

Media API Usage

Create Media Instance

This is your starting point for using Co:Create for the hosting of your token media. This endpoint is used to create a new media instance.

Endpoint: POST https://api.cocrt.xyz/alpha/nft/media

The media file should be sent as multipart/form-data in the body of the HTTP request. No special encoding is required for the file.

Example using curl

This example creates a media instance for a PNG media file, with the description of file #1 and a media instance file name of file_1:

curl --request POST \
     --url https://api.testcocrt.xyz/alpha/nft/media \
     --header 'Authorization: Bearer <YOUR_API_KEY_HERE>' \
     --header 'accept: application/json' \
     --header 'content-type: multipart/form-data' \
     --form [email protected] \
     --form file_name=file_1.png \
     --form 'description=file #1'

Example response:

{
  "data": {
    "media_path": "/file_1",
    "description": "file #1",
    "media_url": "https://dev.cocrtcdn.com/media/charming_lalande_2061/file_1.png"
  }
}

Get Media

If you would like to get information about a specific media instance, you would use this endpoint.

Endpoint: GET https://api.cocrt.xyz/alpha/nft/media/{cocreate_media_instance_id}

Example using curl

The media instance file_1 is requested:

curl --request GET \
     --url https://api.testcocrt.xyz/alpha/nft/media/file_1 \
     --header 'Authorization: Bearer <YOUR_API_KEY_HERE>' \
     --header 'accept: application/json'

Example response:

{
  "data": {
    "media_path": "/file_1",
    "description": "file #1",
    "media_url": "https://dev.cocrtcdn.com/media/charming_lalande_2061/file_1.png"
  }
}

Update Media

Use this endpoint if you would like to update an existing media instance's media file or description.

Endpoint: PATCH https://api.cocrt.xyz/alpha/nft/media/{cocreate_media_instance_id}

Example using curl

The description of file_1 is being updated to be token #1:

curl --request PATCH \
     --url https://api.testcocrt.xyz/alpha/nft/media/file_1.png \
     --header 'Authorization: Bearer <YOUR_API_KEY_HERE>' \
     --header 'accept: application/json' \
     --header 'content-type: multipart/form-data' \
     --form 'description=token #1'

Example response:

{
  "data": {
    "media_path": "/file_1.png",
    "description": "token #1",
    "media_url": "https://dev.cocrtcdn.com/media/charming_lalande_2061/file_1.png"
  }
}

πŸ‘

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