> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-style-guide-models-artifacts-20260603-165211.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Update an existing artifact while a run is active or using only the Public API.

# Update an artifact

Update the `description`, `metadata`, and `alias` of an existing artifact.

<Note>
  **When to use wandb.Artifact.save() or wandb.Run.log\_artifact()**

  * Use `Artifact.save()` to update an existing artifact without starting a new run.
  * Use `wandb.Run.log_artifact()` to create a new artifact and associate it with a specific run.
</Note>

Use the W\&B Public API ([`wandb.Api`](/models/ref/python/public-api/api)) to update an artifact outside of a run, or use the [`wandb.Artifact`](/models/ref/python/experiments/artifact) class while a run is active.

<Warning>
  You can't update the alias of an artifact linked to a collection in the W\&B Registry.
</Warning>

<Tabs>
  <Tab title="During a run">
    The following code example shows how to update the description of an artifact with the [`wandb.Artifact`](/models/ref/python/experiments/artifact) API:

    ```python theme={null}
    import wandb

    with wandb.init(project="[EXAMPLE]") as run:
        artifact = run.use_artifact("[ARTIFACT-NAME]:[ALIAS]")
        artifact.description = "[DESCRIPTION]"
        artifact.save()
    ```
  </Tab>

  <Tab title="W&B Public API">
    The following example updates an artifact with [`wandb.Api`](/models/ref/python/public-api/api):

    ```python theme={null}
    import wandb

    api = wandb.Api()

    artifact = api.artifact("entity/project/artifact:alias")

    # Update the description
    artifact.description = "My new description"

    # Selectively update metadata keys
    artifact.metadata["oldKey"] = "new value"

    # Replace the metadata entirely
    artifact.metadata = {"newKey": "new value"}

    # Add an alias
    artifact.aliases.append("best")

    # Remove an alias
    artifact.aliases.remove("latest")

    # Replace the aliases
    artifact.aliases = ["replaced"]

    # Persist all artifact modifications
    artifact.save()
    ```

    For more information, see the W\&B [Artifact API](/models/ref/python/experiments/artifact).
  </Tab>

  <Tab title="With collections">
    You can also update an artifact collection the same way as a singular artifact. The following example renames a collection and updates its description:

    ```python theme={null}
    import wandb
    with wandb.init(project="[EXAMPLE]") as run:
        api = wandb.Api()
        artifact = api.artifact_collection(type="[TYPE-NAME]", collection="[COLLECTION-NAME]")
        artifact.name = "[NEW-COLLECTION-NAME]"
        artifact.description = "[COLLECTION-DESCRIPTION]"
        artifact.save()
    ```

    For more information, see the [Artifacts Collection](/models/ref/python/public-api/api) reference.
  </Tab>
</Tabs>
