Portal Community

When to Use

When to use Task vs Actor variant: Use actor-task/runAndGetDatasetItems when you have a saved Actor Task configured in Apify. Use actor/runAndGetDatasetItems when you need to configure the actor dynamically from workflow data, or when no task exists yet. Tasks are preferable for production pipelines because they isolate actor configuration from workflow configuration.

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-task".
operationRequiredMust be "run-and-get-dataset-items".
actorTaskIdRequiredThe Actor Task to run. Format: username~task-name or raw task ID. Find task IDs in Apify Console → Actor Tasks.
useCustomBodyOptional"true" to replace the task's stored input with customBody. Default "false".
customBodyOptionalJSON string overriding the task's input. Applied only when useCustomBody is "true".
timeoutOptionalActor run timeout override in seconds (1–86400).
memoryOptionalMemory override in MB. Valid: 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768.
buildOptionalActor build tag override.
datasetOffsetOptionalNumber of dataset items to skip. Default 0.
datasetLimitOptionalMaximum items to return from the dataset. Default 50. Valid range: 1–10000.
datasetFieldsOptionalComma-separated field names to include. Omit to return all fields.
datasetOmitOptionalComma-separated field names to exclude from each item.

Sample Configuration

{
  "resource": "actor-task",
  "operation": "run-and-get-dataset-items",
  "credentialId": "apify-prod-token",
  "actorTaskId": "my-org~weekly-lead-enrichment",
  "useCustomBody": "false",
  "timeout": "900",
  "memory": "2048",
  "datasetOffset": "0",
  "datasetLimit": "200",
  "datasetFields": "company,domain,contactEmail,linkedinUrl,employeeCount",
  "datasetOmit": ""
}

Validation Errors

ErrorCause
API token and Task ID are requiredcredentialId or actorTaskId is missing or empty.
Invalid settingsInternal type mismatch. Verify resource is "actor-task" and operation is "run-and-get-dataset-items".
APIFY_ERROR (error port)Task ID not found, actor run failed or timed out, or dataset retrieval failed after the run.

Output

Success Port

FieldTypeDescription
itemsarrayArray of dataset item objects returned by the actor task. Fields match the actor's output schema, filtered by datasetFields / datasetOmit.
itemCountnumberNumber of items in the items array. May be less than datasetLimit if the dataset has fewer items.

Error Port

Routes here when the task run fails, times out, the task ID is not found, or the dataset retrieval fails after a successful run. Output contains errorCode ("APIFY_ERROR") and message.

Sample Output

{
  "items": [
    {
      "company": "Acme Corporation",
      "domain": "acme.com",
      "contactEmail": "sales@acme.com",
      "linkedinUrl": "https://linkedin.com/company/acme",
      "employeeCount": 340
    },
    {
      "company": "TechStart Inc.",
      "domain": "techstart.io",
      "contactEmail": "hello@techstart.io",
      "linkedinUrl": "https://linkedin.com/company/techstart",
      "employeeCount": 42
    }
  ],
  "itemCount": 2
}

Expression Reference

ExpressionReturns
{{ $output.apify.items }}Full array of dataset items from the task run.
{{ $output.apify.itemCount }}Total items returned in this response.
{{ $output.apify.items[0].company }}First item's company field (field name depends on actor schema).
{{ $output.apify.items[0].domain }}Domain field of the first result.

Node Policies & GuardRails

PolicyRecommendationSeverity
API token storageUse credentialId; never embed raw tokens.Critical
Timeout requiredAlways set timeout for task runs. Tasks can have long internal timeouts — cap the BizFirstAI wait to protect workflow execution time.Critical
Dataset volume capSet datasetLimit to avoid loading excessively large datasets into workflow memory. For large volumes, use actor-task/run followed by paginated dataset/getItems calls.High
Field projectionUse datasetFields to return only needed fields. Reduces payload size and speeds up data mapping in downstream nodes.Medium
Custom body validationWhen useCustomBody is true, validate the JSON structure before the run. An invalid JSON body causes the underlying actor to fail — not a configuration validation error.Medium
Task versioningTrack task IDs in version-controlled configuration. When Apify task settings change, document the change and verify downstream field mapping remains compatible.Medium

Examples

Nightly Lead Enrichment Pipeline

{
  "resource": "actor-task",
  "operation": "run-and-get-dataset-items",
  "credentialId": "apify-prod-token",
  "actorTaskId": "my-org~nightly-lead-scrape",
  "useCustomBody": "false",
  "timeout": "1800",
  "memory": "2048",
  "datasetLimit": "500",
  "datasetFields": "company,domain,contactEmail,jobTitle,location"
}

Runs nightly at 2 AM via a BizFirstAI scheduled trigger. The task handles proxy rotation and anti-bot measures internally. The workflow receives up to 500 enriched lead records and immediately upserts them into a CRM via a subsequent Salesforce node.

Daily Competitive Price Monitoring with Date Override

{
  "resource": "actor-task",
  "operation": "run-and-get-dataset-items",
  "credentialId": "apify-prod-token",
  "actorTaskId": "my-org~competitor-price-check",
  "useCustomBody": "true",
  "customBody": "{\"date\":\"{{ $now | date('YYYY-MM-DD') }}\",\"categories\":[\"laptops\",\"monitors\",\"keyboards\"]}",
  "timeout": "600",
  "memory": "1024",
  "datasetLimit": "300",
  "datasetFields": "sku,productName,price,currency,inStock,url"
}

The task's stored configuration handles the scraping logic; the BizFirstAI workflow injects today's date and target categories dynamically. Results feed a price comparison engine that triggers alerts when competitor prices drop below a threshold.

On-Demand Market Research

{
  "resource": "actor-task",
  "operation": "run-and-get-dataset-items",
  "credentialId": "apify-prod-token",
  "actorTaskId": "my-org~market-research-task",
  "useCustomBody": "true",
  "customBody": "{{ $output.researchConfig.serializedInput }}",
  "timeout": "300",
  "memory": "1024",
  "datasetLimit": "100",
  "datasetFields": "source,headline,url,publishedAt,sentiment"
}

Triggered via a form submission where analysts configure research parameters. The upstream node serializes the form values into a JSON string passed as customBody. The node returns news articles with sentiment scores for immediate review in the workflow's output form.