iam.agent-sessions.set-scope

Allow an agent session to write or destroy for a while, or drop it to read-only

POST /iam/api/agent-sessions/{id}/scopeIAM iam:UpdateAgentSessionChanges state

Raising a session needs a person signed in to the console; an access key or OAuth token is refused, so an agent cannot raise itself. Your own agents need no IAM action.

Request syntax

POST /iam/api/agent-sessions/{id}/scope
{
  "scope": "enum",
  "durationMinutes": "number"
}

Path parameters

  • idRequired

    string

    Constraints: uuid

Request body

  • scopeRequired

    enum

    What the session may do

    One of: read, write, destructive

  • durationMinutesOptional

    number

    15, 60 or 480. Default: 60 for write, 15 for destructive

    Constraints: integer

Response

200 with { id, scope, scopeExpiresAt }: when the raised scope falls back to read (null for read).

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow iam:UpdateAgentSession on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud iam agent-sessions set-scope id --scope read

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_iam_agent-sessions_set-scope.