# UK Gambling Commission Licence Portfolio Status Monitor (`plym-actor-factory/uk-gambling-commission-licence-portfolio-monitor`) Actor

Watch Gambling Commission Account Numbers and/or Licence Numbers and emit typed Active/Suspended/Revoked/Surrendered/Lapsed events from the official OGL business-licence-register-licences.csv snapshot. Not HTML scrape; not LiSense/iGregulator; not MGA Malta.

- **URL**: https://apify.com/plym-actor-factory/uk-gambling-commission-licence-portfolio-monitor.md
- **Developed by:** [Daniel Witney](https://apify.com/plym-actor-factory) (community)
- **Categories:** AI, Automation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 ukgc licence status event delivereds

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

## UK Gambling Commission Licence Portfolio Status Monitor

Watch a book of **Gambling Commission Account Numbers and/or Licence Numbers** and emit typed **Active / Suspended / Revoked / Surrendered / Lapsed** (plus optional new-Activity) events when the official **Open Government Licence** operator licences CSV changes — not another nationwide UKGC dump, not an HTML scrape of the public-register UI, and **not** Malta MGA enforcement.

### What this Actor does

1. Takes your watchlist (`accountNumbers` and/or `licenceNumbers`).
2. In **live** mode, downloads the official Commission CSV once:
   - `https://www.gamblingcommission.gov.uk/downloads/business-licence-register-licences.csv`
   - optionally joins `business-licence-register-businesses.csv` for account names
3. Expands Account Numbers → Licence Numbers present on that snapshot.
4. Diffs against a durable Key-Value Store checkpoint.
5. Pushes **only** material change events for licences on your book (PPE), plus one non-billable `RUN_STATUS` health row.

**First observation of a licence is baseline only** (no charge). Quiet days ≈ $0 product charges.

### Coverage honesty (read this)

| In scope | Out of scope |
|----------|----------------|
| UK Gambling Commission **operator / business** licences register (OGL CSV) | **Personal (individual)** licences register |
| Status taxonomy as published: Active, Pending, Suspended, Revoked (+ Non Payment of Fee), Surrendered, Lapsed | **MGA Malta** operator enforcement (`zinin/mga-…` adjacency) |
| Optional Activity-row adds on a watched licence | Nationwide “download all ~2.6k operators and bill rows” dump SKU |
| Official Commission HTTP CSV under OGL | LiSense / iGregulator unpaid scrape or seat replacement |
| Daily-class Commission publish cadence | Intra-day HTML scrape of the public-register UI |

Cite: Gambling Commission public-register downloads; retrieval date is `as_of` / `fetchedAt` on events.

### Input

| Field | Notes |
|-------|--------|
| `accountNumbers` | Operator Account Numbers (digits). Expands to all licences under each account on the CSV. |
| `licenceNumbers` | Optional explicit Licence Numbers (`000102-A-342261-001`). |
| `signalGroups` | `status` (default), `activity` (new Activity on watched licence). |
| `sourceMode` | `fixture` (default — Store health) or `live` (OGL CSV; **no API key**). |
| `emitFixtureDemoEvents` | Default **false**. Only enable for local demos; Store auto-tests must stay false. |
| `joinBusinessNames` | Default true — optional businesses CSV enrich. |
| `includePersonalLicences` | Default **false** (A5). Never fetched in this build. |

### Output events (billable)

| `event_type` | When |
|--------------|------|
| `UKGC_LICENCE_SUSPENDED` | Status → Suspended |
| `UKGC_LICENCE_REVOKED` | Status → Revoked / Revoked - Non Payment of Fee |
| `UKGC_LICENCE_SURRENDERED` | Status → Surrendered |
| `UKGC_LICENCE_LAPSED` | Status → Lapsed |
| `UKGC_LICENCE_ACTIVATED` | Non-active → Active |
| `UKGC_LICENCE_STATUS_CHANGED` | Other material Status flips |
| `UKGC_ACTIVITY_ADDED` | New Activity string on a watched licence (`activity` group) |
| `UKGC_LICENCE_GONE` | Explicit watched licence absent from CSV after prior presence |

Every successful run also pushes **`RUN_STATUS`** with `billable: false` (`FIXTURE_HEALTH` / `MONITOR_IDLE` / `CATCHUP_COMPLETE` / `HEALTH_OK`).

### Pricing (PPE)

| Event | Price |
|-------|-------|
| `ukgc-licence-status-event-delivered` | **$0.02** ($20 / 1k) |
| `apify-actor-start` | **$0.00005** |

You pay when a licence **on your watchlist** has a material Status/activity change and we deliver it. Not charged: baselines, quiet books, duplicates, invalids, `RUN_STATUS`, fixture health.

### Modes

- **Fixture (default):** no network; emits `RUN_STATUS` / `FIXTURE_HEALTH` only → **0** product charges (Store daily auto-test safe).
- **Live:** official OGL CSV download — **no key required**.

### Legal

Public-register downloads under the **UK Open Government Licence**. Operator/business licences primary; personal licences default off. Do not present this as LiSense/iGregulator or as MGA Malta coverage.

### Not this product

- `scrapersdelight/ukgc-gambling-licensees-scraper` — full-register dump / weak “change monitor” ghost (different job).
- `nexgenwatch/uk-gambling-operator-licence-check` — one-shot lookup.
- `zinin/mga-operator-enforcement-monitor` — Malta MGA, not UKGC.
- HTML scrape of https://www.gamblingcommission.gov.uk/public-register UI as primary.

### Example input (live baseline)

```json
{
  "accountNumbers": ["102", "49577"],
  "licenceNumbers": [],
  "sourceMode": "live",
  "signalGroups": ["status", "activity"],
  "resumeFromCheckpoint": true,
  "emitFixtureDemoEvents": false
}
```

First live run stores baselines only. Subsequent scheduled runs emit events when Status/activity flips on the book.

# Actor input Schema

## `accountNumbers` (type: `array`):

Gambling Commission operator Account Numbers to monitor. Digits only. Expands to all Licence Numbers under each account on the official OGL licences CSV. Invalid entries are skipped with no charge. Not a nationwide dump — only licences on the book are evaluated.

## `licenceNumbers` (type: `array`):

Optional explicit Licence Numbers (e.g. 000102-A-342261-001). Combined with Account Number expansion. Prefer Account Numbers for B2B books; add Licence Numbers when you track a subset.

## `signalGroups` (type: `array`):

Which change groups to evaluate: status (Active/Suspended/Revoked/Surrendered/Lapsed/Pending flips + gone), activity (new Activity rows on a watched licence). Default: status + activity. Personal (individual) licences are a separate register — never included.

## `maxRunSeconds` (type: `integer`):

Wall-clock budget for the run (CSV download + watchlist diff).

## `maxEvents` (type: `integer`):

Stop after this many unique change events are delivered (does not include RUN\_STATUS).

## `resumeFromCheckpoint` (type: `boolean`):

If true, resume licence snapshots and seen event\_uids from the default Key-Value Store.

## `sourceMode` (type: `string`):

fixture = local/CI / Apify Store daily auto-test default (no network; emits RUN\_STATUS only unless emitFixtureDemoEvents=true). live = official Gambling Commission OGL CSV download (no API key). Not HTML scrape; not LiSense/iGregulator; not MGA Malta.

## `emitFixtureDemoEvents` (type: `boolean`):

When sourceMode=fixture, if true push fabricated change events from local fixtures (unit/local demos only). Default false so Store daily auto-tests never emit fake UKGC events or charge ukgc-licence-status-event-delivered. Production: leave false and use sourceMode=live.

## `asOfHint` (type: `string`):

Optional as\_of label for events / RUN\_STATUS. Does not force a nationwide dump bill.

## `maxTotalChargeUsd` (type: `number`):

Optional soft budget hint for delivered change events. Platform ACTOR\_MAX\_TOTAL\_CHARGE\_USD also applies when set.

## `licencesCsvUrl` (type: `string`):

Optional override for the official OGL licences CSV URL. Default: https://www.gamblingcommission.gov.uk/downloads/business-licence-register-licences.csv

## `joinBusinessNames` (type: `boolean`):

If true (default), also download business-licence-register-businesses.csv to enrich Account Number → Licence Account Name. Optional enrich only; status events still come from licences CSV.

## `includePersonalLicences` (type: `boolean`):

A5 legal default: OFF. This build only consumes the operator/business licences register. Personal-licence individuals are a separate register and are never fetched even if set true.

## Actor input object example

```json
{
  "accountNumbers": [
    "102",
    "49577"
  ],
  "licenceNumbers": [],
  "signalGroups": [
    "status",
    "activity"
  ],
  "maxRunSeconds": 55,
  "maxEvents": 500,
  "resumeFromCheckpoint": true,
  "sourceMode": "fixture",
  "emitFixtureDemoEvents": false,
  "joinBusinessNames": true,
  "includePersonalLicences": false
}
```

# Actor output Schema

## `OUTPUT` (type: `string`):

JSON summary: delivered, charged, runStatus, checkpoint, stats, UKGC OGL coverage limits

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("plym-actor-factory/uk-gambling-commission-licence-portfolio-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("plym-actor-factory/uk-gambling-commission-licence-portfolio-monitor").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 '{}' |
apify call plym-actor-factory/uk-gambling-commission-licence-portfolio-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,plym-actor-factory/uk-gambling-commission-licence-portfolio-monitor"
        }
    }
}
```

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/WIvQKOavHwdTOmkwk/builds/ucfszUB0WegOMev3b/openapi.json
