NoteBugsDocs

API reference

Card templates

The catalogue that pre-fills a new card.

The composition rule is a single one: whatever came in the request wins, the template fills the rest. POST /api/cards with templateId behaves exactly like the form in the interface.

GET/api/templates
Role: ViewerWorkspace

The card templates of a workspace.

Query parameters

FieldTypeDescription
tenantcuidWhen absent: todos os espaços da pessoa

Request

curl -s "http://localhost:3000/api/templates?tenant=cmsp4djx60002p801o7ybpkv7" \
  -H "Authorization: Bearer $TOKEN"

Response200

[
  {
    "id": "cmttg1vps0013lf01zl4o2xmp",
    "name": "Bug reportado",
    "title": "[BUG] ",
    "description": "## Passos\n1. \n\n## Esperado\n",
    "columnId": "cmttg1vdl000tlf01uuqhz8ad",
    "tagIds": ["cmttg1vnk0011lf01q0eswms5"]
  }
]

Error responses

CodeWhen it happens
401No credential, or one that no longer holds. Send the session cookie or the Authorization: Bearer header.
403The account does not reach the resource's workspace. It is 403 and not 404 on purpose: the answer reveals no workspace.
POST/api/templates
Role: MemberWorkspace

Creates a card template.

Request body

FieldTypeDescription
tenantIdrequiredcuid
namerequiredstring
titlestring | nullThe title the card gets. It is not trimmed: the space in a prefix such as [BUG] is content.
descriptionstring | null
columnIdcuid | nullMust be a column of the TENANT set.
tagIdscuid[]The FINAL list of the template's labels.

Request

curl -s -X POST http://localhost:3000/api/templates \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "tenantId": "cmsp4djx60002p801o7ybpkv7",
    "name": "Bug reportado",
    "title": "[BUG] ",
    "description": "## Passos\n1. \n\n## Esperado\n",
    "columnId": "cmttg1vdl000tlf01uuqhz8ad",
    "tagIds": ["cmttg1vnk0011lf01q0eswms5"]
  }'

Response201

{
  "id": "cmttg1vps0013lf01zl4o2xmp",
  "name": "Bug reportado",
  "title": "[BUG] ",
  "description": "## Passos\n1. \n\n## Esperado\n",
  "columnId": "cmttg1vdl000tlf01uuqhz8ad",
  "tagIds": ["cmttg1vnk0011lf01q0eswms5"]
}

Error responses

CodeWhen it happens
401No credential, or one that no longer holds. Send the session cookie or the Authorization: Bearer header.
403The account does not reach the resource's workspace. It is 403 and not 404 on purpose: the answer reveals no workspace.
404The resource does not exist, or has already been deleted.
422A template's column must belong to the TENANT set. Translating it to the card's set at creation time is the server's job.
422The body did not pass the schema. The details field carries zod's fieldErrors and formErrors, field by field.

Empty in a template ("", null, []) means does not define, never “erase”.

PATCH/api/templates/[id]
Role: MemberWorkspace

Edits a card template.

Path parameters

FieldTypeDescription
idrequiredcuid

Request body

FieldTypeDescription
namestring
titlestring | null
descriptionstring | null
columnIdcuid | null
tagIdscuid[]

Request

curl -s -X PATCH http://localhost:3000/api/templates/cmttg1vps0013lf01zl4o2xmp \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Bug reportado (v2)" }'

Response200

{
  "id": "cmttg1vps0013lf01zl4o2xmp",
  "name": "Bug reportado (v2)",
  "title": "[BUG] ",
  "description": "## Passos\n1. \n\n## Esperado\n",
  "columnId": "cmttg1vdl000tlf01uuqhz8ad",
  "tagIds": ["cmttg1vnk0011lf01q0eswms5"]
}

Error responses

CodeWhen it happens
401No credential, or one that no longer holds. Send the session cookie or the Authorization: Bearer header.
403The account does not reach the resource's workspace. It is 403 and not 404 on purpose: the answer reveals no workspace.
404The resource does not exist, or has already been deleted.
422A template's column must belong to the TENANT set. Translating it to the card's set at creation time is the server's job.
422The body came empty. An absent field means do not touch, so a PATCH with no field would have no effect at all.
DELETE/api/templates/[id]
Role: MemberWorkspace

Deletes the template. Cards already created from it are untouched.

Path parameters

FieldTypeDescription
idrequiredcuid

Request

curl -s -X DELETE http://localhost:3000/api/templates/cmttg1vps0013lf01zl4o2xmp \
  -H "Authorization: Bearer $TOKEN"

Response200

{ "deleted": true }

Error responses

CodeWhen it happens
401No credential, or one that no longer holds. Send the session cookie or the Authorization: Bearer header.
403The account does not reach the resource's workspace. It is 403 and not 404 on purpose: the answer reveals no workspace.
404The resource does not exist, or has already been deleted.