Skip to main content
POST
/
public
/
v1
/
assets
/
asset
Create Asset
curl --request POST \
  --url https://api.topsort.com/public/v1/assets/asset \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "<string>",
  "productIds": [
    "<string>"
  ],
  "brands": [
    "<string>"
  ],
  "collectionIds": [
    "<string>"
  ],
  "mimetype": "image/jpeg",
  "metadata": {},
  "externalUrl": "<string>"
}'
{
  "id": "<string>",
  "name": "<string>",
  "mimetype": "<string>",
  "status": "pending_upload",
  "url": "<string>",
  "productIds": [
    "<string>"
  ],
  "brands": [
    "<string>"
  ],
  "metadata": {},
  "isExternal": true,
  "fields": {},
  "uploadUrl": "<string>"
}

Authorizations

Authorization
string
header
required

A valid API key generated in Topsort's UI.

Query Parameters

vendor_id
string
required

Vendor ID.

Body

application/json
name
string
required

The name of the asset.

Maximum length: 64
productIds
string[] | null

The product ids that the asset is associated with.

Maximum length: 10
brands
string[] | null

The brands that the asset is associated with.

Maximum length: 10
collectionIds
string[] | null

The collections that the asset is associated with.

Maximum length: 10
mimetype
enum<string> | null

The mimetype of the asset.

Available options:
image/jpeg,
image/png,
image/gif,
image/webp,
text/html,
video/mp4,
video/quicktime,
application/json
metadata
object | null

The metadata associated with the asset. Max key length is 32 characters and max value length is 64 characters.

externalUrl
string<uri> | null

URL of an externally hosted asset. If this value is provided, then the asset will not be hosted by Topsort.

Required string length: 1 - 2083

Response

Successful Response

id
string
required

The id of the asset.

name
string
required

The name of the asset.

status
enum<string>
required

Approval status of the asset

Available options:
pending_upload,
pending_approval,
upload_error,
approved,
rejected
productIds
string[]
required

The product ids that the asset is associated with.

brands
string[]
required

The brands that the asset is associated with.

metadata
object
required

The metadata associated with the asset.

isExternal
boolean
required

Indicates if the asset is externally hosted.

mimetype
string | null

The mimetype of the asset.

url
string<uri> | null

The url of the asset.

Required string length: 1 - 2083
fields
object | null

The fields to send with the pre-signed url. Can be empty if this is an external asset.

uploadUrl
string<uri> | null

The upload url the asset needs to be uploaded to.

Minimum length: 1