Delete captured data | Viam Documentation

Delete captured data

You can delete captured data through the Viam app, the CLI, or the SDK. The SQL and MQL query editor is read-only: you cannot run DELETE, DROP TABLE, or any write operation through it.

Retention policies can also auto-delete data in the cloud after a configured number of days, without anyone running a delete operation.

Delete captured data

Delete tabular data older than a number of days:

viam data delete tabular --org-id=<org-id> --delete-older-than-days=30

If the organization has a hot data store, matching data is deleted from that store as well.

Caution

--delete-older-than-days=0 deletes all tabular data in the organization. The CLI tabular delete has no component or location filter: it applies to the entire org.

Delete binary data within a time range:

viam data delete binary \
  --org-ids=<org-id> \
  --start=2026-01-01T00:00:00Z \
  --end=2026-02-01T00:00:00Z

The binary delete command requires --org-ids, --start, and --end. Narrow further with optional filters for location, machine, part, component, MIME type, and bounding-box label. For the full list, see the viam data delete binary CLI reference.

Delete tabular data older than a number of days:

deleted = await data_client.delete_tabular_data(
    organization_id="<org-id>",
    delete_older_than_days=30,
)

Delete binary data matching a filter:

from viam.utils import create_filter

my_filter = create_filter(
    component_name="camera-1",
    organization_ids=["<org-id>"],
)

deleted = await data_client.delete_binary_data_by_filter(my_filter)

Delete specific binary items by ID:

deleted = await data_client.delete_binary_data_by_ids(
    ["binary-data-id-1", "binary-data-id-2"],
)

Delete tabular data older than a number of days:

deleted, err := dataClient.DeleteTabularData(ctx, "<org-id>", 30, nil)

Delete binary data matching a filter:

filter := &app.Filter{
    ComponentName:   "camera-1",
    OrganizationIDs: []string{"<org-id>"},
}

deleted, err := dataClient.DeleteBinaryDataByFilter(ctx, filter)

Delete specific binary items by ID:

deleted, err := dataClient.DeleteBinaryDataByIDs(
    ctx,
    []string{"binary-data-id-1", "binary-data-id-2"},
)

See the data client API for the full set of methods and signatures.