---
title: "Update Agent"
method: POST
path: "/extensions/roboledger/{graph_id}/operations/update-agent"
tags: ["RoboLedger: Ledger & Events"]
---

# Update Agent

`POST /extensions/roboledger/{graph_id}/operations/update-agent`

## 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/update-agent`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Patch counterparty fields. Only supplied fields are updated. Set is_active=false to deactivate (agents are never deleted — they are reference data referenced by events and transactions). `classification_element_id` sets the account this counterparty's bank lines are suggested (an empty string clears it), and `classification_mode='always_ask'` stops suggesting one for a counterparty whose lines go to different accounts; its still-open lines are re-suggested at once. Each entity of a group keeps its own default, on its own chart: `classification_entity_id` names the one these fields are for, omitted the group parent. A default is also learned as lines are committed, so set one by hand only to correct 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

- UpdateAgentRequest: Patch an agent. All fields except `agent_id` are optional — pass only what changes. `metadata_patch` is deep-merged into the existing metadata dict.
  - `agent_id` string, required: The agent to update.
  - `name` string, nullable
  - `legal_name` string, nullable
  - `tax_id` string, nullable
  - `registration_number` string, nullable
  - `duns` string, nullable
  - `lei` string, nullable
  - `email` string, nullable
  - `phone` string, nullable
  - `address` object, nullable
  - `is_active` boolean, nullable: Toggle activation. Inactive agents are hidden from new-transaction pickers.
  - `is_1099_recipient` boolean, nullable
  - `classification_element_id` string, nullable: The chart account this counterparty's bank lines are usually classified to, suggested on each new line. An empty string clears it. Its still-open lines are re-suggested at once. Omit to keep.
  - `classification_mode` 'suggest' | 'always_ask', nullable: `suggest` offers the default on each line; `always_ask` offers none, for a counterparty whose lines go to different accounts. Omit to keep.
  - `classification_entity_id` string, nullable: The entity whose bank lines the default above is for. Each entity keeps its own default, on its own chart. Omit for the group parent.
  - `metadata_patch` object: Deep-merged into agent.metadata. Pass `{}` to leave unchanged. The default classification is set with the fields above, not here.

## Response `200`

Successful Response

- OperationEnvelopeLedgerAgentResponse
  - `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` LedgerAgentResponse
    - `id` string, required
    - `agent_type` string, required
    - `name` string, required
    - `legal_name` string, nullable
    - `tax_id` string, nullable
    - `registration_number` string, nullable
    - `duns` string, nullable
    - `lei` string, nullable
    - `email` string, nullable
    - `phone` string, nullable
    - `address` object, nullable
    - `source` string, required
    - `external_id` string, nullable
    - `is_active` boolean, required
    - `is_1099_recipient` boolean, required
    - `classification` AgentClassification: A counterparty's default account for one entity's lines, learned from committed lines or set by hand.
      - `entity_id` string, required: The entity whose lines it is for.
      - `element_id` string, required: The default chart account.
      - `account_name` string, nullable: The account's name.
      - `mode` string, required: `suggest`: offered on each new line. `always_ask`: never offered.
      - `confirmations` integer, required: Committed lines that went to this account.
      - `overrides` integer, required: Committed lines that went elsewhere while it was the default.
      - `set_by` string, nullable: Who set or last moved it.
      - `set_at` string, nullable: When it was set or last moved.
      - `learned_from` string, nullable: The committed line it was learned from, when it was.
    - `classifications` AgentClassification[]: The default account for each entity's bank lines, one per entity.
      - `entity_id` string, required: The entity whose lines it is for.
      - `element_id` string, required: The default chart account.
      - `account_name` string, nullable: The account's name.
      - `mode` string, required: `suggest`: offered on each new line. `always_ask`: never offered.
      - `confirmations` integer, required: Committed lines that went to this account.
      - `overrides` integer, required: Committed lines that went elsewhere while it was the default.
      - `set_by` string, nullable: Who set or last moved it.
      - `set_at` string, nullable: When it was set or last moved.
      - `learned_from` string, nullable: The committed line it was learned from, when it was.
    - `created_at` string, date-time, nullable
    - `updated_at` string, date-time, nullable
    - `created_by` string, nullable
  - `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)
