Create asset

What is an asset?

When creating an asset through the Original API you essentially mint a token (defined by metadata associated to your digital item) on the blockchain directly to one of your user's wallet.

For more info about the wallets, refer to the section wallets and security.

Create an asset

🚧

Important:

Request headers are required. See API basics introduction for more information.

Endpoint

POST /asset

  • Creates a new asset associated with the given App and User (set by the X-API-KEY).
  • Returns a new asset (asset uid) associated with the given app and user.

πŸ“˜

Note:

The request is partly asynchronous - the response will immediately return the asset uid and mint the underlying NFT on the blockchain asynchronously for the given user_uid's wallet.

To know when the asset has been minted, you can subscribe to the Webhook events or poll any Get asset endpoint.

Request body

Request body fieldsTypeDescriptionRequired/Optional
user_uidStringThe UID for the user of the App.Required
collection_uidStringThe collection UID to which the asset will be minted.Required
asset_external_idStringThe unique ID by which you identify this asset in your system.Optional
dataObjectThe data associated with the asset.Required
- nameStringThe name of the asset.Required
- unique_nameBooleanWhether the asset name should be unique or not. *Required
- image_urlString (URL)The image url of the asset.Required
- store_image_on_ipfsBooleanWhether the image should be stored on IPFS. **Required
- descriptionStringA description of the asset.Optional
- external_urlString (URL)An external URL for additional information.Optional
- attributesArray of ObjectsAdditional attributes describing the asset.Optional
-- trait_typeStringThe type of trait or attribute.Required
-- valueStringThe value of the trait or attribute.Required
-- display_typeStringThe display type for the attribute value.Optional

βœ…

Tips

In the context of Creating an asset:

  • user_uid refers to the user UID that the asset is to be minted to (UID we return when you create a user)
  • asset_external_id refers to your own unique identifier in your system to identify the asset

πŸ“˜

Note

*unique_name:

  • If set to True, we will check for existing names and return an error "Asset with this name already exists" as a guard from creating two assets with the same name for the same collection.
  • If set to False, we will append #TOKEN_ID to the name.

**store_image_on_ipfs:

  • If set to True, the asset metadata will contain the IPFS identifier of the image_url stored on IPFS. For more information, refer to the section metadata and storage.
  • If set to False, the asset metadata will contain the image_url meaning that you are expected to ensure the file hosting.

🚧

Important about IPFS storage

When using our API to create an asset, we will store the asset's image and metadata on IPFS only for apps in production

Asset's images and metadata created for apps in Development will be hosted in our storage and not on IPFS.

Request example

Sample: request body

{
    "user_uid": "324167489835",
    "asset_external_id": "asset_external_id_1",
    "collection_uid": "221137489875",
    "data": {
        "name": "Dave Starbelly",
        "unique_name": true,
        "image_url": "https://storage.googleapis.com/opensea-prod.appspot.com/puffs/3.png",
        "store_image_on_ipfs": true,
        "description": "Friendly OpenSea Creature that enjoys long swims in the ocean.",
        "external_url": "https://openseacreatures.io/3",
        "attributes": [
            {
                "trait_type": "Base", 
                "value": "Starfish"
            }, 
            {
                "trait_type": "Eyes", 
                "value": "Big"
            }, 
            {
                "trait_type": "Aqua Power", 
                "display_type": "boost_number",
                "value": 40
            }, 
            {
                "trait_type": "Stamina Increase", 
                "display_type": "boost_percentage",
                "value": 10
            }, 
        ]
    }
}

Response

Response example

Sample: 201 Created Response

You will receive a uid which refers to the asset's uid:

{
    "success": true,
    "data": {
        "uid": "122163488839", // (asset uid)
    }
}

You can use this uid to call and reference the other Asset endpoints. For example, GET /asset/{uid} with this uid will return the asset details.

πŸ“˜

Note:

In most cases, the asset status in the response will be β€œNot minted” due to the asynchronous operation of creating the asset on the blockchain.

Once the asset is minted on the blockchain, a Webhook event will be sent if it’s enabled.

This is the same uid that will be seen on the developer console under App > Assets.

Application overview - Assets table

Application overview - Assets table

Example

The following example creates an asset for user 111111111111 and the collection 999999999999 with your asset external id is asset-id-2.

# API_KEY is your api key
# TOKEN is the access token generated with your api key secret

curl -i \
  -X POST \ 
  -d "{\"user_uid\":\"111111111111\",\"collection_uid\":\"999999999999\",\"asset_external_id\":\"asset-id-2\",\"data\":...}" \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: API_KEY" \
  -H "Authorization: Bearer TOKEN" \
  "https://api.getoriginal.com/v1/asset"