# `HuggingfaceClient.Hub.Tags`
[🔗](https://github.com/huggingface/huggingface_client/blob/v0.1.0/lib/huggingface_client/hub/repositories/tags.ex#L1)

Manage git tags and list refs (branches/tags) on HuggingFace repositories.

## Example

    # List all refs (branches + tags) for a model
    {:ok, refs} = HuggingfaceClient.list_repo_refs("gpt2")

    # Create a tag
    :ok = HuggingfaceClient.create_tag("my-org/my-model",
      tag: "v1.0.0",
      message: "Initial release",
      revision: "main",
      access_token: "hf_..."
    )

    # Delete a tag
    :ok = HuggingfaceClient.delete_tag("my-org/my-model",
      tag: "old-tag",
      access_token: "hf_..."
    )

# `create_tag`

```elixir
@spec create_tag(
  String.t(),
  keyword()
) :: :ok | {:error, Exception.t()}
```

Creates a new tag on a repository.

## Options

- `:tag` — name of the tag (required)
- `:revision` — commit SHA, branch name, or existing tag to tag from (default: `"main"`)
- `:message` — optional tag message (creates annotated tag if provided)
- `:type` — repo type
- `:access_token`

## Example

    :ok = HuggingfaceClient.create_tag("my-org/my-model",
      tag: "v2.0.0",
      revision: "main",
      message: "Version 2.0 release",
      access_token: "hf_..."
    )

# `delete_tag`

```elixir
@spec delete_tag(
  String.t(),
  keyword()
) :: :ok | {:error, Exception.t()}
```

Deletes a tag from a repository.

## Options

- `:tag` — name of the tag to delete (required)
- `:type` — repo type
- `:access_token`

## Example

    :ok = HuggingfaceClient.delete_tag("my-org/my-model",
      tag: "old-checkpoint",
      access_token: "hf_..."
    )

# `list_repo_refs`

```elixir
@spec list_repo_refs(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, Exception.t()}
```

Lists all branches and tags for a repository.

Returns a map with `"branches"` and `"tags"` keys.

## Example

    {:ok, refs} = HuggingfaceClient.list_repo_refs("gpt2")
    IO.puts("Branches: #{length(refs["branches"])}")
    Enum.each(refs["tags"], fn t -> IO.puts("Tag: #{t["name"]} @ #{t["target_commit"]}") end)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
