Portal Community

When to Use

Status filter: The status config key (mapped to StatusFilter) accepts any valid Apify run status: READY, RUNNING, SUCCEEDED, FAILED, TIMED-OUT, ABORTING, ABORTED. If omitted, the most recent run regardless of status is returned. Use SUCCEEDED to skip over runs that are still in progress.

Configuration

Connection

FieldRequiredDescription
credentialIdRequiredBizFirstAI credential ID holding the Apify API token.
baseUrlOptionalApify API base URL. Defaults to https://api.apify.com.

Operation

Field (config key)RequiredDescription
resourceRequiredMust be "actor".
operationRequiredMust be "get-last-run".
actorIdRequiredThe actor to query. Accepts username~actor-name format or a raw actor ID string.
statusOptionalFilter to return only the last run with this status. Accepted values: READY, RUNNING, SUCCEEDED, FAILED, TIMED-OUT, ABORTING, ABORTED. If omitted, the absolute last run is returned regardless of status.

Sample Configuration

{
  "resource": "actor",
  "operation": "get-last-run",
  "credentialId": "apify-prod-token",
  "actorId": "apify~web-scraper",
  "status": "SUCCEEDED"
}

Validation Errors

ErrorCause
API token is requiredcredentialId / apiToken is missing or empty.
Actor ID is requiredactorId is missing or empty.
Invalid settings for actor/get-last-runInternal settings type mismatch. Verify resource is "actor" and operation is "get-last-run".
APIFY_ERROR (error port)Apify API returned an error — no runs exist for this actor, invalid actor ID, or insufficient permissions.

Output

Success Port

FieldTypeDescription
runIdstringUnique identifier for the returned run.
actorIdstringThe actor that produced this run.
runStatusstringFinal or current status of the run.
startedAtstringISO 8601 timestamp when the run started.
finishedAtstringISO 8601 timestamp when the run finished. Empty string if still in progress.
defaultDatasetIdstringDataset ID for this run's output. Pass to dataset/getItems.
defaultKeyValueStoreIdstringKey-value store ID for this run.
defaultRequestQueueIdstringRequest queue ID for this run.
usageTotalUsdnumberTotal compute cost for this run in USD.
exitCodenumberActor exit code. 0 = success, -1 if not finished.

Error Port

Routes here when no run exists for the actor (or no run matches the status filter), when the actor ID is invalid, or when the API returns any non-success status. Output contains errorCode ("APIFY_ERROR"), message, and operation ("get-last-run").

No matching run: If no run exists for the actor that matches the given status filter, Apify returns a 404 and the node routes to the error port. Always handle the error port in monitoring workflows to distinguish "no successful run yet" from a genuine API error.

Sample Output

{
  "runId": "run_7g8h9i0j1k2l",
  "actorId": "moJRLRc85AitArpNN",
  "runStatus": "SUCCEEDED",
  "startedAt": "2026-05-26T06:00:01.000Z",
  "finishedAt": "2026-05-26T06:04:37.000Z",
  "defaultDatasetId": "ds_m3n4o5p6q7r8",
  "defaultKeyValueStoreId": "kvs_s9t0u1v2w3x4",
  "defaultRequestQueueId": "rq_y5z6a7b8c9d0",
  "usageTotalUsd": 0.0284,
  "exitCode": 0
}

Expression Reference

ExpressionReturns
{{ $output.apify.runId }}Run ID of the most recent matching run.
{{ $output.apify.runStatus }}Status of the run (e.g. "SUCCEEDED").
{{ $output.apify.defaultDatasetId }}Dataset ID to pass to dataset/getItems.
{{ $output.apify.finishedAt }}Completion timestamp for audit or display.
{{ $output.apify.usageTotalUsd }}Cost of the run in USD for billing summaries.
{{ $output.apify.exitCode }}Exit code — use in an IfCondition to branch on success vs failure.

Node Policies & GuardRails

PolicyRecommendationSeverity
API token storageUse credentialId; never embed raw tokens in configuration.Critical
Error port on no-runAlways connect and handle the error port. A 404 from Apify (no matching run) routes here — treat it as a distinct case from a scraping failure.High
Status filter precisionUse status: "SUCCEEDED" in production monitoring to avoid accidentally picking up a currently-running or failed run and treating its dataset as complete output.High
Stale data riskThe last run may be days or weeks old. Add a timestamp check using finishedAt in a downstream IfCondition node to reject runs older than your acceptable data freshness window.Medium
Rate limitingAvoid calling getLastRun in tight polling loops (under 5-second intervals). Use actor-run/get with a known run ID for active-run polling instead.Medium

Examples

Scheduled Health Check — Alert on Last Run Failure

{
  "resource": "actor",
  "operation": "get-last-run",
  "credentialId": "apify-prod-token",
  "actorId": "my-org~product-price-monitor"
}

Run every 15 minutes via a scheduled trigger. An IfCondition downstream checks {{ $output.apify.runStatus }} !== "SUCCEEDED". If true, a Slack node posts an alert to the ops channel with the runId and runStatus.

Consume Last Successful Scrape Results

{
  "resource": "actor",
  "operation": "get-last-run",
  "credentialId": "apify-prod-token",
  "actorId": "apify~google-search-scraper",
  "status": "SUCCEEDED"
}

Retrieves the most recent successful run. The defaultDatasetId is then passed to a dataset/getItems node to load the search results into the workflow for further processing — without needing to store the run ID externally.

Daily Cost Report Across Multiple Actors

{
  "resource": "actor",
  "operation": "get-last-run",
  "credentialId": "apify-billing-token",
  "actorId": "{{ $output.actorLoop.currentActorId }}",
  "status": "SUCCEEDED"
}

Inside a Loop node iterating over an array of actor IDs, this node fetches the last successful run for each and accumulates usageTotalUsd values. The loop output is passed to a reporting node that generates a daily cost summary email.