Skip to main content
POST
/
api
/
task-types
Create Task Type
curl --request POST \
  --url https://api.example.com/api/task-types \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "projectId": 123
}
'
{
  "id": 123,
  "name": "<string>",
  "projectId": 123
}
Creates a new task type and associates it with a specific project for the authenticated user.

Authentication

Requires Bearer token authentication.

Request Body

name
string
required
The name of the task type (max 100 characters, cannot be blank)
projectId
integer
required
The ID of the project to associate this task type with

Response

id
integer
required
The unique identifier for the newly created task type
name
string
required
The name of the task type
projectId
integer
required
The ID of the project this task type belongs to

Example Request

curl -X POST https://api.example.com/api/task-types \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Bug Fix",
    "projectId": 1
  }'

Example Response

{
  "id": 5,
  "name": "Bug Fix",
  "projectId": 1
}

Error Responses

400 Bad Request
Validation failed for the request body
{
  "error": "Validation Failed",
  "message": "name: must not be blank"
}
401 Unauthorized
Authentication token is missing or invalid
{
  "error": "Unauthorized",
  "message": "Invalid or missing authentication token"
}
404 Not Found
The specified project does not exist or does not belong to the user
{
  "error": "Not Found",
  "message": "Project not found"
}

Build docs developers (and LLMs) love