# Best Time to Post: Instagram, TikTok & YouTube Analyzer (`nerolabs/best-time-to-post`) Actor

Ranks the best weekday and hour to post for each Instagram, TikTok, YouTube, X or Facebook account from post scraper rows, a CSV or a Sheet, in your time zone, with a heatmap. No scraping or login. Charged per account analysed. Agent-ready: MCP, x402.

- **URL**: https://apify.com/nerolabs/best-time-to-post.md
- **Developed by:** [Adam Pearce](https://apify.com/nerolabs) (community)
- **Categories:** Social media, Marketing, Automation
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 account analyseds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Best Time to Post: Instagram, TikTok & YouTube Analyzer

**When should this account post?** Give this actor the post rows your Instagram, TikTok, YouTube, X or Facebook scraper already returned (a dataset, CSV or Google Sheet) and it ranks the **weekday and hour slots when that account's posts did best**, in your audience's time zone. Not a generic "post at 11am on Tuesday" blog chart: the answer comes from the account's own posts, or from your rivals' posts.

No scraping, no login, no AI fees: it is maths on rows you already have, so it runs in seconds for a few cents.

### Who uses it

- **Social media managers and agencies**: one run for every client account, a best-times line per client for the monthly report.
- **Creators**: scrape your own last 100 posts, see the 3 slots where you do best and the slot where you post most but do worst.
- **Brands studying rivals**: scrape 10 competitors, get a free all-accounts row with the best times for the whole niche.
- **AI agents and n8n or Make flows**: run a scraper, then ask "when should we post?" in one call.

### How it works (plain words)

1. Each post is compared with the **same account's normal** (the median of its posts). A post at 2.0x did twice the account's usual engagement. That is why a small and a big account can be pooled fairly.
2. Each post goes into a **weekday and hour block** (3 hours by default) in your time zone.
3. Each slot gets a **score**: the median of its posts, pulled towards normal by three imaginary average posts, so a slot with two lucky posts cannot beat a slot with eight good ones. Only slots with 3+ posts are ranked.
4. Days on their own and hour blocks on their own are ranked the same way, because they hold more posts and are steadier than single slots.

Pinned posts (old hits kept on top of the profile) are left out by default.

### What you get for each account

| Field | What it means |
|---|---|
| `bestSlot`, `bestSlotLift` | The best weekday and hour block, and how many times the account's normal its posts got there |
| `bestSlots` | The top 3 slots with posts, median lift and score |
| `bestDay`, `bestDays` | Days ranked on their own |
| `bestHourBlock`, `bestHours` | Hour blocks ranked on their own (any day) |
| `mostUsedSlot`, `mostUsedSlotLift` | When the account posts most now, and how that slot does: the "move from here" slot |
| `worstSlot`, `worstSlotLift` | The weakest ranked slot |
| `confidence` | `high`, `medium` or `low`, from posts with a time and posts in the best slot |
| `reason` | One plain paragraph with all of the above |
| `heatmap`, `heatmapPosts` | 7 days x hour blocks: median lift where a cell has enough posts, and post counts per cell |
| `postsAnalysed`, `postsWithTime`, `postsPerWeek`, `baselineMetric`, `followers` | The sample behind the answer |

When 2 or more accounts are analysed, one **free all-accounts row** (`scope: "all_accounts"`) pools them all.

### Example output (duolingo's last 50 TikToks, New York time)

```json
{
  "account": "duolingo",
  "platform": "tiktok",
  "timeZone": "America/New_York",
  "postsAnalysed": 49,
  "postsPerWeek": 6.73,
  "bestSlot": "Fri 09:00-12:00",
  "bestSlotLift": 4.32,
  "bestDay": "Thu",
  "bestHourBlock": "15:00-18:00",
  "bestHourLift": 1.64,
  "mostUsedSlot": "Thu 12:00-15:00",
  "mostUsedSlotLift": 1.39,
  "worstSlot": "Thu 09:00-12:00",
  "worstSlotLift": 0.26,
  "confidence": "high",
  "reason": "Best slot: Fri 09:00-12:00 (America/New_York). Posts there got 4.32x the normal engagement (4 posts). Best day Thu (1.26x). Best hours 15:00-18:00 on any day (1.64x). Most posts go out Thu 12:00-15:00 (6 posts, 1.39x). Weakest: Thu 09:00-12:00 (0.26x). Confidence high.",
  "bestSlots": [
    { "slot": "Fri 09:00-12:00", "posts": 4, "medianLift": 4.32, "score": 2.31 },
    { "slot": "Thu 15:00-18:00", "posts": 4, "medianLift": 2.04, "score": 1.5 }
  ]
}
```

### Which scrapers it reads

Point **Datasets** at the run of any of these (or a CSV or Sheet export of them). Column names are matched automatically.

- **Instagram**: apify/instagram-scraper (posts), apify/instagram-reel-scraper, apify/instagram-profile-scraper (latest posts) and look-alikes
- **TikTok**: clockworks/tiktok-scraper and look-alikes
- **YouTube**: streamers/youtube-scraper and look-alikes
- **X (Twitter)**: apidojo/tweet-scraper and look-alikes
- **Facebook pages**: apify/facebook-posts-scraper and look-alikes
- **Your own sheet**: an `account` (or username, handle, channel) column, a `date` column with the clock time, and likes, comments, shares, saves or views. A bare date (no time) counts for the weekday only.

**Run it straight after your scraper:** on the scraper's **Integrations** tab, add this actor; the Datasets field is filled with `{{resource.defaultDatasetId}}` for you.

### Input

| Field | Default | What it does |
|---|---|---|
| Datasets / File or Google Sheet URL / Post rows | | Where the posts come from (any mix) |
| Time zone | UTC | The time zone the answer is given in, e.g. America/New_York, Europe/London, Asia/Tokyo |
| Hour block size | 3 | 1, 2, 3, 4 or 6 hours per slot. Use 4 or 6 with under 50 posts |
| Rank posts by | engagement | Engagement (likes + comments + shares + saves), views, likes, comments or engagement rate |
| Posts needed per slot | 3 | Slots with fewer posts are not ranked |
| Posts needed per account | 10 | Accounts with fewer are written with the reason and not charged |
| Only posts from the last (days) | 0 (all) | Leave out old posts |
| Leave pinned posts out | on | Keeps the account's normal honest |
| Add an all-accounts row | on | The free pooled row |
| Also save as a file | | CSV or Excel copy |

### Pricing

Pay per event, no subscription:

- **$0.02 per account analysed** (only accounts that come back with a result; too few posts, no dates or a charge limit are written with the reason and not charged)
- **$0.01 per export file** (CSV or Excel), only if you ask for one
- A tiny Apify start fee per run

Examples: 1 account = about $0.02. A 20-client agency running it monthly = $0.40 a month. 10 rivals plus the free all-accounts row = $0.20. The scraper you run first is billed by that scraper.

### FAQ

**How many posts do I need?** 50 to 100 per account gives `medium` or `high` confidence. With 20 to 30, set the hour block to 4 or 6 hours and lean on the best day and best hours.

**Is this the time my followers are online?** No tool outside the app can see that. This shows when the account's posts have done best, which is the closest public signal, and it is a strong hint, not a guarantee. Big accounts that always post at the same time will show few slots: the "most used slot" line tells you that.

**Which time zone should I use?** Your audience's. A London brand with mostly US followers should use America/New_York.

**Can I check a rival's account?** Yes. Scrape their public posts with any scraper above and give this actor the rows.

**Does it work for AI agents?** Yes. It is pay per event, agent-ready through Apify's MCP server and x402, and takes rows inline in `data`.

If this told you when to post, a review on the Apify Store helps a lot.

Built by Nero Labs. Questions or a scraper whose columns are not read? Open an issue and it gets fixed.

# Actor input Schema

## `datasetIds` (type: `array`):

One or more post scraper datasets: Instagram post, reel or profile scrapers (apify/instagram-scraper and look-alikes), TikTok scrapers (clockworks/tiktok-scraper), YouTube scrapers (streamers/youtube-scraper), X (Twitter) scrapers (apidojo/tweet-scraper) or Facebook page post scrapers (apify/facebook-posts-scraper). Your own account or rivals'. Scrape 50 to 100 posts per account. In a scraper's Integrations tab, set this to {{resource.defaultDatasetId}}.

## `fileUrl` (type: `string`):

A public link to a CSV, Excel, JSON or JSON Lines file: scraper rows, or your own sheet with an account (username) and a post date and time column, plus likes, comments, shares, saves or views. Google Sheets share links work (set 'Anyone with the link can view').

## `fileFormat` (type: `string`):

Leave on 'Detect automatically' unless the link has no file extension.

## `sheetName` (type: `string`):

Which sheet to read from an Excel workbook. Defaults to the first sheet.

## `data` (type: `array`):

Rows as JSON objects, for a quick run or an AI agent call, e.g. \[{"account": "...", "platform": "instagram", "date": "2026-10-20T18:30:00Z", "likes": 900, "comments": 40}]. Dates need a clock time (with Z or an offset) to rank hours; a bare date counts for the weekday only.

## `timeZone` (type: `string`):

The time zone the best times are given in, as a name: America/New_York, America/Los_Angeles, Europe/London, Europe/Madrid, Asia/Tokyo, Australia/Sydney. Use your audience's time zone. Default UTC.

## `blockHours` (type: `integer`):

How many hours each slot covers: 1, 2, 3, 4 or 6. Wider blocks need fewer posts per slot. 3 suits 50 to 100 posts per account.

## `metric` (type: `string`):

Which result a good post is judged on. Engagement = likes + comments + shares + saves (works for photos, videos and text posts). Views suits TikTok, Reels and YouTube. Engagement rate = engagement per view (or per follower when there are no views).

## `minPostsPerSlot` (type: `integer`):

A weekday and hour slot (and a day or hour block on its own) is only ranked when it holds at least this many posts. Higher is safer, lower finds more slots.

## `minPostsPerAccount` (type: `integer`):

Accounts with fewer dated posts with results are written with the reason and not charged (minimum 5).

## `lookbackDays` (type: `integer`):

Use only posts from this many days, so old habits do not count. 0 = every post given.

## `excludePinned` (type: `boolean`):

Pinned posts are usually old hits kept on top of the profile; leaving them out keeps the account's normal honest.

## `groupBy` (type: `string`):

'The profile that was scraped' puts collab posts that appear on a profile with that profile (what you asked the scraper for). 'The account that posted it' groups by the real owner instead.

## `includeCombined` (type: `boolean`):

When 2 or more accounts are analysed, add one free row pooling them (each post still measured against its own account's normal): the best times for a niche, a client roster or a set of rivals.

## `exportFormats` (type: `array`):

Also save the results as CSV or Excel in the run's key-value store (charged once per file).

## `outputDatasetName` (type: `string`):

Name of a dataset to append the results to, to track how an account's best times change month by month.

## `maxItems` (type: `integer`):

Stop reading after this many input rows.

## Actor input object example

```json
{
  "fileUrl": "https://nerolabs-samples.nerolabs.workers.dev/sample-best-time-posts.json",
  "fileFormat": "auto",
  "timeZone": "America/New_York",
  "blockHours": 3,
  "metric": "engagement",
  "minPostsPerSlot": 3,
  "minPostsPerAccount": 10,
  "lookbackDays": 0,
  "excludePinned": true,
  "groupBy": "auto",
  "includeCombined": true,
  "maxItems": 200000
}
```

# Actor output Schema

## `results` (type: `string`):

One row per account: best weekday and hour slot, best day, best hours, most used and weakest slot, confidence, reason, heatmap.

## `summary` (type: `string`):

Accounts analysed, each account's best slot, the all-accounts result, settings, export links and warnings.

# 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 = {
    "fileUrl": "https://nerolabs-samples.nerolabs.workers.dev/sample-best-time-posts.json",
    "timeZone": "America/New_York"
};

// Run the Actor and wait for it to finish
const run = await client.actor("nerolabs/best-time-to-post").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 = {
    "fileUrl": "https://nerolabs-samples.nerolabs.workers.dev/sample-best-time-posts.json",
    "timeZone": "America/New_York",
}

# Run the Actor and wait for it to finish
run = client.actor("nerolabs/best-time-to-post").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 '{
  "fileUrl": "https://nerolabs-samples.nerolabs.workers.dev/sample-best-time-posts.json",
  "timeZone": "America/New_York"
}' |
apify call nerolabs/best-time-to-post --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nerolabs/best-time-to-post"
        }
    }
}
```

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/ZjXobrr9Ab9fxum9S/builds/096NFhUy6aLolZBs7/openapi.json
