Skip to main content

Overview

Due-diligence, KYC, and onboarding workflows often require looking up companies on government registries — checking incorporation status, extracting registered addresses, or verifying company numbers. These portals rarely offer APIs, so teams spend hours on manual lookups. Refrain automates the entire flow: search by company name, open the detail page, extract the required fields, and export them as CSV. With batch mode you can process hundreds of companies from a spreadsheet in a single run.

Example runbook

name: corporate-registry-lookup
url: https://find-and-update.company-information.service.gov.uk
variables:
  - name: companyName
    source: prompt
    description: Company name to search
steps:
  - action: input
    selector: "#site-search-text"
    value: "{{ companyName }}"
  - action: click
    selector: "#search-submit"
  - action: click
    selector: ".govuk-link[href*='/company/']"
  - action: extract
    selector: "#company-summary"
    capture: companyDetails
  - action: export
    format: csv
    fields:
      - name: companyName
        value: "{{ companyName }}"
      - name: details
        value: "{{ companyDetails }}"

Generate and execute

1

Generate the runbook

Point Refrain at the registry and describe the goal:
npx @refrainai/cli generate -- \
  --url https://find-and-update.company-information.service.gov.uk \
  --goal "Search for a company and extract its company number, registered address, incorporation date, and status" \
  --context ./context.md \
  --output ./corporate-registry.yaml
2

Execute the runbook

Run the generated runbook:
npx @refrainai/cli execute -- \
  --runbook ./corporate-registry.yaml
3

Batch processing

Provide a CSV with company names for bulk lookups:
npx @refrainai/cli execute -- \
  --runbook ./corporate-registry.yaml \
  --data ./companies.csv

Why this works well

  • No API required — Works directly on government portal web interfaces.
  • Self-healing — Portal UI changes don’t break the automation. Selectors are resolved through multiple fallback layers.
  • Batch mode — Process hundreds of companies from a CSV in a single run.
  • Zero rerun cost — After the initial AI-powered generation, every execution is deterministic and token-free.

What’s next

Generate a runbook

Learn how AI builds runbooks from a goal.

Variables and secrets

Securely pass credentials and data to runbooks.