Skip to main content

POST /api/tasks

Creates a new task owned by the authenticated user. Rate limit: 50 requests per hour per user.

Authentication

Authorization: Bearer <access_token>

Request Body

Send a JSON body with the following fields:
title
string
required
Task title. Must be between 1 and 200 characters.
description
string
Optional task description. Maximum 5000 characters.
status
string
default:"pending"
Initial task status. Allowed values: pending, in_progress, completed, cancelled.
priority
string
default:"medium"
Task priority. Allowed values: low, medium, high, urgent.
due_date
string
Due date in ISO 8601 format, e.g. "2024-12-31T23:59:59". Timezone suffix (Z or offset) is accepted.
tags
array of integers
List of existing tag IDs to associate with the task, e.g. [1, 2, 3].

Response

201 Created — Returns the newly created task object.
success
boolean
Always true for successful responses.
message
string
Confirmation message: "Tarea creada con exito".
data
object
The created task object. See Get Task for the full schema.

Error Responses

StatusDescription
400 Bad RequestMissing required title field, a field failed length validation, or an invalid enum value was provided for status or priority.

Example

curl -X POST "https://task-forge-gbd6h8gtg8hchve9.chilecentral-01.azurewebsites.net/api/tasks" \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Write API documentation",
    "description": "Cover all endpoints with curl examples and response schemas.",
    "priority": "high",
    "due_date": "2024-12-31T23:59:59",
    "tags": [3, 5]
  }'
Example response:
{
  "success": true,
  "message": "Tarea creada con exito",
  "data": {
    "id": 43,
    "title": "Write API documentation",
    "description": "Cover all endpoints with curl examples and response schemas.",
    "status": "pending",
    "priority": "high",
    "due_date": "2024-12-31T23:59:59",
    "completed_at": null,
    "is_overdue": false,
    "is_completed": false,
    "created_at": "2024-10-20T11:05:00",
    "updated_at": "2024-10-20T11:05:00",
    "user_id": 7,
    "tags": [
      { "id": 3, "name": "docs" },
      { "id": 5, "name": "api" }
    ]
  }
}

Build docs developers (and LLMs) love