# Approval request

Record a request for an operation requiring approval.

Capability: op_sys_command_approval_request
Protocol: op-sys.capabilities.v1
Runtime: 0.3.0
Availability: Optional local integration
Optional integration: true
Canonical page: /docs/reference/op_sys_command_approval_request

## Authority

Local policy and approver configuration determine permission. Approval is scoped to its operation; it is not a blanket privilege escalation.

## Invocation

CLI, SDK and MCP use the same operation and arguments; where a hosted HTTP binding exists, its route carries the same domain contract. Host paths and environment references refer to the runtime host. Request template: replace placeholder IDs and supply complete contract-specific objects before use. This is not a complete runnable workflow.

### CLI

```sh
op-sys --output json tools call op_sys_command_approval_request \
  --arguments '{"action":"<action>","reason":"<reason>","target_id":"<target_id>","target_type":"<target_type>"}'
```

### Python SDK

```python
import json
from op_sys import OpSys

client = OpSys()
arguments = json.loads("{\"action\":\"<action>\",\"reason\":\"<reason>\",\"target_id\":\"<target_id>\",\"target_type\":\"<target_type>\"}")
result = client.capabilities.call(
    "op_sys_command_approval_request", arguments
)
print(result)
```

### MCP (initialized connection)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "op_sys_command_approval_request",
    "arguments": {
      "action": "<action>",
      "reason": "<reason>",
      "target_id": "<target_id>",
      "target_type": "<target_type>"
    }
  }
}
```

Named CLI command: op-sys approval request (use --help for flags).

## Parameters

### action

Required; string. 



### actor

Optional; string. Actor recorded on writes and audit entries.

Schema default: "operator". Send null only if the input schema permits it.



### allow_legacy_insecure

Optional; boolean. HIGH: time-bounded untrusted v1/HMAC recovery; discard keystore.json, never import keys.

Schema default: false. Send null only if the input schema permits it.



### allow_unsigned

Optional; boolean. HIGH: recover deliberately unsigned v2 data using a distinct reasoned one-shot approval.

Schema default: false. Send null only if the input schema permits it.



### approval_context

Optional; string. 



### artifact_kind

Optional; string. 



### artifact_path

Optional; string. 



### bundle

Optional; string. Verified state.import bundle used to build its exact operation intent.



### comment_kind

Optional; string. 



### entity_type

Optional; string. 



### event_type

Optional; string. 



### max_archive_bytes

Optional; integer. Lower the ZIP archive bytes limit (1–17179869184; default 17179869184).

Schema default: 17179869184. Send null only if the input schema permits it.



### max_compression_ratio

Optional; integer. Lower the ZIP compression ratio limit (1–200; default 200).

Schema default: 200. Send null only if the input schema permits it.



### max_entries

Optional; integer. Lower the ZIP entries limit (1–8192; default 8192).

Schema default: 8192. Send null only if the input schema permits it.



### max_entry_bytes

Optional; integer. Lower the ZIP entry bytes limit (1–34359738368; default 34359738368).

Schema default: 34359738368. Send null only if the input schema permits it.



### max_filename_bytes

Optional; integer. Lower the ZIP filename bytes limit (1–1024; default 1024).

Schema default: 1024. Send null only if the input schema permits it.



### max_path_depth

Optional; integer. Lower the ZIP path depth limit (1–16; default 16).

Schema default: 16. Send null only if the input schema permits it.



### max_total_bytes

Optional; integer. Lower the ZIP total bytes limit (1–68719476736; default 68719476736).

Schema default: 68719476736. Send null only if the input schema permits it.



### operation_json

Optional; string. Exact operation arguments as JSON; free-form effects are hashed in the review intent.



### override_reason

Optional; string. Exact non-secret recovery reason (one line, at most 1024 characters); repeat it unchanged for approval and import.



### payload

Optional; string. Consumer-defined JSON value validated against the selected admitted contract.



### reason

Required; string. 



### relation_type

Optional; string. 



### session_id

Optional; string. 



### target_id

Required; string. 



### target_type

Required; string. 



### ttl_seconds

Optional; integer. 



### worker_id

Optional; string. 



### workflow

Optional; string. 



### workflow_version

Optional; string. 



### Complete input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "action": {
      "type": "string"
    },
    "actor": {
      "default": "operator",
      "description": "Actor recorded on writes and audit entries.",
      "type": "string"
    },
    "allow_legacy_insecure": {
      "default": false,
      "description": "HIGH: time-bounded untrusted v1/HMAC recovery; discard keystore.json, never import keys.",
      "type": "boolean"
    },
    "allow_unsigned": {
      "default": false,
      "description": "HIGH: recover deliberately unsigned v2 data using a distinct reasoned one-shot approval.",
      "type": "boolean"
    },
    "approval_context": {
      "type": "string"
    },
    "artifact_kind": {
      "type": "string"
    },
    "artifact_path": {
      "type": "string"
    },
    "bundle": {
      "description": "Verified state.import bundle used to build its exact operation intent.",
      "type": "string"
    },
    "comment_kind": {
      "type": "string"
    },
    "entity_type": {
      "type": "string"
    },
    "event_type": {
      "type": "string"
    },
    "max_archive_bytes": {
      "default": 17179869184,
      "description": "Lower the ZIP archive bytes limit (1–17179869184; default 17179869184).",
      "type": "integer"
    },
    "max_compression_ratio": {
      "default": 200,
      "description": "Lower the ZIP compression ratio limit (1–200; default 200).",
      "type": "integer"
    },
    "max_entries": {
      "default": 8192,
      "description": "Lower the ZIP entries limit (1–8192; default 8192).",
      "type": "integer"
    },
    "max_entry_bytes": {
      "default": 34359738368,
      "description": "Lower the ZIP entry bytes limit (1–34359738368; default 34359738368).",
      "type": "integer"
    },
    "max_filename_bytes": {
      "default": 1024,
      "description": "Lower the ZIP filename bytes limit (1–1024; default 1024).",
      "type": "integer"
    },
    "max_path_depth": {
      "default": 16,
      "description": "Lower the ZIP path depth limit (1–16; default 16).",
      "type": "integer"
    },
    "max_total_bytes": {
      "default": 68719476736,
      "description": "Lower the ZIP total bytes limit (1–68719476736; default 68719476736).",
      "type": "integer"
    },
    "operation_json": {
      "description": "Exact operation arguments as JSON; free-form effects are hashed in the review intent.",
      "type": "string"
    },
    "override_reason": {
      "description": "Exact non-secret recovery reason (one line, at most 1024 characters); repeat it unchanged for approval and import.",
      "type": "string"
    },
    "payload": {
      "type": "string"
    },
    "reason": {
      "type": "string"
    },
    "relation_type": {
      "type": "string"
    },
    "session_id": {
      "type": "string"
    },
    "target_id": {
      "type": "string"
    },
    "target_type": {
      "type": "string"
    },
    "ttl_seconds": {
      "type": "integer"
    },
    "worker_id": {
      "type": "string"
    },
    "workflow": {
      "type": "string"
    },
    "workflow_version": {
      "type": "string"
    }
  },
  "required": [
    "action",
    "reason",
    "target_id",
    "target_type"
  ],
  "type": "object"
}
```

