# Close the books every month

URL: /workflows/guides/close-the-books-every-month · Id: `guide:close-the-books-every-month`

> Every Stripe payout and bank line matched, the month locked by the third business day, and a profit and loss in your inbox.

Every month, each Stripe payout and bank line is matched to its entry and the [Period](/business/nouns/period) closes and locks. You get a profit and loss by the third business day.

Needs: [Take a payment](/systems/finance/take-a-payment)

**Before it runs**

- You leave the chat: Never: it all happens in the chat.

## What you get
- 1 month checked line by line: every Stripe payout and bank line matched to your books (Transaction)
- 1 month closed and locked by the third business day (Period)
- 1 profit and loss, balance sheet and cash flow for the month (Report)
- 1 Task to you for each line it could not match (Task)

## Your agent does
**For agents**

- Guide: `guide:close-the-books-every-month`, status `live`. Page: [/workflows/guides/close-the-books-every-month.md](/workflows/guides/close-the-books-every-month.md).
- Approval: none. Run it when the founder asks.
- Leaves the chat: never.
- Needs first: [Take a payment](/systems/finance/take-a-payment).
- Run: call the steps in order, each through the API, SDK, CLI or MCP tab below; a later step passes the `$id` an earlier one returns. Each value marked example is the sample business’s: pass the founder’s own.

| Step | Verb | Inputs (type, required, this guide’s value) | Returns |
| --- | --- | --- | --- |
| 1 | [`Process.enable`](/business/nouns/process/enable) (`verb:Process.enable`) | `process` Process (an id), required: example `"process_books"` | `process` Process |
| 2 | [`Setting.update`](/business/nouns/setting/update) (`verb:Setting.update`) | `id` string, required: example `"setting_1"`; `key` string: example `"close.businessDay"`; `value` json: example `3` | `setting` Setting |

Returns: the last call answers with `setting` and its `action`, whose `status` is `done`, `pending` (waiting on an Approval or a Worker), `failed`, `canceled` or `refused`:

```json
{
  "api": "https://api.sb/leaseline.app",
  "setting": {
    "$id": "https://api.sb/leaseline.app/settings/setting_1",
    "$type": "Setting",
    "key": "close.businessDay",
    "value": 3
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/action_1",
    "operation": "Setting.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/action_1"
  }
}
```

Next: offer “Send the profit and loss to my accountant too”, or “Do not lock a month until I approve it”.

Calls: `Process.enable` → `Setting.update`

Ask:

```text
Close the books every month.
Close last month.
Are the books reconciled?
```

API:

```bash
# 1. Process.enable
curl -X POST https://api.sb/leaseline.app/processes/process_books/enable \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"

# 2. Setting.update
curl -X PATCH https://api.sb/leaseline.app/settings/setting_1 \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value":3,"key":"close.businessDay"}'
```

SDK:

```ts
import { $ } from 'startup-builder'

await $.Process.enable({ process: 'process_books' })
await $.Setting.update({ id: 'setting_1', value: 3, key: 'close.businessDay' })
```

CLI:

```bash
npx startup-builder do Process.enable --json '{"process":"process_books"}'
npx startup-builder do Setting.update --json '{"id":"setting_1","value":3,"key":"close.businessDay"}'
```

MCP:

```json
{
  "name": "do",
  "arguments": {
    "code": "await $.Process.enable({ process: 'process_books' })\nreturn await $.Setting.update({ id: 'setting_1', value: 3, key: 'close.businessDay' })"
  }
}
```

## Change it
- Send the profit and loss to my accountant too.
- Do not lock a month until I approve it.
- Show me cash, not accrual.

## Under the hood
- Systems: [Ledger](/systems/ledger), [Reports](/systems/reports), [Treasury](/systems/treasury)
- Nouns: [Period](/business/nouns/period), [Transaction](/business/nouns/transaction), [Entry](/business/nouns/entry), [Setting](/business/nouns/setting)
- Events: [`Transaction.reconciled`](/business/events/Transaction.reconciled), [`Period.closed`](/business/events/Period.closed), [`Period.locked`](/business/events/Period.locked)
- Stripe objects: `Payout`, `Balance Transaction`

Close monthly from your first sale. A year of unreconciled lines costs a week of an accountant's time; a month costs your agent minutes. Taxes file from locked Periods, so a late close is a late return.