---
title: "Learn Classification Defaults"
method: POST
path: "/extensions/roboledger/{graph_id}/operations/learn-classification-defaults"
tags: ["RoboLedger: Ledger & Events"]
---

# Learn Classification Defaults

`POST /extensions/roboledger/{graph_id}/operations/learn-classification-defaults`

## Request

- Base URL: `https://api.robosystems.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.robosystems.ai/extensions/roboledger/{graph_id}/operations/learn-classification-defaults`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Seed each counterparty's default account from the bank lines already committed to the books, one for each entity whose lines it has: the account most of those lines went to becomes the default, with the lines that agreed counted as confirmations. A default already there is kept. Its still-open lines are then suggested from the default. Run it once on books that were classified before defaults were learned; after that, every commit teaches the default by itself. `dry_run` reports what would be learned without writing it.

**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.

## Path parameters

- `graph_id` string, required

## Headers

- `Idempotency-Key` string, nullable

## Request body

- LearnClassificationDefaultsRequest: Seed counterparty defaults from the bank lines already committed.
  - `dry_run` boolean: Report what would be learned without writing it.

## Response `200`

Successful Response

- OperationEnvelopeLearnClassificationDefaultsResponse
  - `operation` string, required: Kebab-case operation name
  - `operationId` string, required: op_-prefixed ULID for audit and SSE correlation
  - `status` 'completed' | 'pending' | 'failed', required: Operation lifecycle state
  - `result` LearnClassificationDefaultsResponse: What seeding the defaults learned.
    - `agents_learned` integer, required: Defaults learned from committed lines, one per counterparty and entity.
    - `agents_kept` integer, required: Counterparty and entity pairs that already had a default, left as they were.
    - `lines_read` integer, required: Committed lines classified to a single account that were read.
    - `open_lines_resuggested` integer, required: Still-open lines whose suggestion changed as a result.
    - `dry_run` boolean, required
  - `at` string, required: ISO-8601 UTC timestamp
  - `createdBy` string, nullable: User ID that initiated the operation
  - `idempotentReplay` boolean: True when this envelope came from the idempotency cache — the underlying command did not execute again. False on fresh executions.

## Other responses

- `400`: Invalid request
- `401`: Authentication required
- `403`: Access denied
- `404`: Resource not found
- `409`: Idempotency-Key conflict — key reused with different body
- `422`: Validation error
- `429`: Rate limit exceeded
- `500`: Internal server error

---

[API](https://skmtc.dev/robosystems/apis/robosystems-api.md) · [All operations](https://skmtc.dev/robosystems/apis/robosystems-api/llms.txt) · [OpenAPI document](https://skmtc.dev/robosystems/apis/robosystems-api/revisions/e661e2d5ca6a?raw)
