---
title: "Create Ai Task"
method: POST
path: "/ai_tasks"
tags: ["ai_tasks", "Ai Tasks"]
---

# Create Ai Task

`POST /ai_tasks`

Create Ai Task

## Response `201`

The AiTasks object.

- AiTaskEntity — AiTaskEntity model
  - `id` integer — AI Task ID.
  - `workspace_id` integer — Workspace ID. `0` means the default workspace.
  - `name` string — AI Task name.
  - `description` string — AI Task description.
  - `prompt` string — Prompt sent when this AI Task is invoked.
  - `permission_set` 'full' | 'files_only' — Permissions used by the internal API key for this AI Task. Valid values are `full` and `files_only`.
  - `path` string — Path scope used for action-triggered AI Tasks.
  - `source` string — Source glob used with `path` for action-triggered AI Tasks.
  - `disabled` boolean — If true, this AI Task will not run.
  - `trigger` 'manual' | 'daily' | 'custom_schedule' | 'action' — How this AI Task is triggered.
  - `trigger_actions` string[] — If trigger is `action`, the file action types that invoke this AI Task. Valid actions are create, copy, move, archived_delete, update, read, destroy.
  - `interval` string — If trigger is `daily`, this specifies how often to run the AI Task.
  - `recurring_day` integer — If trigger is `daily`, this selects the day number inside the chosen interval.
  - `schedule_id` integer — If trigger is `custom_schedule`, the reusable Schedule used instead of the AI Task's schedule fields.
  - `schedule_days_of_week` integer[] — If trigger is `custom_schedule`, the 0-based weekdays used by the schedule.
  - `schedule_times_of_day` string[] — Times of day in HH:MM format for the AI Task schedule.
  - `schedule_time_zone` string — Time zone used by the AI Task schedule.
  - `holiday_region` string — Optional holiday region used by the AI Task schedule.
  - `human_readable_schedule` string — Human-readable schedule description.
  - `last_run_at` string, date-time — Most recent successful invocation time.
  - `master_admin_user_id` integer — Master User ID used for AI Task invocations.
  - `created_at` string, date-time — Creation time.
  - `updated_at` string, date-time — Last update time.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `405` — Method Not Allowed
- `409` — Conflict
- `412` — Precondition Failed
- `422` — Unprocessable Entity
- `423` — Locked
- `429` — Too Many Requests

---

[API](https://skmtc.net/files/apis/files-com-api.md) · [All operations](https://skmtc.net/files/apis/files-com-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/files/files-com-api/versions/c80c746637fd/schema)
