# Contract Renewal Notice Tracker (`afkdigital/contract-renewal-notice-tracker`) Actor

Calculate contract renewal notice deadlines from CSV or XLSX, with configurable calendars, source evidence, JSON/CSV, and ICS export.

- **URL**: https://apify.com/afkdigital/contract-renewal-notice-tracker.md
- **Developed by:** [AFK Digital](https://apify.com/afkdigital) (community)
- **Categories:** Business, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.50 / 1,000 successfully reviewed contracts

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

## Contract Renewal Notice Tracker

Review contract renewal dates and notice deadlines from a structured CSV or XLSX inventory. The Actor produces reminders based on the dates, units and calendar you supply. It does not interpret contract language or send email or termination notices.

### Quick start

Run with an empty input to see six synthetic contract rows, including a holiday, a leap-year month end and an incomplete row. The demo uses November 10, 2026 as its reference date and generates no contract review events.

For production, upload a single file (UTF-8 comma-separated CSV or first XLSX worksheet, with a header row). The API accepts `contractsFile: [{ "url": "https://api.apify.com/v2/key-value-stores/STORE_ID/records/inventory.csv?signature=..." }]` with an accessible Apify record URL. Keep signed URLs private. Limits are 5 MiB per upload, 40 MiB expanded XLSX, 100 columns and 10,000 data rows. Supply stored cell values in mapped fields instead of formulas. Map the five fields `contract_id`, `vendor`, `renewal_date`, `notice_period`, and `notice_unit` to unique exact headers. Units are `calendar_days`, `business_days`, and `months`. Periods are integers from 0 to 3660.

### How the dates are calculated

- Calendar days are subtracted directly without shifting weekends.
- Business days are counted backward from the day before renewal. Supply `optionalHolidayCalendar` with inclusive `startDate` and `endDate`, ISO `weekendDays` (Monday is 1), and an explicit `holidays` list, which can be empty. The calendar must cover the renewal date and every date traversed. A zero notice period leaves the renewal date in place.
- Months are subtracted in one step, then the day is clamped to the last valid day of the target month. March 31, 2028 less one month is February 29, 2028.
- Dates are ISO civil dates or XLSX date cells. The IANA time zone determines today's date if you omit `asOfDate` on an upload. Date-only arithmetic and all-day ICS events do not shift at daylight saving transitions.
- Each contract ID and renewal date identifies a period. Each supplied period is calculated independently. Duplicate or conflicting rows for the same period, and rows with missing or invalid fields, return `needs_review` with a reason and no deadline. Recurrences are not inferred.

### Exports and billing

The default Dataset exports JSON and CSV through Apify. `evidence_row` points to the CSV record or Excel worksheet row. `days_remaining` is signed calendar days until the notice deadline. Statuses are `past_due`, `due_today`, `upcoming`, `outside_window`, and `needs_review`. Upcoming means the deadline falls within at least one selected alert window. All matching windows are grouped in the same result row.

Download `notice-deadlines.ics` from the run's key-value store to import verified deadlines from today onward, including dates outside alert windows. It includes contract IDs and vendor names. The `OUTPUT` record identifies when an Apify budget limit reduced the exported results.

In paid mode the Actor charges once per distinct contract ID with at least one valid deadline in a run. Alert thresholds and additional valid periods for that contract do not add charges. Contracts that only return `needs_review` are excluded. The price is expressed per 1,000 successfully reviewed contracts and prorated per contract.

# Actor input Schema

## `contractsFile` (type: `array`):

Upload CSV or XLSX (5 MiB max). Leave empty for the built-in demo.

## `columnMapping` (type: `object`):

Map contract_id, vendor, renewal_date, notice_period and notice_unit to the exact headers.

## `asOfDate` (type: `string`):

YYYY-MM-DD. Defaults to today's date in the chosen time zone for uploads.

## `timezone` (type: `string`):

IANA time zone, such as Europe/Istanbul.

## `alertWindowsDays` (type: `array`):

Inclusive calendar-day thresholds from 0 to 3660.

## `optionalHolidayCalendar` (type: `object`):

Supply startDate, endDate, weekendDays (ISO 1–7), and holidays (ISO dates) for business-day calculations.

## Actor input object example

```json
{
  "columnMapping": {
    "contract_id": "id",
    "vendor": "vendor",
    "renewal_date": "renewal",
    "notice_period": "period",
    "notice_unit": "unit"
  },
  "timezone": "UTC",
  "alertWindowsDays": [
    7,
    30,
    60
  ]
}
```

# Actor output Schema

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

No description

## `calendar` (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 = {
    "columnMapping": {
        "contract_id": "id",
        "vendor": "vendor",
        "renewal_date": "renewal",
        "notice_period": "period",
        "notice_unit": "unit"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("afkdigital/contract-renewal-notice-tracker").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 = { "columnMapping": {
        "contract_id": "id",
        "vendor": "vendor",
        "renewal_date": "renewal",
        "notice_period": "period",
        "notice_unit": "unit",
    } }

# Run the Actor and wait for it to finish
run = client.actor("afkdigital/contract-renewal-notice-tracker").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 '{
  "columnMapping": {
    "contract_id": "id",
    "vendor": "vendor",
    "renewal_date": "renewal",
    "notice_period": "period",
    "notice_unit": "unit"
  }
}' |
apify call afkdigital/contract-renewal-notice-tracker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,afkdigital/contract-renewal-notice-tracker"
        }
    }
}
```

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/ZTKci44arXAPfNrHx/builds/I3BYkUIBkpPV2o5Sn/openapi.json
