# iCal / ICS Calendar to JSON (with recurrence + date window) (`kyawkyaw/ics-calendar-to-json`) Actor

Turn any public .ics / webcal feed (Google Calendar, Outlook, Airbnb, sports, holidays) into clean JSON rows with all-day flags, timezone, date-window filter and simple DAILY/WEEKLY recurrence expansion.

- **URL**: https://apify.com/kyawkyaw/ics-calendar-to-json.md
- **Developed by:** [kyaw kyaw](https://apify.com/kyawkyaw) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.50 / 1,000 calendar events

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

## iCal / ICS Calendar to JSON

Turn any public **.ics / webcal** feed into clean JSON rows: Google Calendar, Outlook, Airbnb / Booking.com availability, sports fixtures, school terms, public holidays.

### What you get

One row per event (or per occurrence) with `title`, `start`, `end`, `allDay`, `timezone` (TZID), `location`, `description`, `url`, `status`, `uid`, `calendar` name, `recurring` and the original `rrule`.

- Handles folded lines and escaped text
- Filter by a `fromDate` – `toDate` window
- Expands simple **DAILY** and **WEEKLY** recurrences (COUNT, UNTIL, INTERVAL) inside the window
- Several feeds in one run; broken feeds get an error row instead of failing the run

### Input

| Field | Description |
|---|---|
| `icsUrls` | Public `https://` or `webcal://` calendar URLs |
| `fromDate`, `toDate` | Optional window, `YYYY-MM-DD` |
| `expandWeeklyDaily` | Expand simple recurrences (default on) |
| `maxOccurrences` | Cap per recurring event (default 200) |

### Output example

```json
{"calendar":"Holidays in Thailand","title":"Loy Krathong","start":"2026-11-24","end":"2026-11-25","allDay":true,"timezone":null,"recurring":false}
```

### Pricing

Pay per event: **$0.0005 per calendar event row**, plus Apify's small standard start fee.

### Limitations

MONTHLY/YEARLY rules, multi-BYDAY rules and EXDATE are not expanded yet; such events are returned once with their `rrule` so you can handle them. Floating times are kept as written.

# Actor input Schema

## `icsUrls` (type: `array`):

Public https:// or webcal:// calendar feed URLs (.ics).

## `fromDate` (type: `string`):

Only include events on or after this date (YYYY-MM-DD). Optional.

## `toDate` (type: `string`):

Only include events on or before this date (YYYY-MM-DD). Optional.

## `expandWeeklyDaily` (type: `boolean`):

Expand simple DAILY and WEEKLY recurring events into individual occurrences inside the window.

## `maxOccurrences` (type: `integer`):

Maximum number of occurrences generated per recurring event.

## Actor input object example

```json
{
  "icsUrls": [
    "https://calendar.google.com/calendar/ical/en.th%23holiday%40group.v.calendar.google.com/public/basic.ics"
  ],
  "expandWeeklyDaily": true,
  "maxOccurrences": 200
}
```

# Actor output Schema

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

No description

# 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 = {
    "icsUrls": [
        "https://calendar.google.com/calendar/ical/en.th%23holiday%40group.v.calendar.google.com/public/basic.ics"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kyawkyaw/ics-calendar-to-json").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 = { "icsUrls": ["https://calendar.google.com/calendar/ical/en.th%23holiday%40group.v.calendar.google.com/public/basic.ics"] }

# Run the Actor and wait for it to finish
run = client.actor("kyawkyaw/ics-calendar-to-json").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 '{
  "icsUrls": [
    "https://calendar.google.com/calendar/ical/en.th%23holiday%40group.v.calendar.google.com/public/basic.ics"
  ]
}' |
apify call kyawkyaw/ics-calendar-to-json --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kyawkyaw/ics-calendar-to-json"
        }
    }
}
```

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/SmCapFMNKLbCzxghP/builds/LUhlU8prOQuSJHG6f/openapi.json
