Skip to main content
When you need to delete many artifact versions, such as to reduce storage usage, use the W&B Public API instead of the W&B App. Bulk deletions in the App can time out with a context deadline exceeded error, and the artifact list is not designed for deleting hundreds of versions. The following script deletes all artifact versions of a specified type in a project. Replace the [YOUR-TEAM] and [YOUR-PROJECT] placeholders with your own values. Use your team or username for [YOUR-TEAM], not your organization name.
Artifact deletion is destructive. When deleting source artifact versions, W&B deletes the artifact and its files. Passing delete_aliases=True enables deletion of versions with aliases such as latest, and removes those aliases.Use DRY_RUN = True first, review the printed artifact names, and only then set DRY_RUN = False.
The script deletes artifact versions, not collections. An emptied collection still appears in the project’s Artifacts tab. wandb.Api.artifact_collections() returns both source collections and link collections:
  • A source collection contains artifact versions logged to runs in the project.
  • A link collection contains references to artifact versions linked to another collection, such as a collection in a registry.
For more information, see Link an artifact version to a collection. When a version comes from a link collection, version.delete(delete_aliases=True) removes only the link. The source artifact and its files stay where they are, so that version frees no storage.

Reclaim the space

Deleted artifacts are soft-deleted first, then removed during garbage collection, so your storage usage doesn’t drop immediately. For the timing and how to verify your usage, see Why doesn’t my storage usage update after deleting runs? and Delete an artifact.
Artifacts Storage Python API