Skip to main content
Version: Next

BuildClient

Client for managing a specific Actor build.

Builds are created when an Actor is built from source code. This client provides methods to get build details, wait for the build to finish, abort it, and access its logs.

@example
const client = new ApifyClient({ token: 'my-token' });
const buildClient = client.build('my-build-id');

// Get build details
const build = await buildClient.get();

// Wait for the build to finish
const finishedBuild = await buildClient.waitForFinish();

// Access build logs
const log = await buildClient.log().get();
@see

Hierarchy

  • ResourceClient
    • BuildClient

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

abort

delete

  • delete(): Promise<void>

get

  • get(options): Promise<undefined | Build>
  • Gets the Actor build object from the Apify API.

    @see
    @example
    // Get build status immediately
    const build = await client.build('build-id').get();
    console.log(`Status: ${build.status}`);

    // Wait up to 60 seconds for build to finish
    const build = await client.build('build-id').get({ waitForFinish: 60 });

    Parameters

    Returns Promise<undefined | Build>

    The Build object, or undefined if it does not exist

getOpenApiDefinition

log

waitForFinish

  • waitForFinish(options): Promise<Build>
  • Waits for the Actor build to finish and returns the finished Build object.

    The promise resolves when the build reaches a terminal state (SUCCEEDED, FAILED, ABORTED, or TIMED-OUT). If waitSecs is provided and the timeout is reached, the promise resolves with the unfinished Build object (status will be RUNNING or READY). The promise is NOT rejected based on build status.

    Unlike the waitForFinish parameter in get, this method can wait indefinitely by polling the build status. It uses the waitForFinish parameter internally (max 60s per call) and continuously polls until the build finishes or the timeout is reached.

    This is useful when you need to immediately start a run after a build finishes.

    @example
    // Wait indefinitely for build to finish
    const build = await client.build('build-id').waitForFinish();
    console.log(`Build finished with status: ${build.status}`);

    // Start a run immediately after build succeeds
    const build = await client.build('build-id').waitForFinish();
    if (build.status === 'SUCCEEDED') {
    const run = await client.actor('my-actor').start();
    }

    Parameters

    Returns Promise<Build>

    The Build object (finished or still building if timeout was reached)