Shop It Docs
Developer ResourcescatalogTag

Tag Module API & Integration Guide

HTTP contract reference for catalog tag admin and customer/mobile APIs.

Audience: Mobile/web frontend developers
Scope: Tag discovery endpoints

Tag Module - API & Integration Guide

1. How to Read / Quick Metadata

  • Module: Catalog / Tag
  • Admin auth: JwtAuthGuard + RoleGuard + @Permissions(Tags_*)
  • Customer/mobile auth: public endpoints (@Public())
  • Surfaces:
    • Admin: /api/admin/tags
    • Customer: /api/tags
    • Mobile: /api/mobile/tags

2. High-Level Overview

Tag APIs provide label taxonomy management for admins and public lookup/list endpoints for storefront filters and discovery screens.

3. Core Concepts and Terminology

  • Canonical slug: current slug returned by API.
  • Historical slug: old slug persisted in tag_slug_history and still resolvable.

4. Route Summary

MethodPathPermission
GET/api/admin/tagsTags_READ
GET/api/admin/tags/:idTags_READ
POST/api/admin/tagsTags_CREATE
PATCH/api/admin/tags/:idTags_UPDATE
DELETE/api/admin/tags/:idTags_DELETE
GET/api/tags and /api/mobile/tagsPublic
GET/api/tags/:slug and /api/mobile/tags/:slugPublic

Route Details

List Tags

AspectDetails
EndpointGET /api/tags or /api/mobile/tags
AuthPublic
Requesttype filter, pagination
ResponseResponseDto<TagDto[]>
Errors-

Tag by Slug

AspectDetails
EndpointGET /api/tags/:slug or /api/mobile/tags/:slug
AuthPublic
Request-
ResponseResponseDto<TagDto>
Errors404 not found

5. Query Parameters

Admin list (GET /api/admin/tags)

  • Inherited from QueryDto: pagination, page, size, search
  • Filters: type
  • Sort: name | createdAt | updatedAt
  • Order: asc | desc

Customer list (GET /api/tags)

  • Inherited from QueryDto: page, size, search
  • Defaults: pagination=false, sort=name, order=asc
  • Filters: type
  • Sort: name | createdAt

6. Response Shape Examples

Tag response item

"
  "id": 7,
  "name": "Handcrafted in Nepal",
  "slug": "handcrafted-in-nepal",
  "createdAt": "2026-02-21T10:00:00.000Z",
  "updatedAt": "2026-02-21T10:00:00.000Z"
"

Create payload

"
  "name": "Handcrafted in Nepal",
  "type": "general"
"

7. Enums

  • sort enums:
    • admin: name | createdAt | updatedAt
    • customer: name | createdAt
  • order: asc | desc

8. Integration Diagram

9. Caching

PrefixUsage
catalog:tags:list:customer list cache
catalog:tag:slug:detail-by-slug cache

Admin create/update/delete invalidates list and slug cache keyspaces.

10. Error Handling

HTTPerrorCodeCondition
400TAG_INVALID_SORTUnsupported customer sort field
404TAG_NOT_FOUNDTag/id/slug not found
409TAG_NAME_EXISTSDuplicate tag name on create/update

11. Endpoint Reference + Payload Cheatsheet

11.1 Payload Cheatsheet Table (Every Endpoint)

MethodPathAuth / PermissionRequest DTO / ParamsSuccess DTONotes
GET/api/admin/tagsAdmin + Tags_READQueryTagsAdminDto "" page?, size?, pagination?, search?, type?, sort?, order? ""TagAdminListItemDto[] paginatedAdmin tag list
GET/api/admin/tags/:idAdmin + Tags_READpath: id (int)TagAdminDetailDtoAdmin tag detail
POST/api/admin/tagsAdmin + Tags_CREATEbody: CreateTagDto "" name, slug?, type ""TagAdminDetailDtoCreates new tag
PATCH/api/admin/tags/:idAdmin + Tags_UPDATEpath: id (int), body: UpdateTagDto "" name?, slug?, type? ""TagAdminDetailDtoUpdates tag
DELETE/api/admin/tags/:idAdmin + Tags_DELETEpath: id (int)"" success: true ""Deletes tag
GET/api/tagsPublicQueryTagsDto "" page?, size?, type?, sort?, order? ""TagListItemDto[]Customer tag list
GET/api/mobile/tagsPublicQueryTagsDto "" page?, size?, type?, sort?, order? ""TagListItemDto[]Mobile tag list
GET/api/tags/:slugPublicpath: slug (string)TagDetailDtoTag detail by slug (supports historical slugs)
GET/api/mobile/tags/:slugPublicpath: slug (string)TagDetailDtoMobile tag detail by slug

11.1.1 Admin List Endpoint Query Variations

