Skip to main content
The tags namespace handles tag management with smart suggestions based on domain affinity and usage frequency.

tags.list

Returns all tags for the current user’s space with save counts.
tags
Tag[]
Array of tags, each with:
const tags = useQuery(api.tags.list);
// [{ _id: "...", name: "javascript", saveCount: 42 }, ...]

tags.create

Creates a new tag.
name
string
required
Tag name. Will be normalized to lowercase.
const createTag = useMutation(api.tags.create);
const tagId = await createTag({ name: "React" });
// Creates tag with name "react" (normalized)
Tags are case-insensitive. Creating “React” and “react” results in the same tag.

tags.update

Renames an existing tag.
id
Id<'tags'>
required
The tag ID to update.
name
string
required
New tag name. Will be normalized to lowercase.

tags.remove

Deletes a tag and removes it from all saves.
id
Id<'tags'>
required
The tag ID to delete.
Orphaned tags (tags with no saves) are automatically cleaned up, so you rarely need to delete tags manually.

tags.suggestForUrl

Returns smart tag suggestions for a given URL based on domain affinity and global frequency.
url
string
required
The URL to suggest tags for.
suggestions
Tag[]
Array of up to 10 suggested tags, ordered by relevance.
const suggestions = useQuery(api.tags.suggestForUrl, {
  url: "https://dev.to/some-article",
});
// Returns tags you frequently use for dev.to links
The suggestion algorithm uses:
  • Domain affinity (3x weight) — Tags frequently used with this domain
  • Global frequency (1x weight) — Your most-used tags overall