## Behavior

- Inspect the requested action and current approval before deciding or revoking it.
- An approval record does not automatically execute an action. The consuming operation still performs its checks.
- Keep the original approval ID and operation binding when retrying. Audit history records decisions.

## Response

Returns a payload under approval. See the output manual for field semantics and optional fields.

[Runtime output field catalog](/docs/output-contracts.json) (descriptive contracts, not JSON Schema validators).

CLI: use --output json. For tools call, read the operation result at payload.tool.result; payload.tool.name identifies the capability. The outer envelope is {schema_version: "v1", payload: {tool: {name, result}}}.

Python: client.capabilities.call(name, arguments) returns the operation result. SDK exceptions preserve reason and code.

MCP: tools/call returns JSON text and structuredContent. Application failures set isError; inspect reason/code instead of matching message text.

No standalone response JSON Schema is published for this operation. The input schema is not a response contract.

## Errors and recovery



Family reasons are representative, not exhaustive.

A timeout is not proof that a write failed. Reuse the documented retry identity, batch, offset or mutation ID. If this operation has no documented retry identity, inspect its state before repeating it.

On authorization failure, correct the configured identity or grants; do not change the local actor to impersonate a hosted principal. On validation failure, correct the input against the published schema and selected contract.

On a revision or state conflict, retrieve current state and reconcile intent. Do not automatically overwrite a competing update. Preserve unknown additive response fields when building consumers.

## Source manuals

- [approvals](/docs/raw/manuals/approvals.md)
- [command-output-schema](/docs/raw/manuals/command-output-schema.md)
- [operational-boundaries](/docs/raw/manuals/operational-boundaries.md)
- [public-capabilities](/docs/raw/manuals/public-capabilities.md)
