Scheduled Jobs
Scheduled Jobs
@toothfairyai/sdk@latest…Scheduled Job Management Module Handles scheduled job CRUD operations for cron jobs and scheduling.
Accessed via client.scheduledJobs.
Methods
| Method | HTTP | Endpoint |
|---|---|---|
create | POST | POST /scheduled_job/create |
update | POST | POST /scheduled_job/update |
delete | DELETE | DELETE /scheduled_job/delete/{id} |
get | GET | GET /scheduled_job/get/{id} |
list | GET | GET /scheduled_job/list |
create
Create a new scheduled job
async create(
name: string,
options: {
description?: string;
agentId?: string;
customPromptId?: string;
forcedPrompt?: string;
schedule?: JobSchedule;
timezone?: string;
isActive?: boolean;
status?: string;
} = {}
)
Endpoint: POST /scheduled_job/create · API service
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | no | Unique identifier |
workspaceid | string | yes | Unique workspace identifier (UUID v4) |
name | string | yes | Name of the resource |
description | string | no | Detailed description of purpose and capabilities |
forcedPrompt | string | no | Forced prompt text to use for the job (max 1024 chars) |
agentID | string | yes | ID of the agent associated with this resource |
type | string | no | Type classification (free-form string identifier) |
routineConfig | string | no | Configuration for routine jobs (maxPlannedActions) |
customPromptID | string | no | ID of a custom prompt to use |
schedule | string | no | Schedule configuration object (frequency, interval, cronExpression, etc.) |
timezone | string | no | Timezone for the schedule (e.g. UTC, America/New_York) |
isActive | boolean | no | Whether the job is currently active |
status | string | no | Current status of the resource |
Allowed: ACTIVE, PAUSED, PENDING, RUNNING, FAILED, COMPLETED |
| lastRunAt | string | no | Timestamp of the last execution |
| nextRunAt | string | no | Timestamp of the next scheduled execution |
| startDate | string | no | Start date for the schedule |
| endDate | string | no | End date for the schedule |
| executionConfig | string | no | JSON-encoded execution configuration |
| notificationConfig | string | no | JSON-encoded notification configuration |
| retryConfig | string | no | JSON-encoded retry policy configuration |
| metadata | string | no | Arbitrary metadata key-value pairs (JSON) |
| createdBy | string | no | ID of the user who created this resource |
| updatedBy | string | no | ID of the user who last updated this resource |
| createdAt | string | no | Timestamp when this resource was created |
| updatedAt | string | no | Timestamp when this resource was last updated |
Response fields
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the scheduled job |
name | string | Name of the resource |
description | string | Detailed description of purpose and capabilities |
forcedPrompt | string | Forced prompt override |
type | string | Type classification (free-form string identifier) |
Allowed: TASK, ROUTINE |
| routineConfig | object | Configuration for routine jobs (maxPlannedActions) |
| agentID | string | Agent to execute |
| customPromptID | string | Custom prompt to use |
| workspaceID | string | Unique workspace identifier (UUID v4) |
| schedule | object | Schedule configuration |
| timezone | string | Timezone for scheduling |
| isActive | boolean | Whether the job is active |
| lastRunAt | string | Timestamp of the last execution |
| nextRunAt | string | Timestamp of the next scheduled execution |
| status | string | Current job status
Allowed: ACTIVE, PAUSED, DISABLED, RUNNING, SENSING, PLANNING, ACTING, COMPLETED, FAILED, PENDING |
| executionConfig | object | JSON-encoded execution configuration |
| notificationConfig | object | JSON-encoded notification configuration |
| retryConfig | object | JSON-encoded retry policy configuration |
| metadata | object | Arbitrary metadata key-value pairs (JSON) |
| startDate | string | Start date for the schedule |
| endDate | string | End date for the schedule |
| createdBy | string | ID of the user who created this resource |
| updatedBy | string | ID of the user who last updated this resource |
| createdAt | string | Timestamp when this resource was created |
| updatedAt | string | Timestamp when this resource was last updated |
Example
const result = await client.scheduledJobs.create('…');
update
Update an existing scheduled job
async update(
scheduledJobId: string,
options: {
name?: string;
description?: string;
agentId?: string;
customPromptId?: string;
forcedPrompt?: string;
schedule?: JobSchedule;
timezone?: string;
isActive?: boolean;
status?: string;
} = {}
)
Endpoint: POST /scheduled_job/update · API service
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | Unique identifier |
workspaceid | string | no | Unique workspace identifier (UUID v4) |
name | string | no | Name of the resource |
description | string | no | Detailed description of purpose and capabilities |
forcedPrompt | string | no | Forced prompt text to use for the job (max 1024 chars) |
agentID | string | no | ID of the agent associated with this resource |
type | string | no | Type classification (free-form string identifier) |
routineConfig | string | no | Configuration for routine jobs (maxPlannedActions) |
customPromptID | string | no | ID of a custom prompt to use |
schedule | string | no | Schedule configuration object (frequency, interval, cronExpression, etc.) |
timezone | string | no | Timezone for the schedule (e.g. UTC, America/New_York) |
isActive | boolean | no | Whether the job is currently active |
status | string | no | Current status of the resource |
Allowed: ACTIVE, PAUSED, PENDING, RUNNING, FAILED, COMPLETED |
| lastRunAt | string | no | Timestamp of the last execution |
| nextRunAt | string | no | Timestamp of the next scheduled execution |
| startDate | string | no | Start date for the schedule |
| endDate | string | no | End date for the schedule |
| executionConfig | string | no | JSON-encoded execution configuration |
| notificationConfig | string | no | JSON-encoded notification configuration |
| retryConfig | string | no | JSON-encoded retry policy configuration |
| metadata | string | no | Arbitrary metadata key-value pairs (JSON) |
| createdBy | string | no | ID of the user who created this resource |
| updatedBy | string | no | ID of the user who last updated this resource |
| createdAt | string | no | Timestamp when this resource was created |
| updatedAt | string | no | Timestamp when this resource was last updated |
Response
Returns the ScheduledJob object — fields documented in the create section above.
Example
const result = await client.scheduledJobs.update('agent-id');
delete
Delete a scheduled job
async delete(scheduledJobId: string): Promise<
Endpoint: DELETE /scheduled_job/delete/{id} · API service
Example
const result = await client.scheduledJobs.delete('agent-id');
get
Get a scheduled job by ID
async get(scheduledJobId: string)
Endpoint: GET /scheduled_job/get/{id} · API service
Response
Returns the ScheduledJob object — fields documented in the create section above.
Example
const result = await client.scheduledJobs.get('agent-id');