# UK SRA Firm Portfolio Status Monitor (`plym-actor-factory/uk-sra-firm-portfolio-status-monitor`) Actor

Watch a list of SRA firm numbers and emit typed Authorised/Intervention/Closed/licence events from the official SRA Data Share API (user-supplied Azure APIM subscription key). Not an HTML scrape; not Reglo/SwiftCase.

- **URL**: https://apify.com/plym-actor-factory/uk-sra-firm-portfolio-status-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 sra firm 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 SRA Firm Portfolio Status Monitor

Watch a **list of SRA firm / organisation numbers** and receive **typed authorisation / licence events** when the official **SRA Data Share API** flips — **Authorised → Intervention / Closed / conditions**, restorations, or **licence type** changes. **Not** another SRA directory scrape. **Not** Reglo / SwiftCase / VinciWorks seats. **Not** FCA FRN (different regulator). **Not** Companies House dissolution.

### A1b (v9) — already PASS

Cited from `opportunity/reports/phase3-a1b-next3-v9.md` (do not invent competitors):

| Field | Evidence |
|-------|----------|
| **DIRECT SAME-JOB COMPETITORS** | **0** portfolio-change / SRA#-watchlist PPE products. Directory/lookup dumps (different job): `crawlerbros/sra-solicitors-register-scraper` (**3 MAU / 7 tot**); `jungle_synthesizer/sra-solicitors-scraper` (**1 / 14**). |
| **EXTERNAL DEMAND** | Reglo, SwiftCase, VinciWorks Omnitrack market SRA compliance seats (COLP/COFA dashboards, practising-certificate / authorisation tracking). SRA publishes a free Data Share API expressly for re-use (attribution required). |
| **OUR WEDGE** | SRA-number watchlist × scheduled Data Share API firm snapshot diff → typed authorisation/licence events only for the book. |
| **Legal** | **GREEN** — official SRA HTTP only; user-supplied free Azure APIM subscription key; required SRA attribution hyperlink; individual solicitor PII / disciplinary default **OFF**. |

### Honest coverage (read before buying)

| Included (official Data Share API) | **Not** included |
|------------------------------------|------------------|
| Firm / organisation `AuthorisationStatus` (YES / CONDITION / CEASE / INTERVENE) | HTML scrape of sra.org.uk Solicitors Register |
| Organisation type taxonomy (Authorised / Intervened / Closure\*) | Reglo / SwiftCase / VinciWorks keys |
| Licence / authorisation type (RECBODY / LICBODY / RECSOLE …) | Nationwide newly-authorised firm lead dumps |
| Authorisation / status dates | Individual solicitor PII / disciplinary (default OFF) |
| Lookup by **SRA#** on your watchlist only | Scotland Law Society as primary; streaming / intra-day (refresh ~**24h**) |

**Live path:** per-SRA# `GET https://sra-prod-apim.azure-api.net/api/organisation/{SRANumber}` with header `Ocp-Apim-Subscription-Key` (free [SRA Data Share developer portal](https://sra-prod-apim.developer.azure-api.net/)). Dataset refreshes ~**every 24 hours**. First observation stores a **baseline** (no charge). Quiet days ≈ $0 product charges. Respect API rate limits (SRA Technical Document); raise `requestPaceMs` on 429.

### Value proposition

- **SRA# watchlist × Data Share snapshot diff** → `SRA_FIRM_INTERVENTION`, `SRA_FIRM_CLOSED`, `SRA_FIRM_AUTHORISED_RESTORED`, `SRA_FIRM_STATUS_CHANGED`, optional `SRA_LICENCE_TYPE_CHANGED`, `SRA_FIRM_GONE`.
- Official SRA HTTP only. **No Reglo / SwiftCase key.**
- **Pay only for unique delivered change events.** Durable KVS checkpoint + `event_uid` dedupe.

### PRODUCTION USE (required for real monitoring)

> **Store default ≠ product.** Schema defaults use `sourceMode=fixture` so Apify Store daily auto-tests leave a non-empty health dataset **without** calling SRA. That fixture path only writes a non-billable `RUN_STATUS` / `FIXTURE_HEALTH` row. It is **not** SRA monitoring.

For **production monitoring** you **must**:

