Skip to main content
Version: Next

TaskClient

Client for managing a specific Actor task.

Tasks are pre-configured Actor runs with saved input and options. This client provides methods to start, call, update, and delete tasks, as well as manage their runs and webhooks.

Hierarchy

  • ResourceClient
    • TaskClient
const client = new ApifyClient({ token: 'my-token' });
const taskClient = client.task('my-task-id');

// Start a task
const run = await taskClient.start();

// Call a task and wait for it to finish
const finishedRun = await taskClient.call();

Index

Properties

inheritedapifyClient

apifyClient: ApifyClient

inheritedbaseUrl

baseUrl: string

inheritedhttpClient

httpClient: HttpClient

optionalinheritedid

id?: string

optionalinheritedparams

params?: Record<string, unknown>

inheritedpublicBaseUrl

publicBaseUrl: string

inheritedresourcePath

resourcePath: string

optionalinheritedsafeId

safeId?: string

inheritedurl

url: string

Methods

call

delete

  • delete(): Promise<void>

get

  • get(): Promise<undefined | Task>

getInput

lastRun

publish

  • publish(): Promise<Task>
  • Publishes the task on its public landing page, by setting isPublic through TaskClient.update.

    The task's Actor must be public and the task must have its public display configuration (publicConfig) set up first. Requires write permission to both the task and its Actor. Publishing an already published task does nothing.


    Returns Promise<Task>

    The task object.

runs

start

  • start(input, options): Promise<ActorRun>

unpublish

  • unpublish(): Promise<Task>
  • Unpublishes the task from its public landing page, by setting isPublic through TaskClient.update.

    The public display configuration (publicConfig) is preserved, so the task can be published again without re-entering it. Requires write permission to both the task and its Actor. Unpublishing a task that is not published does nothing.


    Returns Promise<Task>

    The task object.

update

  • update(newFields): Promise<Task>

updateInput

webhooks