# Actor Build Starter (`fjvs0283/actor-batch-builder`) Actor

Run builds for multiple actors in your account simultaneously. This can be useful when many actors in a given project have been updated. For example, the documentation might have been updated in 50 actors. This tool will help you trigger actor builds for all 50 at once.

- **URL**: https://apify.com/fjvs0283/actor-batch-builder.md
- **Developed by:** [Francisco Villarreal](https://apify.com/fjvs0283) (community)
- **Categories:** Developer tools, Automation, Open source
- **Stats:** 6 total users, 0 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Actor Batch Builder

### Table of contents

- [Introduction](#introduction)
- [Cost of usage](#cost-of-usage)
- [Input](#input)
- [Output](#output)

### Introduction

This actor provides the capability to run actor builds for multiple actors in your Apify account. This can be useful in cases where several actors have been updated and they need to be re-built to reflect the latest changes. An example would be when updating the documentation for multiple actors in a given project.

The actor calls the actor build process for each target actor via API calls. It then periodically checks for the finished builds to fetch the status and other related data.

### Cost of usage

The actor is very cost-effective to run. It will consume approximately 1-2 compute units for every 15,000 actor builds.

### Input

There are three modes for fetching the target actors to be built. The first is by providing a string for matching all actors that contain the string in their name:

```json
{
    "batchType": "actorNameContains",
    "actorNameContains": "my-actor"
}
```

The second is providing an array of actor IDs:

```json
{
    "batchType": "actorIds",
    "actorIds": [
        "abc",
        "abc",
        "abc"
    ]
}
```

The third option is for building all actors availale in the account:

```json
{
    "batchType": "all"
}
```

Note that in all three scenarios any actors in the account that do not have the required access permissions will be skipped.

### Output

The actor stores the build data along with the actor name and id for each target actor in the default dataset:

```json
[
  {
    "id": "clvyb0YFfI62KRV5F",
    "status": "SUCCEEDED",
    "startedAt": "2021-11-06T22:16:17.531Z",
    "finishedAt": "2021-11-06T22:16:29.816Z",
    "meta": {
      "origin": "API"
    },
    "actorId": "4PSW9rUi7vvhJfbLr",
    "actorName": "my-actor"
  }
]
```

The actor also saves some run statistics in the key-value stores under "STATS":

```json
{
  "total": 16,
  "failed": 0,
  "succeeded": 16,
  "requests": 56
}
```

# Actor input Schema

## `batchType` (type: `string`):

Choose how to identify the target actors to batch process. You can target actors that contain specific text as part of the actor name, target actors by their id, or target all actors in your account.

## `actorNameContains` (type: `string`):

Text included in names of target actors.

## `actorIds` (type: `array`):

Enter the ids of the target actors.

## Actor input object example

```json
{
  "batchType": "actorNameContains",
  "actorNameContains": "my-awesome",
  "actorIds": [
    "abc123",
    "abc123"
  ]
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "actorNameContains": "my-awesome",
    "actorIds": [
        "abc123",
        "abc123"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("fjvs0283/actor-batch-builder").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "actorNameContains": "my-awesome",
    "actorIds": [
        "abc123",
        "abc123",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("fjvs0283/actor-batch-builder").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "actorNameContains": "my-awesome",
  "actorIds": [
    "abc123",
    "abc123"
  ]
}' |
apify call fjvs0283/actor-batch-builder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,fjvs0283/actor-batch-builder"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/BWO1s3KQFhF1Hxrri/builds/7VopjBKQAaxPnevW8/openapi.json
