Skip to content

Delete a product

DELETE
/stores/{storeRef}/products/{id}
curl --request DELETE \
--url https://apibase.ecomweb.app/api/v1/stores/example/products/1 \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{ "soft_delete": true, "reason": "Entity deletion requested by user", "force": false, "delete_variants": true, "check_orders": true }'

Soft-deletes the product by default: it disappears from the store and its slug is freed, but the record is kept. Send force: true to delete it permanently, which cannot be undone. delete_variants (default true) also removes or deactivates the product’s variants.

Required scopes: write:products

id
required
integer

The product ID.

storeRef
required
string

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

Media typeapplication/json
object
soft_delete

Whether to perform soft delete (disable) or hard delete (remove)

boolean
default: true

Example

true
reason

Reason for deletion (for audit purposes)

string

Example

Entity deletion requested by user
force

Force delete even if entity has active dependencies

boolean

Example

false
delete_variants

Whether to also delete all product variants

boolean
default: true

Example

true
check_orders

Whether to check for active orders before deletion

boolean
default: true

Example

true
Media typeapplication/json
object
type
required

soft keeps the product recoverable by staff; hard removes it permanently.

string
Allowed values: soft hard
success
required

Whether the deletion succeeded.

boolean
message
required

A readable result message.

string
product_id
required

ID of the deleted product.

number
variants_deleted

Number of variants removed or deactivated.

number
deleted_at

When the product was soft-deleted, as an ISO 8601 timestamp. Absent for a hard delete.

string

Example

{
"type": "soft"
}

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"
}

The resource does not exist in this store.

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"
}