# EMA Medicines API — EPAR, DHPC & Shortage Monitor (`xerophylous_mercy_0wn/ema-medicines-api-monitor`) Actor

Search and monitor official EMA medicines, EPAR metadata, post-authorisation procedures, DHPC safety communications, and shortages. Twice-daily source updates, stable change events, schedules, webhooks, and MCP-ready JSON.

- **URL**: https://apify.com/xerophylous\_mercy\_0wn/ema-medicines-api-monitor.md
- **Developed by:** [Hryhory Sinenka](https://apify.com/xerophylous_mercy_0wn) (community)
- **Categories:** Automation, Developer tools, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 ema record or changes

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

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

## EMA Medicines API — EPAR, DHPC & Shortage Monitor

Search and monitor four official European Medicines Agency datasets from one Actor:

- medicine pages and EPAR metadata;
- post-authorisation procedures;
- direct healthcare professional communications (DHPCs);
- ongoing and resolved medicine shortages.

EMA refreshes its machine-readable JSON files twice daily. This Actor turns them into compact, filterable records or durable `added`, `updated`, and `removed` change events for AI agents, scheduled alerts, regulatory intelligence, and data pipelines.

### Why this Actor

Generic medicine scrapers return a current table. This Actor also answers the operational question: **what changed since my last successful run?**

- Official EMA JSON sources; no browser scraping or proxy required.
- One schema across four high-value regulatory datasets.
- Search by medicine, active substance, company, status, therapeutic area, or any record field.
- Persistent baselines and stable delivery IDs for scheduled monitoring.
- Field-level diffs for updated records.
- Failed sources never create false removal alerts.
- Monitoring state does not advance when the output budget is exhausted.

### Fast starts

#### Search oncology medicines and safety communications

```json
{
  "sources": ["medicines", "dhpc"],
  "keywords": ["oncology"],
  "keywordMode": "any",
  "categories": ["Human"],
  "mode": "snapshot",
  "maxResults": 200
}
```

#### Monitor one active substance quietly

Run this on an Apify schedule. The first run creates a baseline; later runs emit only changes.

```json
{
  "sources": ["medicines", "post_authorisation", "dhpc", "shortages"],
  "activeSubstances": ["semaglutide"],
  "mode": "changes",
  "firstRunMode": "baseline_only",
  "stateNamespace": "semaglutide-watch"
}
```

#### Track a company portfolio

```json
{
  "holders": ["AstraZeneca"],
  "mode": "changes",
  "firstRunMode": "emit_current",
  "stateNamespace": "az-portfolio"
}
```

### Output

Snapshot mode emits normalized `ema_record` rows with the complete official record under `data`. Change mode emits `ema_change` rows with:

- `changeType`: `added`, `updated`, or `removed`;
- `changedFields`: exact official fields whose values changed;
- `before` and `after`: source records for auditability;
- `deliveryId`: stable idempotency key for webhook and workflow deduplication;
- `sourceUrl`: direct EMA page.

The Actor writes a run-level `SUMMARY` record to the default key-value store. It reports source timestamps, source errors, matched and emitted counts, output limits, and whether monitoring state advanced.

### Scheduling and alerts

Use Apify Schedules to run after EMA's twice-daily refresh. Connect a dataset webhook or an automation platform to route non-empty change results. For a quiet first run, choose `baseline_only`.

Each set of filters gets isolated state. Change `stateNamespace` when you want a fresh or parallel baseline.

### Reliability semantics

Change delivery is at least once. Deduplicate downstream with `deliveryId`.

If a selected EMA source fails, its last known records are preserved and no removals are inferred from the failed fetch. If a run cannot emit all candidate changes because of `maxResults` or the Actor spending limit, state does not advance; the same stable change IDs may appear again on the next run.

### Official source

The data comes from the [EMA machine-readable website data files](https://www.ema.europa.eu/en/about-us/about-website/download-website-data-json-data-format). EMA states that these JSON files update at 06:00 and 18:00 Amsterdam time.

This Actor republishes descriptive public regulatory metadata. It does not provide medical, legal, investment, or regulatory advice.

# Actor input Schema

## `sources` (type: `array`):

Official EMA JSON datasets to query. All are refreshed by EMA twice daily.

## `keywords` (type: `array`):

Search the complete official record, including indication, therapeutic area, company, status, and dates.

## `keywordMode` (type: `string`):

Match any supplied keyword or require every supplied keyword in the official record.

## `medicineNames` (type: `array`):

Case-insensitive partial names, for example Keytruda or Enhertu.

## `activeSubstances` (type: `array`):

Case-insensitive partial active-substance names.

## `holders` (type: `array`):

Case-insensitive company or applicant names.

## `statuses` (type: `array`):

Match authorisation, procedure, safety outcome, or shortage status.

## `categories` (type: `array`):

Use Human, Veterinary, or both. Empty means all categories.

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

Snapshot returns current matches. Changes stores a baseline and emits added, updated, or removed records on later runs.

## `firstRunMode` (type: `string`):

Emit all current matches as additions or create a quiet baseline.

## `emitRemovals` (type: `boolean`):

Report records that disappear from a successfully fetched EMA dataset.

## `maxResults` (type: `integer`):

Hard output ceiling. Monitoring state advances only after every detected change is delivered.

## `stateStoreName` (type: `string`):

Named Apify key-value store used for change detection.

## `stateNamespace` (type: `string`):

Change this to keep an independent baseline for the same filters.

## `requestTimeoutSecs` (type: `integer`):

Deadline for each request to an official EMA JSON data file.

## `maxRetries` (type: `integer`):

Retry rate limits, timeouts, and temporary EMA server errors with bounded backoff.

## Actor input object example

```json
{
  "sources": [
    "medicines",
    "dhpc"
  ],
  "keywords": [
    "oncology"
  ],
  "keywordMode": "any",
  "medicineNames": [],
  "activeSubstances": [],
  "holders": [],
  "statuses": [],
  "categories": [
    "Human"
  ],
  "mode": "snapshot",
  "firstRunMode": "emit_current",
  "emitRemovals": true,
  "maxResults": 100,
  "stateStoreName": "ema-regulatory-monitor-state",
  "stateNamespace": "default",
  "requestTimeoutSecs": 45,
  "maxRetries": 3
}
```

# Actor output Schema

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

Default dataset containing current EMA records or added, updated, and removed change events.

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

Source timestamps, source errors, result counts, output limits, and monitoring-state status.

# 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 = {
    "sources": [
        "medicines",
        "dhpc"
    ],
    "keywords": [
        "oncology"
    ],
    "maxResults": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("xerophylous_mercy_0wn/ema-medicines-api-monitor").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 = {
    "sources": [
        "medicines",
        "dhpc",
    ],
    "keywords": ["oncology"],
    "maxResults": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("xerophylous_mercy_0wn/ema-medicines-api-monitor").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 '{
  "sources": [
    "medicines",
    "dhpc"
  ],
  "keywords": [
    "oncology"
  ],
  "maxResults": 100
}' |
apify call xerophylous_mercy_0wn/ema-medicines-api-monitor --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/OdZorhlMvykBI5TJz/builds/yszGEebzEMPMrrIq1/openapi.json
