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

# Update task schedule by ID



## OpenAPI

````yaml /openapi/public/openapi-task.json put /task/schedule/{scheduleId}
openapi: 3.0.0
info:
  title: MileApp API - Task
  version: 3.0.0
  description: MileApp API Documentation - RESTful API for field operations management.
servers:
  - url: https://apiweb.mile.app/api/v3
security:
  - bearerAuth: []
tags:
  - name: Task
    description: >-
      A task is an item of work intended for completion by an assignee. It can
      embody activities like pickups, deliveries, planning, inspections, sales
      visits, or other work-related actions within your organization. Tasks
      encompass essential attributes, including IDs, flow, time, status
      indicators, assignee information, order index, and other pertinent data.
      The content of a task is configurable based on your specified flow
      settings. For instance, tasks can serve as visits during the route
      optimization process, functioning as pivotal elements. The task can also
      represent a visit in route optimization, please follow [this
      link](#tag/Routing) to read more detail.


      **To see the details of task object, please follow [this
      link](#tag/task_model)**
  - name: Location History
    description: >-
      Location history is data that stores the user's location points that are
      sent periodically from the MileApp mobile application if the user
      activates the tracking feature. However, this endpoint can also be useful
      for integration into the user's IoT devices such as GPS or other mobile
      trackers. All location data sent can be visualized in MileApp in real time
      and makes it easier for users to monitor field activities more accurately.


      **Related Guide:** [Start Finish
      Feature](/configuration/start-trip-end-trip-feature)
  - name: Task Schedule
    description: >-
      Task Schedule is a mechanism to generate tasks according to the schedule
      that is set by you. The task schedule attributes consist of IDs,
      repetition period data (daily, weekly, etc.), flow structure, task
      content, and time of the schedule's start & end. This schedule could help
      you to set a task that will be repeated at a certain period.


      **To see the details of task schedule object, please follow [this
      link](#tag/task_schedule_model)**
  - name: Activity
    description: >-
      An Activity is a multi-step task group created from a Workflow template.
      When you create an Activity, MileApp automatically creates one parent task
      (with `taskType = activityMaster`) plus one child task (with `taskType =
      activityChild`) per Workflow step, and copies field values forward between
      steps according to the Workflow's field mappings. Activities are stored
      alongside regular tasks — the parent's `_id` is also the Activity ID, and
      its `subId` array lists every child task in Workflow-step order.


      After creation, retrieve, update, or delete an Activity through the
      standard Task endpoints using the Activity master task's ID.


      **To see the details of Activity object, please follow [this
      link](#tag/activity_model)**
paths:
  /task/schedule/{scheduleId}:
    put:
      tags:
        - Task Schedule
      summary: Update task schedule by ID
      operationId: PutTask
      parameters:
        - name: scheduleId
          in: path
          required: true
          description: |-
            Unique identifier for the task schedule that generated by system.
            **Example**: `6352736c628401059b37a2e2`
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/putRequestSchedule'
        required: true
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                type: object
                title: NetworkPutResponse
                properties:
                  status:
                    type: boolean
                    description: Status of response.
                  message:
                    description: Message of API response.
                    type: string
                  data:
                    description: Detail of object task schedule.
                    type: object
                    additionalProperties: true
                example:
                  status: true
                  message: Update data success
                  data:
                    hubId: 634e98498ce07d29474a7e29
                    name: Daily Morning Visit 2
                    periode: daily
                    flow: Visit
                    flowId: 67be687c128306111e022022
                    task:
                      receiverName: Miguel
                      address: gambir jakarta pusat
                      coordinates: ''
                      weight: '5'
                    schedules:
                      - time:
                          - '07:00'
                    startTime: '2022-11-02'
                    endTime: '2022-11-05'
                    createdBy: Pablo
                    timeSchedules:
                      - '07:00'
                    organizationId: 634e98098ce07d29474a7e22
                    updatedTime: '2022-11-01T07:28:23+00:00'
                    createdTime: '2022-11-01T07:28:23+00:00'
                    _id: 6352736c628401059b37a2e2
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Bad request - invalid parameters provided.
        '404':
          description: Data not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Data not found
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Internal server error, please contact support@mile.app.
      deprecated: false
      security:
        - bearerAuth: []
components:
  schemas:
    putRequestSchedule:
      title: task/idrequest
      example:
        hubId: 634e98498ce07d29474a7e29
        name: Daily Morning Visit 2
        periode: daily
        flow: Visit
        flowId: 67be687c128306111e022022
        task:
          receiverName: Miguel
          address: gambir jakarta pusat
          coordinates: ''
          weight: '5'
        schedules:
          - time:
              - '07:00'
        startTime: '2022-11-02'
        endTime: '2022-11-05'
      type: object
      properties:
        hubId:
          type: string
          description: >-
            Fundamental entity within an organization, serving as the central
            point for managing various operational components. Use **GET /hubs**
            endpoint to get the list of Hub IDs. **Example:**
            `634e98498ce07d29474a7e29`
        name:
          type: string
          description: >-
            The name of task schedule. User can define task schedule name with
            task's flow name combined with running time, or something else.

            **Example**: `Daily Morning Visit`
        periode:
          type: string
          description: >-
            There are 5 types of periode: `daily`, `weekly`, `monthly`,
            `byDate`, `custom`. Period of time when the task scheduler running.

            **Example:** `daily`
        flow:
          type: string
          description: >-
            The unique name of organization's flow. Use [Flow /flows
            API](#tag/Flow) to get the list of flow names.

            **Example:** `Visit`
        flowId:
          type: string
          description: >-
            The Identifier of organization's flow. Use [Flow /flows
            API](#tag/Flow) to get the list of flow ids.

            **Example:** `67be687c128306111e022022`
        startTime:
          type: string
          description: >-
            Start date of task scheduler to active. this field only available
            when periode's value is one of:

            `daily`, `weekly`, `monthly` 

            **Example:** `2022-11-02`
        endTime:
          type: string
          description: >-
            End date of task scheduler to active. this field only available when
            periode's value is one of:

            `daily`, `weekly`, `monthly` 

            **Example:** `2022-11-05`
        task:
          type: object
          description: |-
            data of task according to selected flow.
            **Example:** 
            `{`
            `'receiverName':'miguel',`
            `'coordinates':'-6.230815251,106.75684387',`
            `'address':'rawamangun jakarta timur'`
            `}`
          additionalProperties: true
        interval:
          type: integer
          minimum: 1
          maximum: 99
          nullable: true
          description: >-
            Number units of frequency between each scheduled execution. For
            example, an interval of 2 with a frequency of daily means the task
            will run every 2 days. This required when select the custom periode.

            **Example:** `daily`
        frequency:
          type: string
          enum:
            - daily
            - weekly
            - monthly
          nullable: true
          description: >-
            Specified unit of time for the scheduling interval. Determines how
            often the scheduled task will run based on the interval value.This
            required when select the custom periode.

            **Example:** `daily`
        schedules:
          type: array
          description: >-
            Object with format according to value of periode. Configuration for
            the time of task scheduler will run.

            **Example for periode of** `daily`:

            `[{`

            `'time':['07:00']`

            `}]`

            **Example for periode of** `weekly`:

            `[{`

            `'day':'sunday',`

            `'time':['07:00']`

            `}]`

            **Example for periode of** `monthly`:

            `[{`

            `'date':'1',`

            `'time':['07:00']`

            `}]`

            **Example for periode of** `byDate`:

            `[{`

            `'date':'2022-11-03',`

            `'time':['07:00']`

            `}]`
          items:
            type: object
            properties:
              day:
                type: string
                description: >-
                  Name of day in a week. `day` is required when *periode* value
                  is `weekly`.

                  **Example:** `sunday`
              time:
                type: string
                description: |-
                  Time of the task schedule will be executed.
                  **Example:** `07:00`
              date:
                type: string
                description: >-
                  Date of task schedule will be executed. `date` is required
                  when *periode* value is `monthly` or `byDate`.

                  **Example for monthly periode**: `1`

                  **Example for byDate periode**: `2022-11-03`
            required:
              - day
              - time
              - date
      required:
        - startTime
        - endTime
        - name
        - periode
        - flow
        - flowId
        - hubId
        - task
        - schedules
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Use a valid Bearer token to authenticate.

````