> ## Documentation Index
> Fetch the complete documentation index at: https://task-social.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a task

> Creates a task for the authenticated user.



## OpenAPI

````yaml /openapi-bundled.yaml post /api/v1/tasks/create
openapi: 3.1.0
info:
  title: TaskSocial API
  version: 1.0.0
  description: REST API for TaskSocial, a social accountability application.
servers:
  - url: https://tasksocial-production.up.railway.app
    description: TaskSocial production API
security: []
tags:
  - name: Authentication
    description: User registration and authentication
  - name: Tasks
    description: Task creation and management
paths:
  /api/v1/tasks/create:
    post:
      tags:
        - Tasks
      summary: Create a task
      description: Creates a task for the authenticated user.
      operationId: createTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - title
                - description
              properties:
                title:
                  type: string
                description:
                  type: string
            example:
              title: Finish API documentation
              description: Document the TaskSocial API
      responses:
        '201':
          description: Task created successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  task:
                    $ref: '#/components/schemas/Task'
        '400':
          description: Title or description is missing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - cookieAuth: []
components:
  schemas:
    Task:
      type: object
      required:
        - title
        - description
        - author
      properties:
        title:
          type: string
        description:
          type: string
        status:
          type: string
          enum:
            - pending
            - completed
          default: pending
        author:
          type: string
          description: MongoDB ObjectId of the task owner.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        message:
          type: string
  responses:
    Unauthorized:
      description: Authentication is required or the authentication token is invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    cookieAuth:
      type: apiKey
      in: cookie
      name: tokenName
      description: >
        JWT authentication cookie. The server sets this cookie after a
        successful login. You do not need to generate or provide an API key
        manually. Use the login endpoint first, then the browser or HTTP client
        sends this cookie with protected requests.

````