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

# Bank Statement To JSON

> Extract account metadata and transactions with Extract -> Schema.

## Goal

Turn a bank statement into normalized JSON with citations for the fields your application needs.

## Sample Document

Use the built-in [Bank Statement Platform example](https://platform.runpulse.com/dashboard/examples/637e5678-30b1-45fa-acc4-877f2d636419). The example includes a saved schema with fields for `account_number`, `account_holder`, `summary`, `transactions`, and `checks_paid`.

## Use This Workflow

```mermaid theme={null}
flowchart LR
    A[Bank statement PDF] --> B["/extract"]
    B --> C["extraction_id"]
    C --> D["/schema"]
    D --> E[Statement JSON]
```

Use **Extract -> Schema** because a bank statement usually has one document-level structure: account identity, statement period, summary balances, transaction rows, and checks.

## Platform Steps

<Steps>
  <Step title="Upload the statement">
    Open **New Extraction**, upload a representative statement, and run Extract.
  </Step>

  <Step title="Add Schema">
    Add a Schema step and define fields for account metadata, balances, transactions, and checks.
  </Step>

  <Step title="Test citations">
    Review the Schema result and click citations to confirm each value came from the right part of the document.
  </Step>

  <Step title="Save a schema preset">
    Once the output is stable, save the schema preset and use Show Code for the production implementation.
  </Step>
</Steps>

## Schema

```json theme={null}
{
  "type": "object",
  "properties": {
    "account_number": {
      "type": "string",
      "description": "The bank account number shown on the statement"
    },
    "account_holder": {
      "type": "string",
      "description": "The person or business that owns the account"
    },
    "summary": {
      "type": "object",
      "description": "Opening balance, deposits, withdrawals, fees, and closing balance",
      "properties": {
        "opening_balance": { "type": "number" },
        "closing_balance": { "type": "number" },
        "total_deposits": { "type": "number" },
        "total_withdrawals": { "type": "number" }
      }
    },
    "transactions": {
      "type": "array",
      "description": "Individual transaction rows in the statement",
      "items": {
        "type": "object",
        "properties": {
          "date": { "type": "string" },
          "description": { "type": "string" },
          "amount": { "type": "number" },
          "type": { "type": "string", "enum": ["credit", "debit"] }
        }
      }
    }
  },
  "required": ["account_number", "account_holder", "summary", "transactions"]
}
```

## Python

```python theme={null}
from pulse import Pulse

client = Pulse(api_key="YOUR_API_KEY")

schema = {
    "type": "object",
    "properties": {
        "account_number": {"type": "string", "description": "The account number"},
        "account_holder": {"type": "string", "description": "The owner of the account"},
        "summary": {
            "type": "object",
            "properties": {
                "opening_balance": {"type": "number"},
                "closing_balance": {"type": "number"},
                "total_deposits": {"type": "number"},
                "total_withdrawals": {"type": "number"},
            },
        },
        "transactions": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "date": {"type": "string"},
                    "description": {"type": "string"},
                    "amount": {"type": "number"},
                    "type": {"type": "string", "enum": ["credit", "debit"]},
                },
            },
        },
    },
    "required": ["account_number", "account_holder", "summary", "transactions"],
}

extract_result = client.extract(
    file_url="https://platform.runpulse.com/api/examples/637e5678-30b1-45fa-acc4-877f2d636419/pdf"
)

schema_result = client.schema(
    extraction_id=extract_result.extraction_id,
    schema_config={
        "input_schema": schema,
        "schema_prompt": "Extract statement metadata, balances, transactions, and checks.",
    },
)

print(schema_result.schema_output["values"])
```

## TypeScript

```typescript theme={null}
import { PulseClient } from "pulse-ts-sdk";

const client = new PulseClient({ apiKey: "YOUR_API_KEY" });

const extractResult = await client.extract({
  fileUrl: "https://platform.runpulse.com/api/examples/637e5678-30b1-45fa-acc4-877f2d636419/pdf",
});

const schemaResult = await client.schema({
  extraction_id: extractResult.extraction_id,
  schema_config: {
    input_schema: {
      type: "object",
      properties: {
        account_number: { type: "string", description: "The account number" },
        account_holder: { type: "string", description: "The owner of the account" },
        summary: {
          type: "object",
          properties: {
            opening_balance: { type: "number" },
            closing_balance: { type: "number" },
            total_deposits: { type: "number" },
            total_withdrawals: { type: "number" },
          },
        },
        transactions: {
          type: "array",
          items: {
            type: "object",
            properties: {
              date: { type: "string" },
              description: { type: "string" },
              amount: { type: "number" },
              type: { type: "string", enum: ["credit", "debit"] },
            },
          },
        },
      },
      required: ["account_number", "account_holder", "summary", "transactions"],
    },
    schema_prompt: "Extract statement metadata, balances, transactions, and checks.",
  },
});

console.log(schemaResult.schema_output?.values);
```

## Checks

* Reconcile extracted transaction totals against the statement summary before writing to a system of record.
* Keep debits, credits, fees, and checks explicit; do not rely on sign alone if your downstream ledger expects labels.
* Review citations for any transaction used in compliance, underwriting, lending, or audit workflows.
* Save a schema preset after testing several statement formats.

## Related

<CardGroup cols={2}>
  <Card title="Extract -> Schema" icon="brackets-curly" href="/platform-reference/extract-schema">
    Build this visually in the Platform.
  </Card>

  <Card title="Schema Guidelines" icon="book" href="/api-reference/structured-output-guidelines">
    Improve structured output quality.
  </Card>
</CardGroup>
