Contract
- shape
- entity
- authority
- act
- evidence
- none
- subscription
- false
- permission
- any one of: org.admin (carried by the caller's role template in the org `org_id`, or by a role held on the unit `unit_id` or any unit above it by a member of that org; without `unit_id`, by the template); org.member (carried by the caller's role template in the org `org_id`, or by a role held on the unit `unit_id` or any unit above it by a member of that org; without `unit_id`, by the template); a deactivated caller is refused first
- idempotency
- natural
- emits
- unit_role.revoked
- MCP tool
- revoke_unit_role
- decision_set
- approve, reject
- REST
- POST https://api.containertradehq.com/v1/cap/revoke_unit_role
Through MCP this call returns an approval request first; see Approvals.
Idempotency: keyed by the contract's own inputs: the same inputs replay the first call's result
Inputs
| name | type | required | validation |
|---|---|---|---|
| org_id | org_id | required | tradehq-org-id; 1 to 20 characters The org whose tree the unit is in. |
| unit_id | unit_id | required | tradehq-unit-id The unit the role is held on. |
| user_id | user_id | required | tradehq-user-id; 1 to 20 characters Who holds it. |
Response
org_id· string · The org.unit_id· string · The unit.unit_name· string · The unit's name.user_id· string · Who held it.role_template_id· stringnull · The template the removed grant carried; null when there was none to remove.revoked· boolean · Always true: they hold no role on this unit now.
Full JSON Schema
{
"type": "object",
"properties": {
"org_id": {
"type": "string",
"minLength": 1,
"maxLength": 20,
"pattern": "^[A-Za-z0-9_-]{1,20}$",
"format": "tradehq-org-id",
"description": "The org.",
"x-data-class": "operational"
},
"unit_id": {
"type": "string",
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
"format": "tradehq-unit-id",
"description": "The unit.",
"x-data-class": "operational"
},
"unit_name": {
"type": "string",
"description": "The unit's name.",
"x-data-class": "operational"
},
"user_id": {
"type": "string",
"minLength": 1,
"maxLength": 20,
"pattern": "^[A-Za-z0-9_-]{1,20}$",
"format": "tradehq-user-id",
"description": "Who held it.",
"x-data-class": "operational"
},
"role_template_id": {
"type": [
"string",
"null"
],
"description": "The template the removed grant carried; null when there was none to remove.",
"x-data-class": "operational"
},
"revoked": {
"type": "boolean",
"description": "Always true: they hold no role on this unit now.",
"x-data-class": "operational"
}
},
"required": [
"org_id",
"unit_id",
"unit_name",
"user_id",
"role_template_id",
"revoked"
],
"additionalProperties": false
} Refusals
own_access· 422 · You can't change your own access. Another admin can.unit_outside_caller· 422 · You administer {your unit} and the units beneath it. {unit} is outside it.holder_above_caller· 422 · {Name}'s role on {unit} carries {permission}, which you don't hold there.tree_too_large· 422 · the org's unit tree holds more units than one call reads
The platform refusals apply to every call: version, authentication, authority, validation and rate limits, each in the same envelope.
Surfaces
- Mobile: degraded: composition
- MCP: approval required
- Voice: degraded: confirmation
- OneBox: no document originates a unit role
- Outbound: crosses to no counterparty
Events
unit_role.revokedaudit_only
Related
grant_unit_role, impersonate_user, list_sessions, list_unit_access, revoke_sessions, set_member_role