Skip to content

totask Label API Documentation

Label Routes

All label-related endpoints are prefixed with /label.

Create Label

Endpoint: POST /label/create

Description: Creates a new label.

Request Body:

json
{
  "name": "Label Name",
  "color": "#FF5733"
}

Response:

  • 201 Created
    json
    {
      "_id": "label_id",
      "name": "Label Name",
      "color": "#FF5733"
    }

Get Label by ID

Endpoint: GET /label/:labelId

Description: Retrieves a label by its ID.

Response:

  • 200 OK
    json
    {
      "_id": "label_id",
      "name": "Label Name",
      "color": "#FF5733"
    }

Update Label by ID

Endpoint: PUT /label/:labelId

Description: Updates a label by its ID.

Request Body:

json
{
  "name": "Updated Label Name",
  "color": "#00FF00"
}

Response:

  • 200 OK
    json
    {
      "_id": "label_id",
      "name": "Updated Label Name",
      "color": "#00FF00"
    }

Delete Label by ID

Endpoint: DELETE /label/:labelId

Description: Deletes a label by its ID.

Response:

  • 200 OK
    json
    {
      "_id": "label_id",
      "name": "Deleted Label Name",
      "color": "#FF5733"
    }