Skip to content

Labels

Labels are free-form tags. Every post can carry many labels, and most list endpoints accept a labels filter query parameter.

Endpoints

All under /api/v1/post-labels:

  • GET /post-labels — list with search, status, page, perPage (defaults page=1, perPage=25).
  • POST /post-labels — create with { name, desc?, color?, status? }.
  • PUT /post-labels/:id — update.
  • PATCH /post-labels/:id/status — toggle.
  • DELETE /post-labels/:id — remove.

Label model

typescript
{
  user: ObjectId,
  team_id: ObjectId,
  name: string,
  desc: string,
  color: string,        // hex / named
  status: number,
  postSucceed: number,  // counter
  postFailed: number,
}

The color field is an open string; the frontend chooses the palette.

Applying labels

Posts have labels?: ObjectId[]. Apply at create time inside the POST /api/v1/posts body, or update later:

PUT /api/v1/posts/:id
{ "labels": ["<labelId1>", "<labelId2>"] }

There's no separate join collection; the array of label IDs is embedded directly on the post.

Filtering by label

Most list endpoints accept ?labels=<id1>,<id2>. The publishing UI exposes a label chip filter on the /app/publishing page.