Skip to main content
POST
/
api
/
tasks
Create Task
curl --request POST \
  --url https://api.example.com/api/tasks \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "<string>",
  "description": "<string>",
  "status": "<string>",
  "priority": "<string>",
  "projectId": 123,
  "taskTypeId": 123
}
'
{
  "id": 123,
  "title": "<string>",
  "description": "<string>",
  "status": "<string>",
  "priority": "<string>",
  "position": 123,
  "projectId": 123,
  "taskTypeId": 123,
  "userId": 123,
  "createdAt": "<string>",
  "updatedAt": "<string>"
}

Authentication

This endpoint requires authentication. Include a Bearer token in the Authorization header.

Request Body

title
string
required
Task title (max 200 characters). Cannot be blank.
description
string
Task description (max 5000 characters). Optional.
status
string
required
Current status of the task. Cannot be blank. Common values: TODO, IN_PROGRESS, DONE
priority
string
Priority level of the task. Optional. Common values: LOW, MEDIUM, HIGH. Defaults to MEDIUM.
projectId
integer
ID of the project to associate this task with. Optional.
taskTypeId
integer
ID of the task type. Optional.

Response

Returns the created task object with a 201 Created status.
id
integer
Unique identifier for the created task
title
string
Task title
description
string
Task description
status
string
Current status of the task
priority
string
Priority level of the task
position
integer
Position of the task for ordering purposes
projectId
integer
ID of the associated project (if any)
taskTypeId
integer
ID of the task type (if any)
userId
integer
ID of the user who owns this task
createdAt
string
ISO 8601 timestamp when the task was created
updatedAt
string
ISO 8601 timestamp when the task was last updated

Example Request

curl -X POST https://api.dailytracker.com/api/tasks \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Implement user authentication",
    "description": "Add JWT-based authentication to the API",
    "status": "TODO",
    "priority": "HIGH",
    "projectId": 5,
    "taskTypeId": 2
  }'

Example Response

{
  "id": 15,
  "title": "Implement user authentication",
  "description": "Add JWT-based authentication to the API",
  "status": "TODO",
  "priority": "HIGH",
  "position": 1,
  "projectId": 5,
  "taskTypeId": 2,
  "userId": 123,
  "createdAt": "2026-03-09T15:30:00Z",
  "updatedAt": "2026-03-09T15:30:00Z"
}

Error Responses

400 Bad Request
Validation error - missing required fields or invalid data
{
  "error": "Bad Request",
  "message": "Validation failed",
  "details": [
    "title: must not be blank",
    "status: must not be blank"
  ]
}
401 Unauthorized
Missing or invalid authentication token
{
  "error": "Unauthorized",
  "message": "Invalid or missing authentication token"
}

Build docs developers (and LLMs) love