Upload an asset to the storage service

Upload a new asset to the storage service. This endpoint accepts multipart form data containing the file to be uploaded along with metadata such as name, type, and folder location. The uploaded asset will be processed and made available for download.

POST

Parameters

Body

multipart/form-data
Provider
REQUIRED
Folder
REQUIRED
Key
REQUIRED
The key of the asset in the storage provider.
Is_public
Whether the asset is public or not.
Tag
The tag of the asset.
File
REQUIRED
Status codeDescription
200Upload response
400Bad request error - the request contains invalid parameters or malformed data
500Internal server error - an unexpected error occurred on the server
defaultInternal server error - an unexpected error occurred on the server
cURL
curl -L -X POST \
"https://blockv-labs.io/assets" \
-H 'Accept: application/json'
Response
{
"id": "string",
"wallet_id": "string",
"name": "string",
"tag": "string",
"url": "string",
"path": "string",
"size": 0,
"provider": "ipfs",
"folder": "avatars",
"is_public": false,
"type": "string",
"hash": "string",
"when_created": "2024-01-01T00:00:00Z"
}
json
{
"type": "object",
"required": [
"id",
"name",
"tag",
"provider",
"folder",
"org_id",
"wallet_id",
"url",
"path",
"size",
"type",
"when_created"
],
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the API key.",
"x-oapi-codegen-extra-tags": {
"json": "id,omitempty",
"bson": "_id,omitempty"
},
"x-go-type": "id.ID",
"x-go-type-import": {
"path": "github.com/vlabsio/smarttoken/pkg/types/id"
}
},
"wallet_id": {
"type": "string",
"description": "Unique identifier for the API key.",
"x-oapi-codegen-extra-tags": {
"bson": "wallet_id,omitempty"
},
"x-go-type": "id.ID",
"x-go-type-import": {
"path": "github.com/vlabsio/smarttoken/pkg/types/id"
},
"x-go-type-skip-optional-pointer": true
},
"name": {
"type": "string",
"x-oapi-codegen-extra-tags": {
"bson": "name,omitempty"
}
},
"tag": {
"type": "string",
"x-oapi-codegen-extra-tags": {
"bson": "tag,omitempty"
}
},
"url": {
"type": "string",
"format": "url",
"x-oapi-codegen-extra-tags": {
"bson": "url,omitempty"
}
},
"path": {
"type": "string",
"format": "url",
"x-oapi-codegen-extra-tags": {
"bson": "path,omitempty"
}
},
"size": {
"type": "integer",
"x-oapi-codegen-extra-tags": {
"bson": "size,omitempty"
}
},
"provider": {
"type": "string",
"enum": [
"ipfs",
"s3",
"gcs"
],
"x-oapi-codegen-extra-tags": {
"bson": "provider,omitempty",
"form": "provider"
}
},
"folder": {
"type": "string",
"enum": [
"avatars",
"assets",
"support"
],
"x-oapi-codegen-extra-tags": {
"form": "folder",
"bson": "folder"
}
},
"is_public": {
"type": "boolean",
"x-oapi-codegen-extra-tags": {
"bson": "is_public,omitempty"
},
"x-go-type-skip-optional-pointer": true
},
"type": {
"type": "string",
"x-oapi-codegen-extra-tags": {
"bson": "type,omitempty"
}
},
"hash": {
"type": "string",
"x-oapi-codegen-extra-tags": {
"bson": "hash,omitempty"
}
},
"when_created": {
"type": "string",
"format": "date-time",
"x-oapi-codegen-extra-tags": {
"bson": "when_created,omitempty"
}
}
}
}