TasksResource class is the primary way to manage Figranium tasks through the JavaScript SDK. Use it to list, create, update, version, and run tasks, as well as to generate selectors and scripts with AI assistance. Every method is typed against the Figranium API and accepts an optional RequestOptions object as its final argument.
The client-level convenience
figranium.runTask(id, input?) proxies directly to figranium.tasks.run(id, input?).Methods
list
list
Retrieve every task in the workspace.Returns an array of
- HTTP endpoint:
GET /api/tasks - Signature:
list(options?: RequestOptions): Promise<Task[]>
list-tasks.ts
Task objects.listSummaries
listSummaries
Fetch a lightweight summary of all tasks.Each
- HTTP endpoint:
GET /api/tasks/list - Signature:
listSummaries(options?: RequestOptions): Promise<{ tasks: TaskSummary[] }>
list-summaries.ts
TaskSummary contains id, name, and an optional description.save
save
Create or update a task. Pass Returns the saved
createVersion: true to snapshot the current version before saving.- HTTP endpoint:
POST /api/tasks(with?version=truewhencreateVersionis set) - Signature:
save(task: Task, options?: RequestOptions & { createVersion?: boolean }): Promise<Task>
save-task.ts
Task, including any server-generated id.touch
touch
Refresh a task’s
last_opened timestamp without changing its definition.- HTTP endpoint:
POST /api/tasks/:id/touch - Signature:
touch(id: string, options?: RequestOptions): Promise<Task>
touch-task.ts
update
update
Apply a partial patch to an existing task.
- HTTP endpoint:
PATCH /api/tasks/:id - Signature:
update(id: string, patch: Partial<Task>, options?: RequestOptions): Promise<{ id: string; updatedAt: number; status: string; task: Task }>
update-task.ts
delete
delete
Remove a task by ID.
- HTTP endpoint:
DELETE /api/tasks/:id - Signature:
delete(id: string, options?: RequestOptions): Promise<{ id: string; deleted: boolean; message?: string }>
delete-task.ts
versions
versions
List all saved versions for a task.
- HTTP endpoint:
GET /api/tasks/:id/versions - Signature:
versions(id: string, options?: RequestOptions): Promise<{ versions: TaskVersion[] }>
list-versions.ts
version
version
Retrieve a specific version snapshot.
- HTTP endpoint:
GET /api/tasks/:id/versions/:versionId - Signature:
version(id: string, versionId: string, options?: RequestOptions): Promise<{ snapshot: Task; metadata: { id: string; timestamp: number } }>
get-version.ts
clearVersions
clearVersions
Delete all stored versions for a task.
- HTTP endpoint:
POST /api/tasks/:id/versions/clear - Signature:
clearVersions(id: string, options?: RequestOptions): Promise<{ success: boolean }>
clear-versions.ts
rollback
rollback
Restore a task to a previous version snapshot.
- HTTP endpoint:
POST /api/tasks/:id/rollback - Signature:
rollback(id: string, versionId: string, options?: RequestOptions): Promise<Task>
rollback-task.ts
generateSelector
generateSelector
Use AI to generate a CSS selector for a specific action inside a task.
- HTTP endpoint:
POST /api/tasks/generate-selector - Signature:
generateSelector(input: { task: Task; actionIndex: number; prompt: string }, options?: RequestOptions): Promise<{ selector: string }>
generate-selector.ts
generateScript
generateScript
Generate a JavaScript extraction script from a natural language description.
- HTTP endpoint:
POST /api/tasks/generate-script - Signature:
generateScript(description: string, options?: RequestOptions): Promise<{ script: string }>
generate-script.ts
run
run
Execute a task and return its result. This is the public execution endpoint, reachable at The generic
/tasks/:id/api.- HTTP endpoint:
POST /tasks/:id/api - Signature:
run<T = unknown>(id: string, input?: ExecuteTaskOptions, options?: RequestOptions): Promise<ExecutionResult<T>>
run-task.ts
T parameter types result.data. The input object accepts variables, taskVariables, webhookUrl, and runId. For more about execution results and streaming, see ExecutionsResource. To learn about task variables and runtime substitution, see Variables and Actions.