set_session_policy

Set an org's session settings

act entity tenant-private since 2026-10-01

Sets how long a session lasts in the org: signed out after idle_minutes without a request (15 to 1440) and after absolute_hours from sign-in whatever happens (1 to 168, 7 days being the most Trade HQ allows), whether a change to what someone may do signs them out (reauth_on_role_change), and whether a new sign-in signs the person's older sessions out (single_session). A session already past a new limit is signed out on its next request. Saving the settings already in effect changes nothing.

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`); account.owner (account role owner or higher in the account of the org `org_id`); a deactivated caller is refused first
idempotency
natural
emits
security_policy.changed
MCP tool
set_session_policy
decision_set
approve, reject, escalate
REST
POST https://api.containertradehq.com/v1/cap/set_session_policy

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

nametyperequiredvalidation
org_idorg_idrequiredtradehq-org-id; 1 to 20 characters
The org whose session settings to set.
idle_minutesintegerrequired15 to 1440
Minutes without a request after which a session is signed out: 15 to 1440.
absolute_hoursintegerrequired1 to 168
Hours after sign-in after which a session is signed out whatever happens: 1 to 168.
reauth_on_role_changebooleanrequired
Whether a change to someone's role, units or template signs them out.
single_sessionbooleanrequired
Whether a new sign-in signs the person's older sessions out.

Response

  • org_id · string · The org.
  • current · object · The session section as it now stands, with its version.
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"
    },
    "current": {
      "type": "object",
      "properties": {
        "section": {
          "type": "string",
          "enum": [
            "sso",
            "mfa",
            "session",
            "network",
            "drift"
          ]
        },
        "policy": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "domains": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "domain": {
                        "type": "string"
                      },
                      "required": {
                        "type": "boolean"
                      },
                      "bypass_until": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "domain",
                      "required",
                      "bypass_until"
                    ],
                    "additionalProperties": false
                  }
                },
                "connections": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "connection_id": {
                        "type": "string"
                      },
                      "jit": {
                        "type": "boolean"
                      },
                      "default_role_template": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "idp_mfa_trusted": {
                        "type": "boolean"
                      },
                      "allow_manual_additions": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "connection_id",
                      "jit",
                      "default_role_template",
                      "idp_mfa_trusted",
                      "allow_manual_additions"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "domains",
                "connections"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "mode": {
                  "type": "string",
                  "enum": [
                    "off",
                    "required",
                    "required_for_templates"
                  ]
                },
                "templates": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "grace_days": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 30
                },
                "accept_idp_mfa": {
                  "type": "boolean"
                }
              },
              "required": [
                "mode",
                "templates",
                "grace_days",
                "accept_idp_mfa"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "idle_minutes": {
                  "type": "integer",
                  "minimum": 15,
                  "maximum": 1440
                },
                "absolute_hours": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 168
                },
                "reauth_on_role_change": {
                  "type": "boolean"
                },
                "single_session": {
                  "type": "boolean"
                }
              },
              "required": [
                "idle_minutes",
                "absolute_hours",
                "reauth_on_role_change",
                "single_session"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "mode": {
                  "type": "string",
                  "enum": [
                    "off",
                    "monitor",
                    "enforce"
                  ]
                },
                "entries": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "cidr": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "cidr",
                      "label"
                    ],
                    "additionalProperties": false
                  }
                },
                "applies_to": {
                  "type": "string",
                  "enum": [
                    "members",
                    "api_keys",
                    "both"
                  ]
                }
              },
              "required": [
                "mode",
                "entries",
                "applies_to"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "action": {
                  "type": "string",
                  "enum": [
                    "quarantine",
                    "alert_only"
                  ]
                }
              },
              "required": [
                "action"
              ],
              "additionalProperties": false
            }
          ]
        },
        "is_default": {
          "type": "boolean"
        },
        "version": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1
        },
        "changed_by": {
          "type": [
            "string",
            "null"
          ]
        },
        "changed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      },
      "required": [
        "section",
        "policy",
        "is_default",
        "version",
        "changed_by",
        "changed_at"
      ],
      "additionalProperties": false,
      "description": "The session section as it now stands, with its version.",
      "x-data-class": "operational"
    }
  },
  "required": [
    "org_id",
    "current"
  ],
  "additionalProperties": false
}

Refusals

The platform refusals apply to every call: version, authentication, authority, validation and rate limits, each in the same envelope.

Surfaces

DesktopF
MobileF
APIF
MCPF*
VoiceD2
PushF
OneBoxN
OutboundN
  • MCP: approval required
  • Voice: degraded: confirmation
  • OneBox: no document originates a change to security settings
  • Outbound: crosses to no counterparty

Events

Related

None.