MethodPathQuery ParametersNotes
GET/api/admin/tags(no params)Default: page=1, size=20, sort=createdAt, order=desc
GET/api/admin/tags?page=2&size=10Custom page and size
GET/api/admin/tags?search=handcraftedSearch by name
GET/api/admin/tags?type=bookFilter by book type
GET/api/admin/tags?type=generalFilter by general type
GET/api/admin/tags?type=newsletterFilter by newsletter type
GET/api/admin/tags?sort=name&order=ascSort by name ascending
GET/api/admin/tags?sort=updatedAt&order=descSort by last update

11.1.2 Customer/Mobile List Endpoint Query Variations

MethodPathQuery ParametersNotes
GET/api/tags(no params)Default: no pagination, sort=name, order=asc
GET/api/tags?page=1&size=10Paginated request
GET/api/tags?type=bookFilter by book type
GET/api/tags?type=generalFilter by general type
GET/api/tags?sort=name&order=ascSort by name
GET/api/tags?sort=createdAt&order=descSort by creation date

11.1.3 Tag Detail Query Variations

MethodPathPath/Query ParametersNotes
GET/api/tags/handcrafted-in-nepalslug=handcrafted-in-nepalCurrent slug lookup
GET/api/tags/old-slugslug=old-slugHistorical slug fallback
GET/api/mobile/tags/hand-paintedslug=hand-paintedMobile slug lookup

11.1.4 Create Tag Request Variations

MethodPathRequest BodyNotes
POST/api/admin/tags"" "name": "Handcrafted in Nepal", "type": "general" ""General type tag
POST/api/admin/tags"" "name": "Investment Guide", "type": "book" ""Book type tag
POST/api/admin/tags"" "name": "Weekly Tips", "type": "newsletter" ""Newsletter type tag

11.1.5 Update Tag Request Variations

MethodPathRequest BodyNotes
PATCH/api/admin/tags/1"" "name": "Updated Name" ""Update name only
PATCH/api/admin/tags/1"" "slug": "new-slug" ""Update slug
PATCH/api/admin/tags/1"" "name": "New Name", "slug": "new-slug" ""Update both name and slug

11.1.6 Tag Type Options

TypeDescriptionCommon Use Cases
generalGeneric tagsGeneral topics, broad categories
bookBook-related tagsE-book filtering
newsletterNewsletter-related tagsNewsletter categorization

11.1.7 Error Response Variations

HTTPerrorCodeMessageScenario
400TAG_INVALID_SORTInvalid sort field.Unsupported sort
404TAG_NOT_FOUNDTag not found.Invalid ID or slug
409TAG_NAME_EXISTSTag with this name already exists.Duplicate name
409TAG_SLUG_EXISTSTag with this slug already exists.Duplicate slug

11.1.8 Cache Key Patterns

Cache KeyPatternTTL (seconds)Invalidation
Customer tag listcatalog:tags:list:type:"type"-sort:"sort"-order:"order"600Admin create/update/delete
Tag detail by slugcatalog:tag:slug:"slug"600Admin update/delete
Admin tag listcatalog:tags:admin:list:pagination:"page"-size:"size"-filters...60Admin mutations

11.1.9 Rate Limit Patterns

Route FamilyKey PatternLimit
Customer listrl:catalog:tags:customer:list-ip:"ip"60 req/min
Customer detailrl:catalog:tags:customer:detail-ip:"ip"120 req/min
Admin listrl:catalog:tags:admin:list-key:"adminId"60 req/min
Admin mutationsrl:catalog:tags:admin:mutate-key:"adminId"30 req/min

11.1.10 DTO Field Reference

CreateTagDto

FieldTypeRequiredValidationNotes
namestringYes1-100 charsTag name
slugstringNo1-100 chars, URL-safeURL slug (auto-generated if not provided)

UpdateTagDto

FieldTypeRequiredValidationNotes
namestringNo1-100 charsTag name
slugstringNo1-100 chars, URL-safeURL slug

QueryTagsDto / QueryTagsAdminDto

FieldTypeRequiredNotes
pagenumberNoPage number
sizenumberNoPage size
paginationbooleanNo(admin only) Enable pagination
searchstringNo(admin only) Search query
typeenumNoFilter by tag type
sortstringNoSort field
orderstringNoSort order

12. Testing Scenarios

12.1 Suggested Test Scenarios

  • Admin creates tag with auto-generated slug from name; slug resolves correctly.
  • Admin changes tag slug; old slug still resolves via historical slug fallback.
  • Customer requests tag by historical slug; resolves to current tag via fallback.
  • Admin attempts to create duplicate tag name; receives 409 TAG_NAME_EXISTS.
  • Tag list returns in sorted order by name ascending by default.

See Also