ActorClient
Hierarchy
- ResourceClient
- ActorClient
Index
Properties
inheritedapifyClient
inheritedbaseUrl
inheritedhttpClient
optionalinheritedid
optionalinheritedparams
inheritedpublicBaseUrl
inheritedresourcePath
optionalinheritedsafeId
inheritedurl
Methods
build
Builds the Actor.
Creates a new build of the specified Actor version. The build compiles the Actor's source code, installs dependencies, and prepares it for execution.
Parameters
versionNumber: string
Version number or tag to build (e.g.,
'0.1','0.2','latest')options: ActorBuildOptions = {}
Build configuration options
Returns Promise<Build>
The Build object with status and build details
// Start a build and return immediatelyconst build = await client.actor('my-actor').build('0.1');console.log(`Build ${build.id} started with status: ${build.status}`);// Build and wait up to 120 seconds for it to finishconst build = await client.actor('my-actor').build('0.1', {waitForFinish: 120,tag: 'latest',useCache: true});See more at https://docs.apify.com/api/v2/act-builds-post
builds
Returns a client for managing builds of this Actor.
Returns BuildCollectionClient
A client for the Actor's build collection
See more at https://docs.apify.com/api/v2/act-builds-get
call
Starts the Actor and waits for it to finish before returning the Run object.
This is a convenience method that starts the Actor run and waits for its completion by polling the run status. It optionally streams logs to the console or a custom Log instance. By default, it waits indefinitely unless the
waitSecsoption is provided.Parameters
optionalinput: unknown
Input for the Actor. Can be any JSON-serializable value (object, array, string, number). If
contentTypeis specified in options, input should be a string or Buffer.options: ActorCallOptions = {}
Run configuration options (extends all options from start)
Returns Promise<ActorRun>
The finished Actor run object with final status (
SUCCEEDED,FAILED,ABORTED, orTIMED-OUT)// Run an Actor and wait for it to finishconst run = await client.actor('my-actor').call({ url: 'https://example.com' });console.log(`Run finished with status: ${run.status}`);console.log(`Dataset ID: ${run.defaultDatasetId}`);// Run with a timeout and log streaming to consoleconst run = await client.actor('my-actor').call({ url: 'https://example.com' },{ waitSecs: 300, log: 'default' });// Run with custom log instanceimport { Log } from '@apify/log';const log = new Log({ prefix: 'My Actor' });const run = await client.actor('my-actor').call({ url: 'https://example.com' }, { log });See more at https://docs.apify.com/api/v2/act-runs-post
defaultBuild
Returns a client for the default build of this Actor.
Makes an API call to resolve the Actor's default build, then returns a BuildClient for that build. Use the returned client to get build details, wait for the build to finish, or access its logs.
Parameters
options: BuildClientGetOptions = {}
Options for getting the default build
Returns Promise<BuildClient>
A client for the default build
// Get the default build client, then fetch build detailsconst buildClient = await client.actor('my-actor').defaultBuild();const build = await buildClient.get();console.log(`Default build status: ${build.status}`);// Wait up to 60 seconds for the default build to finishconst buildClient = await client.actor('my-actor').defaultBuild({ waitForFinish: 60 });const build = await buildClient.get();
delete
Deletes the Actor.
Returns Promise<void>
See more at https://docs.apify.com/api/v2/act-delete
get
Gets the Actor object from the Apify API.
Returns Promise<undefined | Actor>
The Actor object, or
undefinedif it does not existSee more at https://docs.apify.com/api/v2/act-get
lastRun
Returns a client for the last run of this Actor.
Provides access to the most recent Actor run, optionally filtered by status or origin.
Parameters
options: ActorLastRunOptions = {}
Options to filter the last run
Returns RunClient
A client for the last run
// Get the last successful runconst lastRun = await client.actor('my-actor').lastRun({ status: 'SUCCEEDED' }).get();See more at https://docs.apify.com/api/v2/act-runs-last-get
runs
Returns a client for managing runs of this Actor.
Returns RunCollectionClient
A client for the Actor's run collection
See more at https://docs.apify.com/api/v2/act-runs-get
start
Starts the Actor and immediately returns the Run object.
The Actor run can be configured with optional input and various options. The run starts asynchronously and this method returns immediately without waiting for completion. Use the call method if you want to wait for the Actor to finish.
Parameters
optionalinput: unknown
Input for the Actor. Can be any JSON-serializable value (object, array, string, number). If
contentTypeis specified in options, input should be a string or Buffer.options: ActorStartOptions = {}
Run configuration options
Returns Promise<ActorRun>
The Actor run object with status, usage, and storage IDs
// Start Actor with simple inputconst run = await client.actor('my-actor').start({ url: 'https://example.com' });console.log(`Run started with ID: ${run.id}, status: ${run.status}`);// Start Actor with specific build and memoryconst run = await client.actor('my-actor').start({ url: 'https://example.com' },{ build: '0.1.2', memory: 512, timeout: 300 });See more at https://docs.apify.com/api/v2/act-runs-post
update
Updates the Actor with specified fields.
Parameters
newFields: Partial<Pick<Actor, name | description | isPublic | isDeprecated | seoTitle | seoDescription | title | restartOnError | versions | categories | defaultRunOptions | actorStandby | actorPermissionLevel | taggedBuilds>>
Fields to update in the Actor
Returns Promise<Actor>
The updated Actor object
See more at https://docs.apify.com/api/v2/act-put
version
Returns a client for a specific version of this Actor.
Parameters
versionNumber: string
Version number (e.g., '0.1', '1.2.3')
Returns ActorVersionClient
A client for the specified Actor version
See more at https://docs.apify.com/api/v2/act-version-get
versions
Returns a client for managing versions of this Actor.
Returns ActorVersionCollectionClient
A client for the Actor's version collection
See more at https://docs.apify.com/api/v2/act-versions-get
webhooks
Returns a client for managing webhooks associated with this Actor.
Returns WebhookCollectionClient
A client for the Actor's webhook collection
See more at https://docs.apify.com/api/v2/act-webhooks-get
Client for managing a specific Actor.
Provides methods to start, call, build, update, and delete an Actor, as well as manage its versions, builds, runs, and webhooks.