Skip to main content
POST/vectors/{collection}/delete

Delete Vectors by Metadata

Deletes the rows of a _-prefixed vector collection that match every equality in filters, and answers { deleted, collection } with the count removed.

filters must include at least one metadata.<key> equality. id, contentHash and source.<key> can narrow it but are refused on their own, and an empty filters is refused rather than deleting everything.

Each row goes with its vector, text, metadata and content hash.

Needs the same vectors write grant on the collection as an upsert.

Each call writes one audit event with the collection and the count, never the filter.

Parameters
collection *path

The derived collection's name.

It starts with _.

projectSlug *path

The project's slug: the path segment after @.

It is unique within the org.

Request body
filters *object

Equality filters; every one must match.

At least one metadata.<key> path is required. id, contentHash and source.<key> may be added to narrow it.

Each key is a path and each value the string, number or boolean it must equal.

An empty object, or one with no metadata.<key> path, gets 400 K9O_INVALID_FIELD_VALUE: an empty filter never deletes everything.

Responses
HTTPK9O CodeDescription
200Success
400K9O_INVALID_FIELD_VALUEThe project identifier in the request path is not valid.
400K9O_INVALID_FIELD_VALUEfilters is empty or has no metadata.<key> equality; id, contentHash and source.<key> can only narrow one.
400K9O_INVALID_FIELD_VALUEThe filters object referenced an unsupported path; only id, contentHash, source.<key>, and metadata.<key> are allowed.
403K9O_RESERVED_COLUMN_WRITE_PROHIBITEDVector deletes are only allowed in an extension's own '_'-prefixed derived collection; this collection name is not one.
403K9O_ACCESS_DENIEDThe caller is not a member of this project.
403K9O_EXTENSION_PERMISSION_DENIEDAn extension token without the vectors write grant on this collection.
403K9O_IAM_POLICY_DENIEDThe caller's project role can read vector data but not change it (reason read_only_role): only admin, editor, member and author roles write, as for storage objects.
404K9O_COLLECTION_NOT_FOUNDThis derived vector collection has never been upserted into, so there is nothing to delete.
Response body (200)
data *object
deleted *integer

How many chunks were removed, with their stored text, vectors and content hashes. 0 when nothing matched.

collection *string

The derived collection deleted from.

meta *any

Request metadata: request id, trace id, timing and cost.

cURL
curl -X POST 'https://<org>.api-<region>.k9o.io/@storefront/vectors/products/delete' \
  -H 'Authorization: Bearer $K9O_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{}'

Showing example in cURL

Request example
{}
Response example (200)
{
  "data": {
    "deleted": 0,
    "collection": "string"
  }
}

More in Data, Queries & Vectors