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

# Create a task

> Create a new task, optionally recurring. Requires the WRITE_TASKS scope.

Creates a task; `recurringSchedule` is required when `recurring` is daily, weekly or monthly. The store is bound to your app token server-side — never send a shop id.


## OpenAPI

````yaml POST /tasks
openapi: 3.1.0
info:
  title: Salesive Apps API — Productivity
  version: 1.0.0
  description: >-
    Manage the store's productivity resources from an installed third-party app:
    tasks (with recurrence and per-occurrence responses), notes, custom
    storefront scripts/tracking, and storefront comment replies. Every endpoint
    authenticates with an installed-app access token (prefix `app_`) and
    requires a specific OAuth scope. The target store is bound to the token
    server-side from the installation — never send a shop id.
servers:
  - url: https://api.salesive.com/api/v1
    description: Production
security:
  - AppToken: []
paths:
  /tasks:
    post:
      tags:
        - Tasks
      summary: Create a task
      description: >-
        Creates a new task for the store. Authenticate with `Authorization:
        Bearer app_<token>`. `recurringSchedule` is required when `recurring` is
        daily, weekly or monthly, and its `every` value must be an integer of at
        least 1. Requires the `WRITE_TASKS` scope and returns 403 if missing.
        The store is bound to the app token server-side from the installation —
        never send a shop id.
      operationId: createTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - title
              properties:
                title:
                  type: string
                  description: Task title.
                details:
                  type: string
                  description: Free-text task details.
                dueDate:
                  type:
                    - string
                    - 'null'
                  format: date-time
                  description: When the task is due (ISO 8601), or null.
                status:
                  type: string
                  enum:
                    - to do
                    - in progress
                    - done
                    - skipped
                  default: to do
                  description: Task status.
                recurring:
                  type: string
                  enum:
                    - none
                    - daily
                    - weekly
                    - monthly
                  default: none
                  description: Recurrence cadence.
                recurringSchedule:
                  type: object
                  description: >-
                    Recurrence schedule. Required when `recurring` is daily,
                    weekly or monthly.
                  required:
                    - every
                  properties:
                    every:
                      type: integer
                      minimum: 1
                      description: Interval between occurrences (e.g. every 2 weeks).
                    until:
                      type:
                        - string
                        - 'null'
                      format: date-time
                      description: >-
                        Date the recurrence stops (ISO 8601), or null for
                        open-ended.
                isAI:
                  type: boolean
                  default: false
                  description: Whether the task was generated by AI.
                assignees:
                  type: array
                  items:
                    type: string
                  description: User ObjectId strings assigned to the task.
            example:
              title: Restock best-sellers
              details: Reorder the top 10 SKUs before the weekend.
              dueDate: '2026-07-03T17:00:00.000Z'
              status: to do
              recurring: weekly
              recurringSchedule:
                every: 1
                until: '2026-12-31T00:00:00.000Z'
              isAI: false
              assignees:
                - 66a0c1d2e3f4a5b6c7d8e9f0
      responses:
        '201':
          description: The created task.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/EnvelopeBase'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/Task'
              example:
                status: 201
                success: true
                message: Task created
                data:
                  _id: 66c1f0a3c2d4e5f6a7b8c9d0
                  title: Restock best-sellers
                  details: Reorder the top 10 SKUs before the weekend.
                  dueDate: '2026-07-03T17:00:00.000Z'
                  status: to do
                  recurring: weekly
                  recurringSchedule:
                    every: 1
                    until: '2026-12-31T00:00:00.000Z'
                  isAI: false
                  assignees:
                    - 66a0c1d2e3f4a5b6c7d8e9f0
                  shop: 6680aabbccddeeff00112200
                  createdBy: 66a0c1d2e3f4a5b6c7d8e9f0
                  createdAt: '2026-06-21T10:30:00.000Z'
                  updatedAt: '2026-06-21T10:30:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    EnvelopeBase:
      type: object
      description: >-
        Standard Salesive response envelope. The operation-specific payload is
        carried in `data`.
      required:
        - status
        - success
        - message
      properties:
        status:
          type: integer
          description: HTTP status code, echoed in the body.
        success:
          type: boolean
          description: Whether the request succeeded.
        message:
          type: string
          description: Human-readable result message.
    Task:
      type: object
      description: A task belonging to the store.
      properties:
        _id:
          type: string
        title:
          type: string
        details:
          type: string
        dueDate:
          type:
            - string
            - 'null'
          format: date-time
        status:
          type: string
          enum:
            - to do
            - in progress
            - done
            - skipped
        recurring:
          type: string
          enum:
            - none
            - daily
            - weekly
            - monthly
        recurringSchedule:
          type:
            - object
            - 'null'
          properties:
            every:
              type: integer
              minimum: 1
            until:
              type:
                - string
                - 'null'
              format: date-time
        isAI:
          type: boolean
        assignees:
          type: array
          items:
            type: string
          description: User ObjectId strings.
        shop:
          type: string
          description: The store id (bound server-side).
        createdBy:
          type: string
          description: User id of the creator.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Envelope:
      allOf:
        - $ref: '#/components/schemas/EnvelopeBase'
        - type: object
          properties:
            data:
              description: Operation-specific payload (object, array, or null).
  responses:
    Unauthorized:
      description: Missing or invalid app access token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Envelope'
          example:
            status: 401
            success: false
            message: Authentication required
            data: null
    Forbidden:
      description: The app token is missing the OAuth scope required for this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Envelope'
          example:
            status: 403
            success: false
            message: Insufficient scope
            data: null
  securitySchemes:
    AppToken:
      type: http
      scheme: bearer
      description: >-
        Installed-app access token (prefix app_), issued by the OAuth install
        flow. The store is bound to the token server-side — never send a shop
        id.

````