When to Use
- Synchronous product data extraction: A workflow triggered by a user request scrapes a product page, waits for completion, and immediately enriches the result into a database — all in one pass without intermediate state management.
- Real-time competitive intelligence: On a webhook trigger (e.g. a competitor price change alert), run a targeted scraper and process the output in the same workflow execution, feeding results into pricing decision logic.
- Data aggregation pipelines: Combine results from multiple sequential
runAndGetDatasetItems calls (each targeting a different actor or input) using a CollectionOperation node to merge extracted datasets before loading into a data warehouse.
- SEO batch analysis: For each URL in a list, run an SEO metadata actor and collect structured output (title, meta description, canonical, heading counts) in a single pass, avoiding the polling complexity of the async pattern.
- Lead enrichment: Given a list of company domains, run a web scraper actor with contact-extraction logic and return structured lead records directly into a CRM upsert workflow without intermediate storage.
How it works: This operation internally calls actor/run with waitForFinish: true, then immediately fetches the run's default dataset items. The DatasetOffset, DatasetLimit, DatasetFields, and DatasetOmit parameters control what slice of the dataset is returned. For actors producing large datasets, use DatasetLimit to return only the first N items in this call, then page through the rest with dataset/getItems using the run's defaultDatasetId.
Configuration
Connection
| Field | Required | Description |
credentialId | Required | BizFirstAI credential ID holding the Apify API token. |
baseUrl | Optional | Apify API base URL. Defaults to https://api.apify.com. |
Operation
| Field (config key) | Required | Description |
resource | Required | Must be "actor". |
operation | Required | Must be "run-and-get-dataset-items". |
actorId | Required | Actor to run. Accepts username~actor-name or raw actor ID. Supports BizFirst expressions. |
customBody | Optional | JSON string passed as actor input. If omitted, the actor uses its default input. |
timeout | Optional | Actor run timeout in seconds (1–86400). The node waits this long for the actor to finish before routing to the error port. |
memory | Optional | Memory in MB. Valid: 128, 256, 512, 1024 (default), 2048, 4096, 8192, 16384, 32768. |
build | Optional | Actor build tag. Defaults to "latest". Pin to a version tag for production stability. |
datasetOffset | Optional | Number of dataset items to skip before returning results. Default 0. Must be non-negative. |
datasetLimit | Optional | Maximum number of items to return from the dataset. Default 50. Valid range: 1–10000. |
datasetFields | Optional | Comma-separated list of field names to include in each returned item. Omit to return all fields. |
datasetOmit | Optional | Comma-separated list of field names to exclude from each returned item. Takes effect after datasetFields projection. |
Sample Configuration
{
"resource": "actor",
"operation": "run-and-get-dataset-items",
"credentialId": "apify-prod-token",
"actorId": "apify~google-search-scraper",
"customBody": "{\"queries\":[\"best CRM software 2026\",\"top project management tools\"],\"maxPagesPerQuery\":3,\"resultsPerPage\":10}",
"timeout": "180",
"memory": "1024",
"build": "latest",
"datasetOffset": "0",
"datasetLimit": "50",
"datasetFields": "title,url,description,position",
"datasetOmit": ""
}
Validation Errors
| Error | Cause |
API token is required | credentialId / apiToken is missing or empty. |
Actor ID is required | actorId is missing or empty. |
Invalid settings for actor/run-and-get-dataset-items | Internal type mismatch. Verify resource and operation values. |
APIFY_ERROR (error port) | Actor run failed, timed out, invalid actor ID, or the dataset fetch returned an error after the run. |
Output
Success Port
| Field | Type | Description |
items | array | Array of dataset item objects. Each item is a plain object whose fields are defined by the actor's output schema and filtered by datasetFields / datasetOmit. |
itemCount | number | Number of items in the items array for this response. May be less than datasetLimit if the dataset contains fewer items. |
Error Port
Routes here when the actor run fails (FAILED or TIMED-OUT status), the actor ID is invalid, API authentication fails, or the dataset fetch fails after a successful run. Output contains errorCode ("APIFY_ERROR") and message.
Sample Output
{
"items": [
{
"title": "Best CRM Software of 2026",
"url": "https://www.g2.com/categories/crm",
"description": "Find and compare the best CRM software solutions for businesses of all sizes.",
"position": 1
},
{
"title": "Top 10 CRM Platforms Compared — Forbes Advisor",
"url": "https://www.forbes.com/advisor/business/best-crm-software/",
"description": "Our experts have tested and ranked the top CRM systems available in 2026.",
"position": 2
}
],
"itemCount": 2
}
Expression Reference
| Expression | Returns |
{{ $output.apify.items }} | Full array of extracted dataset items. |
{{ $output.apify.itemCount }} | Number of items returned. |
{{ $output.apify.items[0] }} | First item in the result set. |
{{ $output.apify.items[0].url }} | URL field of the first item (field name depends on actor schema). |
{{ $output.apify.items[0].title }} | Title field of the first item. |
Node Policies & GuardRails
| Policy | Recommendation | Severity |
| API token storage | Use credentialId; never embed raw tokens. | Critical |
| Timeout required | Always set timeout. Without it, a stalled actor run blocks the workflow for up to 24 hours. | Critical |
| Dataset volume cap | Set datasetLimit to a sensible maximum (e.g. 100–500) to avoid memory pressure from very large datasets. Paginate with dataset/getItems for larger volumes. | High |
| Field projection | Use datasetFields to return only the columns your workflow needs. Large objects with many unused fields slow serialization and increase workflow execution memory. | Medium |
| Build pinning | Pin build in production so actor updates don't silently change output field names and break downstream data mapping. | Medium |
| Memory allocation | Match memory to the actor's requirements. Under-allocating causes actor crashes routed to the error port; over-allocating increases cost unnecessarily. | Medium |
| Error port handling | Connect the error port. A timed-out actor run routes here — the workflow should alert and not silently drop data. | Medium |
Examples
Google Search Results — SEO Competitive Analysis
{
"resource": "actor",
"operation": "run-and-get-dataset-items",
"credentialId": "apify-seo-token",
"actorId": "apify~google-search-scraper",
"customBody": "{\"queries\":[\"{{ $input.keyword }}\"],\"maxPagesPerQuery\":5,\"resultsPerPage\":10,\"countryCode\":\"us\",\"languageCode\":\"en\"}",
"timeout": "240",
"memory": "1024",
"datasetLimit": "50",
"datasetFields": "title,url,description,position,domain"
}
The search keyword is dynamically injected from the workflow input. The node returns the top 50 search results with only the fields needed for competitive analysis, then passes the items array to a DataMapping node for enrichment.
E-Commerce Product Price Scrape
{
"resource": "actor",
"operation": "run-and-get-dataset-items",
"credentialId": "apify-prod-token",
"actorId": "apify~cheerio-scraper",
"customBody": "{\"startUrls\":[{\"url\":\"https://shop.competitor.com/electronics\"}],\"pseudoUrls\":[{\"purl\":\"https://shop.competitor.com/product/[.*]\"}],\"maxPagesPerCrawl\":100,\"pageFunction\":\"async ({$, request}) => ({url: request.url, name: $('h1').text().trim(), price: $('.price-now').text().trim(), inStock: !$('.out-of-stock').length})\"}",
"timeout": "600",
"memory": "2048",
"datasetLimit": "500",
"datasetFields": "url,name,price,inStock",
"datasetOmit": ""
}
Crawls a competitor product catalogue with a Cheerio scraper. The custom page function extracts name, price, and stock status. Returns up to 500 products using field projection to keep the payload lean before loading into a pricing database.
Paginated Dataset via Loop
// First call — get items 0-99
{
"resource": "actor",
"operation": "run-and-get-dataset-items",
"credentialId": "apify-prod-token",
"actorId": "apify~web-scraper",
"customBody": "{ \"startUrls\": [{\"url\": \"https://data-source.com\"}] }",
"timeout": "300",
"memory": "1024",
"datasetOffset": "0",
"datasetLimit": "100"
}
// If itemCount === 100, continue pagination with dataset/getItems
// using defaultDatasetId from actor/run output and offset 100, 200, etc.
When itemCount equals datasetLimit, assume there are more pages. Use dataset/getItems with the dataset ID (obtainable via actor/run) and incrementing offset values to retrieve subsequent pages inside a Loop node.