> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prisme.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Change an agent share's role

> Change the role of the binding for the given (principal_type, principal_id) pair, in place. Revoking and re-creating is not equivalent: the two calls have no transaction around them, and the revoke half is refused when the binding is the resource's last one.

`owner` is not accepted, although it is a defined agent role: it is the only share role carrying `delete`, and this endpoint is reachable by anyone holding `share`. It also never conferred ownership - an agent's owner is its `owner_id`, and a binding with that role resolves to `admin`.

The caller's own access cannot be changed, for the same reason it cannot be revoked: lowering one's own role drops them out of the panel they are acting from, on an agent they may be the only administrator of.



## OpenAPI

````yaml /api-reference/agent-factory/swagger.yml patch /v1/agents/{agentId}/access/{principalType}/{principalId}
openapi: 3.0.3
info:
  version: 1.0.0
  title: Agent Factory API
  description: |
    Public REST API for the Agent Factory workspace - agents, conversations,
    messages, tools, artifacts, sharing, ratings, and discovery.
    Powered by Prisme.ai's runtime; all endpoints are exposed under each
    workspace's webhook namespace.
  contact:
    name: Prisme.ai
    url: https://prisme.ai
servers:
  - url: https://{host}/v2/workspaces/slug:agent-factory/webhooks
    description: Prisme.ai workspace webhooks
    variables:
      host:
        default: api.studio.prisme.ai
        description: API host (override for self-hosted or sandbox)
security:
  - BearerAuth: []
  - OrgApiKeyAuth: []
tags:
  - name: Agents
    description: Agent CRUD, discovery, AGENTS.md import/export.
  - name: Access
    description: Agent access bindings, sharing, and access requests.
  - name: ApiKeys
    description: Agent-scoped API key management (mint, revoke, rotate).
  - name: Publishing
    description: Publish or discard draft changes on an agent.
  - name: Ratings
    description: User ratings on published agents.
  - name: Profiles
    description: >-
      Agent profiles/presets catalog (simple, workflow, agent_light, agent_full,
      orchestrator).
  - name: Activity
    description: Activity feed for agents (events, errors, lifecycle changes).
  - name: Analytics
    description: Agent usage analytics (series + summary).
  - name: Conversations
    description: Conversations on an agent (CRUD, archive, star).
  - name: Messages
    description: Send messages to an agent (synchronous send + SSE stream).
  - name: Tasks
    description: Async task lifecycle (list, fetch, cancel, resolve, subscribe).
  - name: Artifacts
    description: Generated artifacts (files, code, content) attached to a task.
  - name: Shares
    description: Conversation, message, and artifact share-link snapshots.
  - name: A2A
    description: Agent-to-agent JSON-RPC 2.0 gateway (well-known agent.json + RPC).
  - name: Tools
    description: Per-agent tool catalogue (system tools, MCP servers, function tools).
  - name: Retention
    description: Per-agent and org-wide conversation retention policies.
  - name: Traces
    description: >-
      Execution traces of agent turns (editor debugging,
      `agent-factory:traces:read`).
  - name: Evaluations
    description: Agent evaluation runs and results.
  - name: Admin
    description: |
      GDPR operations called by the AI Insights admin screens. They require
      elevated permissions: the caller must be a platform administrator
      (`platformRole` `superadmin` or `root`). The export route also lets a
      user export their own data. Each route is rate limited to 10 calls per
      hour per caller.
paths:
  /v1/agents/{agentId}/access/{principalType}/{principalId}:
    patch:
      tags:
        - Access
      summary: Change an agent share's role
      description: >-
        Change the role of the binding for the given (principal_type,
        principal_id) pair, in place. Revoking and re-creating is not
        equivalent: the two calls have no transaction around them, and the
        revoke half is refused when the binding is the resource's last one.


        `owner` is not accepted, although it is a defined agent role: it is the
        only share role carrying `delete`, and this endpoint is reachable by
        anyone holding `share`. It also never conferred ownership - an agent's
        owner is its `owner_id`, and a binding with that role resolves to
        `admin`.


        The caller's own access cannot be changed, for the same reason it cannot
        be revoked: lowering one's own role drops them out of the panel they are
        acting from, on an agent they may be the only administrator of.
      operationId: updateAgentAccess
      parameters:
        - name: agentId
          in: path
          required: true
          schema:
            type: string
            maxLength: 64
        - name: principalType
          in: path
          required: true
          schema:
            type: string
            enum:
              - user
              - group
              - org
            maxLength: 32
        - name: principalId
          in: path
          required: true
          schema:
            type: string
            maxLength: 128
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - role_slug
              properties:
                role_slug:
                  type: string
                  enum:
                    - user
                    - admin
                  maxLength: 64
      responses:
        '200':
          description: Binding updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  updated:
                    type: boolean
                  binding:
                    $ref: '#/components/schemas/AccessBinding'
        '400':
          description: >-
            Invalid `principal_type`, unknown or forbidden `role_slug`, or an
            attempt to change the caller's own access
            (`CANNOT_MODIFY_OWN_ACCESS`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No binding found for this principal.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    AccessBinding:
      type: object
      description: Access binding granting a principal a role on an agent.
      properties:
        agent_id:
          type: string
        principal_type:
          type: string
          enum:
            - user
            - group
            - org
        principal_id:
          type: string
        email:
          type: string
        orgSlug:
          type: string
        granted_by:
          type: string
        role_slug:
          type: string
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          description: >-
            Stable PascalCase or SNAKE_CASE error code (e.g. AgentNotFound,
            VALIDATION_ERROR, FORBIDDEN, METHOD_NOT_ALLOWED).
        message:
          type: string
          description: Human-readable error message.
        details:
          type: object
          description: Optional structured context for the error.
          additionalProperties: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        User-bound credential carrying an identity: either a session JWT
        or a user access token (`at:*`) generated from the user settings UI.
        Send as `Authorization: Bearer <token>`.
        Org API keys (`iak_*`) are **not** accepted here - they carry
        no user identity. Use the `x-prismeai-api-key` header instead
        (see `OrgApiKeyAuth`).
    OrgApiKeyAuth:
      type: apiKey
      in: header
      name: x-prismeai-api-key
      description: |
        Organization API key (`iak_{orgSlug}_{uuid}`). Unlike
        `Authorization: Bearer`, this credential is **not** tied to a user
        identity - it is bound to the org and its effective access is
        defined by the scopes / permission rules attached to it (it can
        be restricted to a single project, or kept broader).
        For Agent Factory, these keys can be generated directly from
        the Agent Factory UI (in addition to the AI Governance settings).
        Send as `x-prismeai-api-key: iak_...`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.