Skip to content

Delete several assets

DELETE
/stores/{storeRef}/assets
curl --request DELETE \
--url https://apibase.ecomweb.app/api/v1/stores/example/assets \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{ "asset_ids": [ "uuid-1", "uuid-2", "uuid-3" ] }'

Deletes the listed assets in one request. Assets that are still in use, unknown or in another store are skipped and returned in failedAssets with the reason; the rest are deleted. The request is answered with 200 even when some assets fail.

Required scopes: write:assets

storeRef
required
string

The store’s ref, as returned by GET /stores.

Media typeapplication/json
object
asset_ids
required

Array of asset IDs to delete

Array<string>

Example

[
"uuid-1",
"uuid-2",
"uuid-3"
]
Media typeapplication/json
object
failedAssets
required

The assets that were not deleted, each with the reason.

Array<object>
object
code

ASSET_IN_USE when the asset was refused because something still shows it.

string
usages

Where the asset is still used. Present with ASSET_IN_USE.

Array<object>
object
type
required

Kind of record using the asset, such as product or blog_post.

string
Allowed values: product product_variant collection blog_post content_page attribute_value promotion email_template other
name
required

Name of the record using the asset, when it has one.

string
nullable
id
required

ID of the record using the asset.

string
total

Total number of places that use the asset. Present with ASSET_IN_USE.

number
assetId
required

ID of the asset.

string
reason
required

Why the asset was not deleted.

string
deletedCount
required

Number of assets that were deleted.

number
message
required

A readable summary such as Deleted 2 of 3 assets.

string

Example

{
"failedAssets": [
{
"usages": [
{
"type": "product"
}
]
}
]
}

The request is malformed or failed validation.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key is missing, invalid, revoked or expired.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}