1. Set **`sourceMode` = `live`**
2. Provide **`sraSubscriptionKey`** (free [SRA APIM portal](https://sra-prod-apim.developer.azure-api.net/) — Products → Datasharing → SRA Data Share API Version V1 → Subscribe)
3. Provide your `sraNumbers` watchlist
4. Schedule runs (daily is typical; Data Share is ~24h snapshot-class, not a stream)

Official references:

- [SRA Information sharing / Data Share](https://www.sra.org.uk/sra/how-we-work/privacy-data-information/data-sharing/)
- [Developer portal](https://sra-prod-apim.developer.azure-api.net/)
- Endpoint: `https://sra-prod-apim.azure-api.net/api/organisation/{SRANumber}`

### Apify Store daily auto-test / default input

| Field | Default |
|-------|---------|
| `sraNumbers` | `["561658","400692"]` |
| `signalGroups` | `status`, `licence` |
| `sourceMode` | `fixture` |
| `emitFixtureDemoEvents` | `false` |
| `includeIndividuals` | `false` |
| `maxRunSeconds` | `55` |
| `requestPaceMs` | `300` |

On that path the Actor **SUCCEEDS** quickly, pushes exactly one `RUN_STATUS` / `FIXTURE_HEALTH` row (`billable: false`), and does **not** charge `sra-firm-status-event-delivered`.

### Input (summary)

| Field | Notes |
|-------|--------|
| `sraNumbers` | Watchlist (required, numeric SRA#) |
| `signalGroups` | `status`, `licence` |
| `sourceMode` | `fixture` (default) or `live` |
| `sraSubscriptionKey` | Required for live (`isSecret`) |
| `emitFixtureDemoEvents` | Default **false** |
| `includeIndividuals` | Default **false** (A5) |
| `maxRunSeconds` / `maxEvents` | Budgets |
| `resumeFromCheckpoint` | Default true |
| `requestPaceMs` | Default **300** (raise on 429) |

#### Production example

```json
{
  "sraNumbers": ["561658", "400692", "605001"],
  "signalGroups": ["status", "licence"],
  "sourceMode": "live",
  "sraSubscriptionKey": "<apim-subscription-key>",
  "asOfHint": "2026-09-17",
  "maxRunSeconds": 300,
  "requestPaceMs": 300,
  "resumeFromCheckpoint": true
}
```

### Output

#### Change events (billable under PPE)

Typed rows include: `sra_number`, `organisation_name`, `event_type`, `event_subtype`, `changed_fields`, `previous_value`, `new_value`, `as_of`, `evidence`, `summary`, `source_url`, `event_uid`, `licence_type`, `organisation_type`, `billable: true`.

#### RUN\_STATUS (never billed)

Every successful run pushes one health row (`FIXTURE_HEALTH` | `MONITOR_IDLE` | `CATCHUP_COMPLETE` | `HEALTH_OK`).

### Pricing

Pay-per-event: **`sra-firm-status-event-delivered`** at **$0.02** per delivered unique change event ($20 / 1,000). Single tier (see `docs/monetization.md` and ADR 0010). Health / baseline / duplicate / fixture rows are never charged. `apify-actor-start` ~$0.00005.

### Local development

```bash
cd actors/uk-sra-firm-portfolio-status-monitor
npm install
npm test
npm run build
apify run -p
```

### Attribution

**UK SRA Firm Portfolio Status Monitor includes data supplied by the Solicitors Regulation Authority** — [attribution statement](http://www.sra.org.uk/sra/how-we-work/web-service/attribution.page). Not an official SRA product. Not Reglo / SwiftCase. Status taxonomy stays faithful to SRA Data Share dictionary strings (YES / CONDITION / CEASE / INTERVENE and organisation-type classes). England & Wales SRA scope only.

# Actor input Schema

## `sraNumbers` (type: `array`):

SRA firm / organisation numbers to monitor via official Data Share API organisation/{SRANumber}. Digits only (4–10). Invalid entries are skipped with no charge. Not a nationwide dump — only these SRA#s are polled. England & Wales SRA scope only.

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

Which change groups to evaluate: status (YES/CONDITION/CEASE/INTERVENE + organisation-type Authorised/Intervened/Closed), licence (authorisation type / current licence). Default: both. Individual solicitor PII is never included.

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

Wall-clock budget for the run. Large books may need longer budgets or chunked schedules. Dataset refreshes ~every 24h; respect SRA API rate limits.

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

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

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

If true, resume SRA# 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 SRA Data Share API — requires sraSubscriptionKey. Not HTML scrape; not Reglo/SwiftCase.

## `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 SRA events or charge sra-firm-status-event-delivered. Production: leave false and use sourceMode=live. SAMPLE rows only: demo events use placeholder entities (never real companies/IDs), are flagged sample=true / isSample=true, and are NEVER charged. To see them, set Source mode = fixture and put the placeholder values 999901, 999902, 999903 in "SRA numbers (watchlist)".

## `sraSubscriptionKey` (type: `string`):

Free Azure APIM subscription key from the SRA Data Share developer portal (Products → Datasharing → SRA Data Share API Version V1 → Subscribe). Required only when sourceMode=live. Marked secret; never logged. Not a Reglo/SwiftCase key.

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

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

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

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

## `requestPaceMs` (type: `integer`):

Minimum delay between outbound SRA HTTP requests. Default 300 ms. Raise if you see 429s. Dataset refresh cadence ~24h (not streaming).

## `includeIndividuals` (type: `boolean`):

A5 legal default: OFF. This build does not call individual solicitor endpoints even if set true — product stays firm authorisation status / licence type only.

## Actor input object example

```json
{
  "sraNumbers": [
    "561658",
    "400692"
  ],
  "signalGroups": [
    "status",
    "licence"
  ],
  "maxRunSeconds": 55,
  "maxEvents": 500,
  "resumeFromCheckpoint": true,
  "sourceMode": "fixture",
  "emitFixtureDemoEvents": false,
  "requestPaceMs": 300,
  "includeIndividuals": false
}
```

# Actor output Schema

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

JSON summary: delivered, charged, runStatus, checkpoint, stats, SRA 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-sra-firm-portfolio-status-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-sra-firm-portfolio-status-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-sra-firm-portfolio-status-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-sra-firm-portfolio-status-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/nUjvSb68Zaq5MUSjy/builds/3t3XMG40HnBBCO5fb/openapi.json
