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

# Update an agent

> Updates an agent's workspace role and/or display name. The role is scoped to this workspace; the display name is the agent's global name across Adraa Inbox. At least one field is required.

The workspace must keep at least one admin, and platform-managed agents (the AI agent) cannot be modified.

Rate limit: 30 requests per minute.



## OpenAPI

````yaml /api-reference/openapi.json patch /api/v1/agents/{agentId}
openapi: 3.1.0
info:
  title: Adraa Inbox API
  description: >-
    Public REST API for Adraa Inbox. Assign agents to conversations and send
    messages from your own systems. Authenticate every request with a workspace
    API token.
  version: 1.0.0
  contact:
    email: support@adraa.ai
servers:
  - url: https://api.inbox.adraa.ai
    description: Production
security:
  - apiToken: []
paths:
  /api/v1/agents/{agentId}:
    patch:
      summary: Update an agent
      description: >-
        Updates an agent's workspace role and/or display name. The role is
        scoped to this workspace; the display name is the agent's global name
        across Adraa Inbox. At least one field is required.


        The workspace must keep at least one admin, and platform-managed agents
        (the AI agent) cannot be modified.


        Rate limit: 30 requests per minute.
      operationId: updateAgent
      parameters:
        - $ref: '#/components/parameters/agentId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                nickname:
                  type: string
                  maxLength: 60
                  description: New display name, unique across Adraa Inbox.
                  example: sara
                role:
                  type: string
                  enum:
                    - agent
                    - admin
                  description: New workspace role.
      responses:
        '200':
          description: The updated agent
          content:
            application/json:
              schema:
                type: object
                properties:
                  agent:
                    $ref: '#/components/schemas/Agent'
        '400':
          description: Demoting the last admin, or a platform-managed agent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: LAST_ADMIN
                  message: The workspace must keep at least one admin
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/AgentNotFound'
        '409':
          description: Display name already in use
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: NICKNAME_TAKEN
                  message: That display name is already in use
components:
  parameters:
    agentId:
      name: agentId
      in: path
      required: true
      description: ID of the agent. List agents with `GET /api/v1/agents` to find it.
      schema:
        type: string
        example: cmbxgwq1e0000ph01i0j1k2l3
  schemas:
    Agent:
      type: object
      properties:
        id:
          type: string
          description: Agent ID — use it for assignment.
          example: cmbxgwq1e0000ph01i0j1k2l3
        email:
          type: string
          format: email
          example: sara@acme.com
        nickname:
          type: string
          description: Display name shown in conversations.
          example: sara
        role:
          type: string
          enum:
            - agent
            - admin
            - ai
          description: Workspace role. The workspace AI identity is reported as `ai`.
          example: agent
        isOnline:
          type: boolean
          example: true
        lastSeen:
          type: string
          format: date-time
          example: '2026-06-12T10:25:00.000Z'
        createdAt:
          type: string
          format: date-time
          example: '2026-05-02T08:14:00.000Z'
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code.
            message:
              type: string
              description: Human-readable explanation.
            details:
              description: Field-level details for validation errors.
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  message:
                    type: string
  responses:
    Unauthorized:
      description: Missing, invalid, or revoked API token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: INVALID_API_TOKEN
              message: Invalid or revoked API token
    AgentNotFound:
      description: Agent is not an active member of this workspace
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: AGENT_NOT_FOUND
              message: Agent not found in this workspace
  securitySchemes:
    apiToken:
      type: http
      scheme: bearer
      description: >-
        Workspace API token created in Settings → API. Tokens start with
        `adraa_`.

````