> ## Documentation Index
> Fetch the complete documentation index at: https://docs.therefrain.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Banking & Government Portals

> Automate tasks on legacy banking and government portals that lack APIs.

## Overview

Many banking and government portals still rely on traditional web interfaces with no public API. Teams manually log in to check balances, submit applications, or file tax forms — repetitive tasks that consume hours every week. These portals also refresh their UIs frequently, breaking any conventional automation.

Refrain handles these portals by generating a self-healing runbook from a single goal description. When the portal's UI changes, the runbook automatically adapts — no manual selector fixes needed.

## Example runbook

```yaml theme={null}
name: check-bank-balance
url: https://portal.example-bank.co.jp/login
variables:
  - name: username
    source: secrets
  - name: password
    source: secrets
steps:
  - action: input
    selector: "#userId"
    value: "{{ username }}"
  - action: input
    selector: "#password"
    value: "{{ password }}"
  - action: click
    selector: "#loginButton"
  - action: wait
    selector: ".account-summary"
  - action: extract
    selector: ".balance-amount"
    capture: balance
  - action: export
    format: csv
    fields:
      - name: balance
        value: "{{ balance }}"
```

## Generate and execute

<Steps>
  <Step title="Generate the runbook">
    Point Refrain at the portal and describe the goal:

    ```bash theme={null}
    npx @refrainai/cli generate -- \
      --url https://portal.example-bank.co.jp/login \
      --goal "Log in, navigate to account summary, and extract the current balance" \
      --context ./context.md \
      --output ./check-balance.yaml
    ```
  </Step>

  <Step title="Execute the runbook">
    Run the generated runbook. No AI tokens are consumed:

    ```bash theme={null}
    npx @refrainai/cli execute -- \
      --runbook ./check-balance.yaml \
      --secrets ./secrets.json
    ```
  </Step>

  <Step title="Schedule periodic runs">
    Use the [Web Console scheduler](/console/schedules) or your CI/CD pipeline to run the runbook on a schedule.
  </Step>
</Steps>

## Why this works well

* **No API required** — Operates directly on the web interface, just like a human would.
* **Self-healing** — Portal UI refreshes don't break the automation. Selectors are resolved through multiple fallback layers.
* **Approval gates** — Add Slack approval before sensitive actions like fund transfers or form submissions.
* **Zero rerun cost** — After the initial AI-powered generation, every execution is deterministic and token-free.

## What's next

<CardGroup cols={2}>
  <Card title="Generate a runbook" icon="wand-magic-sparkles" href="/guides/generate-runbook">
    Learn how AI builds runbooks from a goal.
  </Card>

  <Card title="Variables and secrets" icon="key" href="/guides/variables-and-secrets">
    Securely pass credentials to runbooks.
  </Card>
</CardGroup>
