Upload Asset

Uploads an asset. Supported file types include jpg, png, and gif. After uploading the asset file, it returns a public URI to access the asset.

You can use curl to upload the file as shown below:

curl --location --request POST 'https://metadata-api.klaytnapi.com/v1/metadata/asset' \
--header 'x-chain-id: 8217' \
--header 'Authorization: Basic S0FTS0U0Mjc5Q01VMVhLVDg1UTRBVkRBOlFEMENMam5XRW94TzZfQ3pYLV9oLWRrQkZnMDVxR1FnbWlYcDAwVno=' \
--form 'file=@"/Users/usernamed/Documents/files/1kbfile.jpg"'

Note

The URI in the response looks like this:

https://metadata-store.klaytnapi.com/{storage-id}/{assetID}.{extension}.

  • {storage-id}(UUID) is an identifier value automatically given to each user.
  • {assetID} is a unique identifier given to the uploaded asset.
Request
Security:
header Parameters
x-chain-id
required
string

Kaia Network Chain ID (1001 or 8217)

Request Body schema: multipart/form-data

Attach a file you want to upload.

file
required
string

Addes a file with multipart/form-data. File number is limited to one, and file size is limited to 10MB. If the file size exceeds 10MB, you will get an invalid input error.

Responses
200

Your request was successful.

400

The request is not valid.

post/v1/metadata/asset
Request samples
multipart/form-data
{
  "file": "@\"/Users/username/Documents/files/1kbfile.jpg\""
}
Response samples
application/json
{}