Create a task in a task plan

Creates a complete task inside an existing task plan in a single atomic call: task + triggers + subtasks + resources. The operation is transactional: if any validation fails, nothing is persisted to the database.

Required add-on

The company must have the ADVANCED APIS add-on enabled. Without it, the endpoint returns 403.

Input parameters — Required

Sent in the request body.

ParameterTypeRequiredDescription
descriptionstringYesTask description. Minimum 3 characters, maximum 200. Cannot be empty.
id_task_type_mainintegerYesMain task type. Must exist in the company's main task type catalog.
id_group_taskintegerYesID of the task plan where the task will be created. The plan must exist and be active.
triggersarrayYesArray of triggers. Minimum 1. See structure below.

triggers structure

Each trigger must include id_task_trigger_type and the conditional fields based on its type.

FieldTypeRequiredDescription
id_task_trigger_typeintegerYes1 = DATE · 2 = READING_WHEN · 3 = READING_EVERY · 4 = EVENT
value_maindecimalConditionalDATE: > 0 (every how many periods). READING_EVERY: > 0. READING_WHEN: value to compare.
id_period_dateintegerConditionalRequired if type = 1 (DATE). Defines the frequency (days/weeks/months/years).
id_replayintegerConditionalRequired if type = 1 (DATE). 2 = repeat by number.
value_enddecimalConditionalRequired and > 0 if id_replay = 2. Number of repetitions.
id_unitintegerConditionalRequired for READING_WHEN (2) and READING_EVERY (3). Must exist in companies.units.
id_unit_operatorintegerConditionalRequired for READING_WHEN (2). Comparison operator. Must exist in companies.units_operators.
id_eventintegerConditionalEVENT (4): ID of an existing event in the company catalog, or use event_description.
event_descriptionstringConditionalEVENT (4): event description; resolved to the catalog id_event. Required if id_event is not sent.

Trigger rules

  • Only 1 DATE trigger per task.
  • No duplicate units in READING_EVERY triggers.
  • Maximum 2 READING_WHEN per unit.
  • No duplicate events in EVENT triggers.

Input parameters — Optional

ParameterTypeDefaultDescription
id_task_typeintegerClassification 1. Must exist in the task type catalog.
id_task_type_2integerClassification 2. Must exist in the task type catalog (level 2).
id_prioritiesinteger3 (MEDIUM)Task priority. Must exist in companies.priorities.
durationinteger600Estimated duration in seconds. Minimum 60.
stop_assets_secinteger0Asset downtime in seconds.
subtasksarray[]Array of subtasks. See structure below.
resourcesarray[]Array of resources. See structure below.

subtasks structure

FieldTypeRequiredDescription
descriptionstringYesSubtask description.
id_task_form_item_typeintegerOptionalField type 18. Default 1. 5 = METER_READING · 7 = DROPDOWN.
id_unitintegerConditionalRequired if type = 5 (METER_READING). Must exist in companies.units.
dropdown_optionsarrayConditionalRequired if type = 7 (DROPDOWN). Minimum 2 options.
id_task_form_item_groupintegerOptionalGroup/part. Must exist in tasks.tasks_form_items_groups.

resources structure

FieldTypeRequiredDescription
typeintegerYes1 = INVENTORY · 2 = HUMAN_RESOURCES · 3 = SERVICES
id_resourceintegerYesResource ID by type: inventory (inventories.items tool/spare part) · HR (companies.hourly_rates) · services (third_parties.service_types).
qtynumericYesQuantity. Must be > 0.
unit_costnumericYesUnit cost. Must be > 0. total_cost is calculated automatically (qty × unit_cost).

Output parameters

Successful response: HTTP 201. Data is returned inside data.

ParameterTypeDescription
idintegerID of the created task.
id_group_taskintegerID of the plan it belongs to.
descriptionstringTask description.
id_task_type_mainintegerMain type.
id_task_type / id_task_type_2integerClassifications.
id_prioritiesintegerPriority.
durationintegerDuration in seconds.
stop_assetsbooleantrue if stop_assets_sec > 0.
stop_assets_secintegerAsset downtime in seconds.
is_configuredbooleanfalse if the task requires additional configuration from the UI.
config_pendingbooleantrue when there are READING_WHEN/READING_EVERY triggers and the plan already has assets (meters need linking).
date_createstringCreation date ISO 8601.
triggersarrayCreated triggers, with generated IDs.
subtasksarrayCreated subtasks.
resourcesarrayCreated resources.

is_configured and config_pending

When the task has reading triggers (READING_WHEN or READING_EVERY) and the plan already has associated assets, the task is created successfully but returns "is_configured": false and "config_pending": true. Additional configuration is required to link meters to the plan's assets.


Errors

CodeCause
401Not authenticated · missing auth · invalid company · invalid user.
403The company does not have the ADVANCED APIS add-on, or the user lacks ADD permission on Task Plans.
400Missing body · validation failed (required fields, ranges, types) · plan not found or inactive · resource/unit/event not found in catalog.
201Task created successfully (atomic operation).
500Internal server error.

Comparison with tasks_nonscheduled_post

Aspecttasks_nonscheduled_post (unscheduled task)tasks_plan_post (this endpoint)
ContextStandalone / unscheduled taskTask inside a task plan (id_group_task)
TriggersNoYes — minimum 1 (DATE / READING_WHEN / READING_EVERY / EVENT)
SubtasksYesYes (optional)
ResourcesYesYes (optional)
Add-onADVANCED APIS

Example

Request body

{
  "description": "Monthly motor inspection",
  "id_task_type_main": 1,
  "id_group_task": 1024,
  "id_priorities": 3,
  "duration": 600,
  "stop_assets_sec": 0,
  "triggers": [
    {
      "id_task_trigger_type": 1,
      "value_main": 1,
      "id_period_date": 2,
      "id_replay": 1
    },
    {
      "id_task_trigger_type": 3,
      "id_unit": 5,
      "value_main": 500
    }
  ],
  "subtasks": [
    {
      "description": "Check oil level",
      "id_task_form_item_type": 3,
      "is_required": true
    },
    {
      "description": "Hour meter reading",
      "id_task_form_item_type": 5,
      "id_unit": 5
    }
  ],
  "resources": [
    {
      "type": 1,
      "id_resource": 312,
      "qty": 2,
      "unit_cost": 15.50
    }
  ]
}

Response 201

{
  "success": true,
  "message": "201",
  "data": {
    "id": 88210,
    "id_group_task": 1024,
    "description": "Monthly motor inspection",
    "id_task_type_main": 1,
    "id_priorities": 3,
    "duration": 600,
    "stop_assets": false,
    "stop_assets_sec": 0,
    "is_configured": true,
    "config_pending": false,
    "date_create": "2026-06-24T10:00:00",
    "triggers": [
      { "id": 4501, "id_task_trigger_type": 1 }
    ],
    "subtasks": [
      { "id": 7701, "description": "Check oil level" }
    ],
    "resources": [
      {
        "id": 9901,
        "type": 1,
        "id_resource": 312,
        "qty": 2,
        "unit_cost": 15.50,
        "total_cost": 31.00
      }
    ]
  },
  "total": 1
}

Response
200
Language
LoadingLoading…