> ## Documentation Index
> Fetch the complete documentation index at: https://docs.znift.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a new task

> Creates a task on the specified date. Returns the new task ID. The task is appended to the end of the date's task list. To log or record an already-completed activity, set isCompleted to true.



## OpenAPI

````yaml https://znift.com/api/v1/openapi.json post /api/v1/tasks
openapi: 3.1.0
info:
  title: Znift Tasks API
  version: 1.0.0
  description: >-
    Public REST API for managing Znift tasks. Designed for AI agents, CLI tools,
    and automation. Authenticate with an API key via the x-api-key header.
servers:
  - url: https://znift.com
    description: Znift Production API
security:
  - apiKey: []
paths:
  /api/v1/tasks:
    post:
      summary: Create a new task
      description: >-
        Creates a task on the specified date. Returns the new task ID. The task
        is appended to the end of the date's task list. To log or record an
        already-completed activity, set isCompleted to true.
      operationId: createTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - text
                - date
              properties:
                text:
                  type: string
                  minLength: 1
                  description: Task text
                date:
                  type: string
                  format: date
                  description: YYYY-MM-DD
                dueTime:
                  type: number
                  description: Due time as Unix timestamp in ms
                priority:
                  type: string
                  enum:
                    - high
                    - medium
                    - low
                isCompleted:
                  type: boolean
                  description: >-
                    Set to true to log a completed activity. Defaults to false
                    for planned tasks.
                timeSpent:
                  type: number
                  description: Time spent in minutes
                details:
                  type: string
                  description: Additional details
      responses:
        '201':
          description: Task created
          content:
            application/json:
              schema:
                type: object
                properties:
                  _id:
                    type: string
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: API key with znift_ prefix. Create one in Profile > API Keys.

````