Ai Tasks

An AI Task defines a Files.com AI prompt that can run on a schedule or in response to file actions.

List Ai Tasks

SDK Method

AiTask.List();

Return Object

FilesList<AiTask>

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Additional Arguments

Example Request

using FilesCom.Models;

try
{
    var aiTaskIterator = AiTask.List();
    foreach (AiTask aiTask in aiTaskIterator.ListAutoPaging()) {
        // Operate on aiTask
    }
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Show Ai Task

SDK Method

AiTask.Find();

Return Object

AiTask

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDescription
id
int64
Required
Ai Task ID.

Example Request

using FilesCom.Models;

try
{
    var aiTask = await AiTask.Find(id);
    // Operate on aiTask
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Create Ai Task

SDK Method

AiTask.Create();

Return Object

AiTask

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDefaultDescription
description
string
AI Task description.
disabled
boolean
falseIf true, this AI Task will not run.
holiday_region
string
Optional holiday region used by the AI Task schedule.
interval
string
If trigger is daily, this specifies how often to run the AI Task.
name
string
Required
AI Task name.
path
string
""Path scope used for action-triggered AI Tasks.
permission_set
string
"full"Permissions used by the internal API key for this AI Task. Valid values are full and files_only.
Possible values: full, files_only
prompt
string
Required
Prompt sent when this AI Task is invoked.
recurring_day
int64
If trigger is daily, this selects the day number inside the chosen interval.
recurring_days
array(int64)
If trigger is daily, this selects one or more day numbers inside a week, month, quarter, or year interval.
schedule_id
int64
If trigger is custom_schedule, the reusable Schedule used instead of the AI Task's schedule fields.
schedule_days_of_week
array(int64)
If trigger is custom_schedule, the 0-based weekdays used by the schedule.
schedule_time_zone
string
Time zone used by the AI Task schedule.
schedule_times_of_day
array(string)
Times of day in HH:MM format for the AI Task schedule.
source
string
"*"Source glob used with path for action-triggered AI Tasks.
trigger
string
"manual"How this AI Task is triggered.
Possible values: manual, daily, custom_schedule, action
trigger_actions
array(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.
workspace_id
int64
0Workspace ID. 0 means the default workspace.

Example Request

using FilesCom.Models;

var parameters = new Dictionary<string, object>();
parameters.Add("name", "Summarize daily reports");
parameters.Add("prompt", "Summarize the uploaded file and identify follow-up actions.");

try
{
    var aiTask = await AiTask.Create(parameters);
    // Operate on aiTask
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Manually Run AI Task

SDK Method

aiTask.ManualRun();

Return Object

No return value.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Example Request

using FilesCom.Models;

try
{
    // Find the aiTask object by its id.
    var aiTask = await AiTask.Find(id);
    await aiTask.ManualRun();
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Update Ai Task

SDK Method

aiTask.Update();

Return Object

AiTask

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDescription
description
string
AI Task description.
disabled
boolean
If true, this AI Task will not run.
holiday_region
string
Optional holiday region used by the AI Task schedule.
interval
string
If trigger is daily, this specifies how often to run the AI Task.
name
string
AI Task name.
path
string
Path scope used for action-triggered AI Tasks.
permission_set
string
Permissions used by the internal API key for this AI Task. Valid values are full and files_only.
Possible values: full, files_only
prompt
string
Prompt sent when this AI Task is invoked.
recurring_day
int64
If trigger is daily, this selects the day number inside the chosen interval.
recurring_days
array(int64)
If trigger is daily, this selects one or more day numbers inside a week, month, quarter, or year interval.
schedule_id
int64
If trigger is custom_schedule, the reusable Schedule used instead of the AI Task's schedule fields.
schedule_days_of_week
array(int64)
If trigger is custom_schedule, the 0-based weekdays used by the schedule.
schedule_time_zone
string
Time zone used by the AI Task schedule.
schedule_times_of_day
array(string)
Times of day in HH:MM format for the AI Task schedule.
source
string
Source glob used with path for action-triggered AI Tasks.
trigger
string
How this AI Task is triggered.
Possible values: manual, daily, custom_schedule, action
trigger_actions
array(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.
workspace_id
int64
Workspace ID. 0 means the default workspace.

Example Request

using FilesCom.Models;

var parameters = new Dictionary<string, object>();
parameters.Add("description", "Summarizes files uploaded by the accounting team.");

try
{
    // Find the aiTask object by its id.
    var aiTask = await AiTask.Find(id);
    await aiTask.Update(parameters);
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Delete Ai Task

SDK Method

aiTask.Delete();

Return Object

No return value.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Example Request

using FilesCom.Models;

try
{
    // Find the aiTask object by its id.
    var aiTask = await AiTask.Find(id);
    await aiTask.Delete();
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

The AiTask Object

Some of the methods above return a AiTask object. The attributes of this object are listed below.

AttributeDescription
id
int64
AI Task ID.
workspace_id
int64
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
string
Permissions used by the internal API key for this AI Task. Valid values are full and files_only.
Possible values: full, files_only
path
string
Path scope used for action-triggered AI Tasks. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
source
string
Source glob used with path for action-triggered AI Tasks.
disabled
boolean
If true, this AI Task will not run.
trigger
string
How this AI Task is triggered.
Possible values: manual, daily, custom_schedule, action
trigger_actions
array(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
int64
If trigger is daily, this selects the day number inside the chosen interval.
recurring_days
array(int64)
If trigger is daily, this selects one or more day numbers inside a week, month, quarter, or year interval.
schedule_id
int64
If trigger is custom_schedule, the reusable Schedule used instead of the AI Task's schedule fields.
schedule_days_of_week
array(int64)
If trigger is custom_schedule, the 0-based weekdays used by the schedule.
schedule_times_of_day
array(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
date-time
Most recent successful invocation time.
master_admin_user_id
int64
Master User ID used for AI Task invocations.
created_at
date-time
Creation time.
updated_at
date-time
Last update time.