# Monitoring (`apify/monitoring`) Actor

This actor monitors your actors' statuses, validates their datasets' data, and displays useful information in an interactive dashboard. And if something happens, you'll get notified via email or Slack.

- **URL**: https://apify.com/apify/monitoring.md
- **Developed by:** [Apify](https://apify.com/apify) (Apify)
- **Categories:** Automation
- **Stats:** 186 total users, 1 monthly users, 0.0% runs succeeded, 18 bookmarks
- **User rating**: 4.33 out of 5 stars

## 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/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Monitoring Suite
Manually tracking the results of your actors can be complicated and tiresome.
Did they succeed? Have they produced the correct amount of results? Were those
results valid? How does the amount of results evolve over time? Luckily,
you don't need to visit Apify dashboard every day to answer those questions.

Monitoring suite is an easy to use tool that allows you to set up automated
monitoring of your actors in no time. It can be used for simple tasks and
complex projects spanning multiple actors and datasets as well.

### Is this free?
The monitoring suite can be used free of charge, but under the hood, it is
a system of actors that consume compute units. We've tried our best to make
it as efficient as possible.

##### Consumption
For average projects, it will consume single digit amounts of CUs per month. 
- Medium projects (single monitoring configuration with 5-20 daily running 
monitored tasks or actors) should consume around 10 CUs per month.
- Bigger projects (more monitoring configurations with more than 20 daily running
 tasks or actors) can monthly exceed 50 CUs+ consumption.

### Quick start
1. Click **Try for free** above to create a new task.
2. You should see the **What you want to monitor** input section open.
3. Give your monitoring suite a name under **Monitoring suite name**.
4. Under **Type of target** select if you want to monitor an actor or a task.
5. Fill the names of your actor or task under **Target name patterns**.
6. Select **Notify me whenever actor/task does not succeed**.
7. Click **Run** to enable your monitoring.

You can now sit back and relax knowing that whenever a run of your actor / task
does not succeed, a notification will be sent to your email immediately.

### How do I turn this off or make changes?
To turn off the selected monitoring suite, simply run the task with mode `Delete configuration`. It will clean
up all its resources and it will turn off all monitoring activities. You will no longer receive the notifications.
If you want to make any changes in existing configuration, just choose the `Update configuration` mode option,
make your changes and run the monitoring suite task again. 

### How it works
The monitoring suite is a complex system. Based on your configuration, it will
create [schedules](https://docs.apify.com/schedules) and [webhooks](https://docs.apify.com/webhooks)
under your account and use those to trigger actor runs. Some will make sure
that your data are correct, others will send you notifications.

All monitoring related resources will be prefixed with `monitoring-`. If you
start seeing a lot of those, it's expected. You can always turn off the monitoring
by following the [steps above](#how-do-i-turn-this-off-or-make-changes).

### Targets
The [quick start section](#quick-start) gets you up and running in no time,
but the monitoring suite is far more powerful. Let's look at targets first.

A target is something that you want to monitor. Currently, it can be:

- actor
- task
- dataset

Use the **Type of target** input field to make your selection. If you need
to monitor multiple target types, you can create multiple monitoring suites.

#### Target name patterns
In most scenarios, you can just type in the name of the target you want to monitor
into this input field and be done with it. But keep in mind that it's actually
a regular expression that matches all targets of the selected **type** under your
account. This is extremely useful to quickly select multiple targets to monitor.
It is possible to add more than one pattern which can be useful to easily select
more targets or in particular if the target type dataset is selected.
It means that all the matched datasets are going to be automatically group by
these patterns and visualization of their data will be much easier and well-arranged.


Imagine you have 3 actors, `amazon-scraper`, `google-scraper` and `results-uploader`.
By setting the pattern to `scraper`, you can quickly monitor both your scrapers.
If you want to monitor just one of them, provide the full name.

If you have actors `my-actor` and `my-actor-2` and you want to monitor only
`my-actor`, use regular expression syntax `^my-actor$` to select only the first
one.

When you have named datasets as `eshop-items-week-1`, `eshop-items-week-2` and 
`eshop-orders-week-1`, `eshop-orders-week-2` and you want to group your weekly 
data by data category, just insert two patterns as `eshop-orders` and `eshop-items`.

#### Target IDs
If for whatever reason the **Target name pattern** option does not suit you,
targets can also be specified by providing their IDs, as found in your Apify
dashboard.

### Checkers
Checkers are the bread and butter of monitoring. They collect different
kinds of information about your targets and depending on your needs, you can 
use only one or all of them in your monitoring suite. You'll receive
the information from checkers using the [notifications](#notifications).

> When actors or tasks are used as targets, checkers that operate on datasets
will automatically use their default datasets.

#### Check frequency
Each checker has a check / refresh frequency input, where you can specify
how often you want the checker to run. Critical issues with your
data are best reported immediately. The frequency input understands 
[natural cron language](https://github.com/darkeyedevelopers/natural-cron.js).
There are two basic options. Updating after each monitored run finishes or on a pre-set schedule.
Type the **Per run**, **Each run** or **Every run** to run the checker 
immediately after your actor / task run finishes. To schedule updates, use plain English sentences
such as `every day at 13:30` or `every Monday at noon` or `at 8pm every 1st day of the month`.

> Note that dataset targets can't be checked per run.

For statistical checkers, such as the dashboard, we suggest scheduling regular
(daily) updates.

#### Run status checker
Is the simplest checker we have. It doesn't even have its own section
and you turn it on by selecting "**Notify me whenever actor/task does not succeed**".
As the name suggests, it works only for actors and tasks and it will check for
runs that either `FAILED`, `TIMED-OUT` or `ABORTED`, so you'll never miss
a problem again.

#### Dashboard with statistics
With a dashboard, you can immediately see how your targets performed
in easy to read charts and with up to 60 days history. This is especially
useful to track trends in your data. Are you getting a consistent number
of results or is it declining? Was there an unexpected drop? How often
do my actors fail? The dashboard shows you all this information at a glance.

##### Dashboard data grouping
You can set `grouping` your target's data by `name patterns` if you do not want
to use default grouping by selected targets. All matched targets will then be
displayed as one data line in the dashboard charts. For example if you use the same
group of scraping actors for different countries as `actor-1-cz`, `actor-2-cz` and
`actor-1-us`, `actor-2-us` your patterns can be `cz`, `us` and all your your dashboard
will display 2 data lines - one for each state.

#### Schema checker
If you want to export your data to CSV or simply to keep high quality of data,
it's worth making sure that all the items in your dataset match a certain schema.
The schema checker uses the [`ow`](https://sindresorhus.com/ow/index.html)
syntax for its good balance of simplicity and versatility. 

Besides validating the schema of individual items, the schema checker can also
make sure that your datasets have a minimum or maximum number of items.

> The checker measures the number of "**clean**" items in the datasets.

##### Validation options
The validation options specify your constraints. They are always an array of
objects. This is to enable use of different schemas for different targets.

###### Properties
- `filter`:`string`: select targets by matching name to a pattern
- `targetIds`:`string[]`: select specific targets by ID
- `minItemCount`:`number`: minimum amount of items in dataset
- `maxItemCount`:`number`: maximum amount of items in dataset
- `schema`:`object`: validation schema for individual items

###### Examples
The following example will check whether your dataset includes at least
30 items and that all the items have a property `foo` of type `String`
and a property `bar` of type `Number`.

```javascript
[
    {
        minItemCount: 30,
        schema: {
            foo: t.string,
            bar: t.number,
        },
    },
]
````

The next example uses an override to use different validations for one target.
The target must be one of the monitoring suite targets. This is to enable
more granular validation of previously selected targets, not to add more targets
to the mix.

```javascript
[
    {
        minItemCount: 30,
        schema: { foo: t.string, bar: t.number }
    },
    {
        targetIds: ["A1b2C3d4"],
        minItemCount: 50,
        schema: { foo: t.string, bar: t.number }
    }
]
```

Using a `filter` to provide different validations for different targets.
This could be used if you selected `scraper` as your **Target name pattern**
in the first section of the input and now you need to split your scrapers
into different validation groups.

```javascript
[
    {
        filter: "scraper-hockey-",
        minItemCount: 20,
        schema: { game: t.string, goals: t.string }
    },
    {
        filter: "scraper-tennis-",
        minItemCount: 5,
        schema: { game: t.string, sets: t.array }
    }
]
```

#### Duplicates checker

When scraping large amounts of data, duplicates will inevitably occur.
This checker will let you know when that happens, and will point out the
problematic items in your datasets. When used with actors / tasks, it will
check their default datasets.

Make sure to set the **Unique keys**. The checker does not assert uniqueness
of whole dataset items, but only of values under the selected keys. For example,
if you are collecting the inventory of an online store, and the items in the
store are uniquely identified by a SKU (stock keeping unit), you would save
the SKU to your dataset under the key `sku` and then set `sku` as the Unique key.

### Notifications

Notifications are the final step of the monitoring operation. They will deliver
the information gathered by your checkers in a simple human readable format.
By default, notifications will only be sent if something goes wrong. If you
want to be notified for successful checks, select the given options under
the individual checker sections.

##### Notification grouping

When there are more actor/task runs that would finish all at once or close each other
grouping all the notification to one notification report instead of sending each
of one separately could be nice. All the notifications that should come
within 5 minutes range will be group if you set this option.

#### Email

Email notifications are the default. You don't need to do anything and
they will be automatically set up with your account email and a subject line
that will tell you your monitoring suite's status at a glance.

You can disable email notifications, use a different email or a different
subject line in the appropriate input fields.

#### Slack

For larger projects and for teams, using Slack notifications is often better
than email. Monitoring suite will send reports to a channel of your choice,
detailing the status of your suite. To set it up, you need a channel ID and
a token.

##### Channel

This is easy. To send notifications to the `notifications` channel in your
Slack workspace, use `#notifications`.

##### Token

To access the channel, you need a token. There are various tokens that you
can use and multiple approaches, depending on your Slack workspace. Visit
[the Slack authentication docs](https://api.slack.com/authentication)
and perhaps ask the owner of your workspace for help with getting the right
token.

### What's next?

- automated grouping of related datasets in dashboard
- dataset content visualisation / checks
- key-value store content checker

# Actor input Schema

## `mode` (type: `string`):

Select mode of the monitoring. Configuration run modes are Create, update and delete. Monitoring configuration will be created and all connected tools will be turned ON when 'Create configuration' is chosen. Choose 'Update configuration' mode when you already created the configuration and you just want to change some details of existing monitoring configuration. Option 'Delete configuration' turns the monitoring off and removes all the created tools and storages connected to the monitoring configuration.

## `projectName` (type: `string`):

Name of your monitoring suite. It will be used in notifications and to identify related targets in the Apify dashboard.

## `targetType` (type: `string`):

Only one type of target can be monitored by a single monitoring suite. If you want to watch more types, create more monitoring suites.

## `targetPatternList` (type: `array`):

Regular expressions that will be matched against selected actors / tasks or datasets under your Apify account. All matching targets will then be monitored by this monitoring suite. This is typically also the fastest way to select a single target. Just type its full name. Datasets are going to be automatically group by these patterns when dashboard statistics is counted for dataset target type, this can be overriden by setting the `Group targets by name patterns` option in the `Statistics dashboard` section.

## `targetList` (type: `array`):

If for whatever reason the Target name pattern option does not suit you, targets can also be specified by providing their IDs, as found in your Apify dashboard.

## `failuresCheck` (type: `boolean`):

It's the simplest checker we have. As the name suggests, it works only for actors and tasks and it will check for runs that either FAILED, TIMED-OUT or ABORTED, so you'll never miss a problem again.

## `groupNotifications` (type: `boolean`):

It groups notifications to one notification report when more notifications should come within 5 minutes range instead of sending each of them separately. This can be useful when there are more actor/task runs that would finish all at once or close each other.

## `dashboardStatistics` (type: `boolean`):

Collects statistics and produces a link to a dashboard with visualisations.

## `dashboardStatisticsFrequency` (type: `string`):

Choose how often should the dashboard statistics update. There are two basic options. Updating after each monitored run finishes or on a pre-set schedule. To update with every run, type: <code>per run</code>, <code>each run</code> or <code>every run</code>. To schedule updates, use plain English sentences such as <code>every day at 13:30</code> or <code>every Monday at noon</code> or <code>at 8pm every 1st day of the month</code>. For more examples see: <a href='https://github.com/darkeyedevelopers/natural-cron.js' target='_blank'>natural cron</a>.

## `dashboardGroupByList` (type: `array`):

Regular expressions or name patterns that will be used to group your selected targets by it's name. Named datasets are by default grouped by `targetPatternList`, setting this option will override it. All matched targets will then be displayed as one data line in the dashboard charts. For example if you use the same group of scraping actors for different countries as <code>actor-1-cz</code>, <code>actor-2-cz</code> and <code>actor-1-us</code>, <code>actor-2-us</code> your patterns can be <code>cz</code>, <code>us</code> and all your your dashboard will display 2 data lines - one for each state.

## `dashboardStatisticsNotifyOnUpdate` (type: `boolean`):

You will be notified every time when the dashboard is updated with new data.

## `validationCheck` (type: `boolean`):

Datasets or default datasets will be validated using the provided validation options.

## `validationCheckOptions` (type: `string`):

The validation options specify your constraints. They are always an array of objects. This is to enable use of different schemas for different targets. See README for details.

## `validationCheckFrequency` (type: `string`):

Choose how often will the schema checks run. There are two basic options. Updating after each monitored run finishes or on a pre-set schedule. To update with every run, type: <code>per run</code>, <code>each run</code> or <code>every run</code>. To schedule updates, use plain English sentences such as <code>every day at 13:30</code> or <code>every Monday at noon</code> or <code>at 8pm every 1st day of the month</code>. For more examples see: <a href='https://github.com/darkeyedevelopers/natural-cron.js' target='_blank'>natural cron</a>.

## `validationNotifyOnSuccess` (type: `boolean`):

Validation checking report is going to be generated and sent via notification even if your data is correct.

## `duplicationCheck` (type: `boolean`):

Datasets or default datasets will be checked for duplicates using the provided unique key.

## `duplicationCheckKeys` (type: `array`):

You can define a list of unique keys for the duplication checking. Each unique key represents the dataset field that will be compared for uniqueness. You should use something that's guaranteed to be unique among items in your dataset. Like email for people, SKU for e-shop items, GUIDs and so on.

## `duplicationCheckAllowedDuplicates` (type: `integer`):

Represents acceptable number of duplicated items occurring in the dataset. The duplication check will pass and the notification won't be sent If the number of duplicated items is lower than the allowed number of duplicates.

## `duplicationCheckFrequency` (type: `string`):

Choose how often will the check for duplicates run. There are two basic options. Updating after each monitored run finishes or on a pre-set schedule. To update with every run, type: <code>per run</code>, <code>each run</code> or <code>every run</code>. To schedule updates, use plain English sentences such as <code>every day at 13:30</code> or <code>every Monday at noon</code> or <code>at 8pm every 1st day of the month</code>. For more examples see: <a href='https://github.com/darkeyedevelopers/natural-cron.js' target='_blank'>natural cron</a>.

## `duplicationNotifyOnSuccess` (type: `boolean`):

Duplicate checking report is going to be generated and sent via notification even if your data is correct.

## `doNotSendEmail` (type: `boolean`):

If selected, email notification will not be sent.

## `emailNotification` (type: `string`):

Email address to override your account email address.

## `emailSubject` (type: `string`):

Subject to override the generated subject of your notification email.

## `slackNotification` (type: `string`):

Insert Slack channel name, such as <code>#notifications</code>

## `slackToken` (type: `string`):

Insert application or user OAuth Access Token to the <a href='https://api.slack.com/authentication' target='_blank'>Slack API</a>. Ask your workspace admin for help if needed.

## Actor input object example

```json
{
  "mode": "CREATE",
  "targetType": "ACTOR",
  "targetPatternList": [],
  "targetList": [],
  "dashboardStatisticsFrequency": "Every day at noon",
  "dashboardGroupByList": [],
  "validationCheckOptions": "/* global ow */\n// The `ow` variable represents the ow validation variable. More at https://sindresorhus.com/ow/index.html\n [\n    {\n        filter: \"us\", // matches all targets with \"us\" pattern\n        minItemCount: 5000,\n        schema: {\n            url: ow.string.url,\n            description: ow.string,\n        },\n    },\n    {\n        Ids: [\"A1b2C3d4\", \"B1A2d45\"], // matches 2 targets with specific IDs\n        schema: {\n            itemId: ow.number,\n            region: ow.string,\n        },\n    },\n]",
  "validationCheckFrequency": "Per run",
  "duplicationCheckKeys": [],
  "duplicationCheckAllowedDuplicates": 0,
  "duplicationCheckFrequency": "Per run"
}
```

# 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 = {
    "dashboardStatisticsFrequency": "Every day at noon",
    "validationCheckOptions": `/* global ow */
// The `ow` variable represents the ow validation variable. More at https://sindresorhus.com/ow/index.html
 [
    {
        filter: "us", // matches all targets with "us" pattern
        minItemCount: 5000,
        schema: {
            url: ow.string.url,
            description: ow.string,
        },
    },
    {
        Ids: ["A1b2C3d4", "B1A2d45"], // matches 2 targets with specific IDs
        schema: {
            itemId: ow.number,
            region: ow.string,
        },
    },
]`,
    "validationCheckFrequency": "Per run",
    "duplicationCheckFrequency": "Per run"
};

// Run the Actor and wait for it to finish
const run = await client.actor("apify/monitoring").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 = {
    "dashboardStatisticsFrequency": "Every day at noon",
    "validationCheckOptions": """/* global ow */
// The `ow` variable represents the ow validation variable. More at https://sindresorhus.com/ow/index.html
 [
    {
        filter: \"us\", // matches all targets with \"us\" pattern
        minItemCount: 5000,
        schema: {
            url: ow.string.url,
            description: ow.string,
        },
    },
    {
        Ids: [\"A1b2C3d4\", \"B1A2d45\"], // matches 2 targets with specific IDs
        schema: {
            itemId: ow.number,
            region: ow.string,
        },
    },
]""",
    "validationCheckFrequency": "Per run",
    "duplicationCheckFrequency": "Per run",
}

# Run the Actor and wait for it to finish
run = client.actor("apify/monitoring").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "dashboardStatisticsFrequency": "Every day at noon",
  "validationCheckOptions": "/* global ow */\\n// The `ow` variable represents the ow validation variable. More at https://sindresorhus.com/ow/index.html\\n [\\n    {\\n        filter: \\"us\\", // matches all targets with \\"us\\" pattern\\n        minItemCount: 5000,\\n        schema: {\\n            url: ow.string.url,\\n            description: ow.string,\\n        },\\n    },\\n    {\\n        Ids: [\\"A1b2C3d4\\", \\"B1A2d45\\"], // matches 2 targets with specific IDs\\n        schema: {\\n            itemId: ow.number,\\n            region: ow.string,\\n        },\\n    },\\n]",
  "validationCheckFrequency": "Per run",
  "duplicationCheckFrequency": "Per run"
}' |
apify call apify/monitoring --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=apify/monitoring",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Monitoring",
        "description": "This actor monitors your actors' statuses, validates their datasets' data, and displays useful information in an interactive dashboard. And if something happens, you'll get notified via email or Slack.",
        "version": "0.0",
        "x-build-id": "k6TruHzfACd7tEsIp"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/apify~monitoring/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-apify-monitoring",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/apify~monitoring/runs": {
            "post": {
                "operationId": "runs-sync-apify-monitoring",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/apify~monitoring/run-sync": {
            "post": {
                "operationId": "run-sync-apify-monitoring",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "projectName",
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "CREATE",
                            "UPDATE",
                            "DELETE"
                        ],
                        "type": "string",
                        "description": "Select mode of the monitoring. Configuration run modes are Create, update and delete. Monitoring configuration will be created and all connected tools will be turned ON when 'Create configuration' is chosen. Choose 'Update configuration' mode when you already created the configuration and you just want to change some details of existing monitoring configuration. Option 'Delete configuration' turns the monitoring off and removes all the created tools and storages connected to the monitoring configuration.",
                        "default": "CREATE"
                    },
                    "projectName": {
                        "title": "Monitoring suite name",
                        "pattern": "^([a-zA-Z0-9!\\-_.'()]{1,15})$",
                        "maxLength": 15,
                        "type": "string",
                        "description": "Name of your monitoring suite. It will be used in notifications and to identify related targets in the Apify dashboard."
                    },
                    "targetType": {
                        "title": "Type of target",
                        "enum": [
                            "ACTOR",
                            "TASK",
                            "NAMED_DATASET"
                        ],
                        "type": "string",
                        "description": "Only one type of target can be monitored by a single monitoring suite. If you want to watch more types, create more monitoring suites.",
                        "default": "ACTOR"
                    },
                    "targetPatternList": {
                        "title": "Target name patterns",
                        "type": "array",
                        "description": "Regular expressions that will be matched against selected actors / tasks or datasets under your Apify account. All matching targets will then be monitored by this monitoring suite. This is typically also the fastest way to select a single target. Just type its full name. Datasets are going to be automatically group by these patterns when dashboard statistics is counted for dataset target type, this can be overriden by setting the `Group targets by name patterns` option in the `Statistics dashboard` section.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "targetList": {
                        "title": "Target IDs",
                        "type": "array",
                        "description": "If for whatever reason the Target name pattern option does not suit you, targets can also be specified by providing their IDs, as found in your Apify dashboard.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "failuresCheck": {
                        "title": "Notify me whenever actor/task does not succeed",
                        "type": "boolean",
                        "description": "It's the simplest checker we have. As the name suggests, it works only for actors and tasks and it will check for runs that either FAILED, TIMED-OUT or ABORTED, so you'll never miss a problem again."
                    },
                    "groupNotifications": {
                        "title": "Group notifications",
                        "type": "boolean",
                        "description": "It groups notifications to one notification report when more notifications should come within 5 minutes range instead of sending each of them separately. This can be useful when there are more actor/task runs that would finish all at once or close each other."
                    },
                    "dashboardStatistics": {
                        "title": "Enable dashboard",
                        "type": "boolean",
                        "description": "Collects statistics and produces a link to a dashboard with visualisations."
                    },
                    "dashboardStatisticsFrequency": {
                        "title": "Update frequency",
                        "type": "string",
                        "description": "Choose how often should the dashboard statistics update. There are two basic options. Updating after each monitored run finishes or on a pre-set schedule. To update with every run, type: <code>per run</code>, <code>each run</code> or <code>every run</code>. To schedule updates, use plain English sentences such as <code>every day at 13:30</code> or <code>every Monday at noon</code> or <code>at 8pm every 1st day of the month</code>. For more examples see: <a href='https://github.com/darkeyedevelopers/natural-cron.js' target='_blank'>natural cron</a>.",
                        "default": "Every day at noon"
                    },
                    "dashboardGroupByList": {
                        "title": "Group targets by name patterns",
                        "type": "array",
                        "description": "Regular expressions or name patterns that will be used to group your selected targets by it's name. Named datasets are by default grouped by `targetPatternList`, setting this option will override it. All matched targets will then be displayed as one data line in the dashboard charts. For example if you use the same group of scraping actors for different countries as <code>actor-1-cz</code>, <code>actor-2-cz</code> and <code>actor-1-us</code>, <code>actor-2-us</code> your patterns can be <code>cz</code>, <code>us</code> and all your your dashboard will display 2 data lines - one for each state.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "dashboardStatisticsNotifyOnUpdate": {
                        "title": "Notify me on dashboard updates",
                        "type": "boolean",
                        "description": "You will be notified every time when the dashboard is updated with new data."
                    },
                    "validationCheck": {
                        "title": "Enable schema validation",
                        "type": "boolean",
                        "description": "Datasets or default datasets will be validated using the provided validation options."
                    },
                    "validationCheckOptions": {
                        "title": "Validation options",
                        "type": "string",
                        "description": "The validation options specify your constraints. They are always an array of objects. This is to enable use of different schemas for different targets. See README for details."
                    },
                    "validationCheckFrequency": {
                        "title": "Validation frequency",
                        "type": "string",
                        "description": "Choose how often will the schema checks run. There are two basic options. Updating after each monitored run finishes or on a pre-set schedule. To update with every run, type: <code>per run</code>, <code>each run</code> or <code>every run</code>. To schedule updates, use plain English sentences such as <code>every day at 13:30</code> or <code>every Monday at noon</code> or <code>at 8pm every 1st day of the month</code>. For more examples see: <a href='https://github.com/darkeyedevelopers/natural-cron.js' target='_blank'>natural cron</a>.",
                        "default": "Per run"
                    },
                    "validationNotifyOnSuccess": {
                        "title": "Send me report even if validation passes",
                        "type": "boolean",
                        "description": "Validation checking report is going to be generated and sent via notification even if your data is correct."
                    },
                    "duplicationCheck": {
                        "title": "Enable duplicate items check",
                        "type": "boolean",
                        "description": "Datasets or default datasets will be checked for duplicates using the provided unique key."
                    },
                    "duplicationCheckKeys": {
                        "title": "Unique keys",
                        "type": "array",
                        "description": "You can define a list of unique keys for the duplication checking. Each unique key represents the dataset field that will be compared for uniqueness. You should use something that's guaranteed to be unique among items in your dataset. Like email for people, SKU for e-shop items, GUIDs and so on.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "duplicationCheckAllowedDuplicates": {
                        "title": "Number of allowed duplicates",
                        "type": "integer",
                        "description": "Represents acceptable number of duplicated items occurring in the dataset. The duplication check will pass and the notification won't be sent If the number of duplicated items is lower than the allowed number of duplicates.",
                        "default": 0
                    },
                    "duplicationCheckFrequency": {
                        "title": "Check frequency",
                        "type": "string",
                        "description": "Choose how often will the check for duplicates run. There are two basic options. Updating after each monitored run finishes or on a pre-set schedule. To update with every run, type: <code>per run</code>, <code>each run</code> or <code>every run</code>. To schedule updates, use plain English sentences such as <code>every day at 13:30</code> or <code>every Monday at noon</code> or <code>at 8pm every 1st day of the month</code>. For more examples see: <a href='https://github.com/darkeyedevelopers/natural-cron.js' target='_blank'>natural cron</a>.",
                        "default": "Per run"
                    },
                    "duplicationNotifyOnSuccess": {
                        "title": "Send me report even if check passes",
                        "type": "boolean",
                        "description": "Duplicate checking report is going to be generated and sent via notification even if your data is correct."
                    },
                    "doNotSendEmail": {
                        "title": "Disable email notifications",
                        "type": "boolean",
                        "description": "If selected, email notification will not be sent."
                    },
                    "emailNotification": {
                        "title": "Custom address",
                        "type": "string",
                        "description": "Email address to override your account email address."
                    },
                    "emailSubject": {
                        "title": "Custom subject",
                        "type": "string",
                        "description": "Subject to override the generated subject of your notification email."
                    },
                    "slackNotification": {
                        "title": "Channel",
                        "type": "string",
                        "description": "Insert Slack channel name, such as <code>#notifications</code>"
                    },
                    "slackToken": {
                        "title": "Token",
                        "type": "string",
                        "description": "Insert application or user OAuth Access Token to the <a href='https://api.slack.com/authentication' target='_blank'>Slack API</a>. Ask your workspace admin for help if needed."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
