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

# Edit Chat

> Updates a chat's name or members.



## OpenAPI

````yaml api-reference/v01.12.00/openapi-v01.12.00.json PATCH /workers/{id}/chats/{chat_id}
openapi: 3.0.0
info:
  title: Roosted
  version: 0.1.12
  contact:
    name: Support
    url: https://support.roostedhr.com/support/home
    email: support@roostedhr.com
  description: |-
    Enterprise API

    Sandbox keys and Production keys are requested from support
servers:
  - url: https://api.roostedhr.com/api/1_12
  - url: https://sandbox.roostedhr.com/api/1_12
security:
  - X-API-KEY: []
tags:
  - name: Announcements
  - name: Areas
  - name: Clients
  - name: Company
  - name: Configuration
  - name: Events
  - name: Locations
  - name: Payroll Groups
  - name: Rate Cards
  - name: Shifts
  - name: Skillsets
  - name: Time Tracking
  - name: Wage Rules
  - name: Workers
paths:
  /workers/{id}/chats/{chat_id}:
    parameters:
      - schema:
          type: string
        name: id
        in: path
        required: true
        description: Worker ID
      - schema:
          type: string
        name: chat_id
        in: path
        required: true
        description: Chat ID
    patch:
      tags:
        - Workers
      summary: Edit Chat
      description: Updates a chat's name or members.
      operationId: patch-chat
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: New chat name.
                members:
                  type: array
                  description: >-
                    Updated array of worker IDs. Replaces the current member
                    list.
                  items:
                    type: string
            examples:
              Rename chat:
                value:
                  name: Project Alpha Team
              Update members:
                value:
                  members:
                    - '3158'
                    - '120915'
                    - '45023'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Chat ID.
                  name:
                    type: string
                    description: Chat name.
                  chat_admin:
                    type: integer
                    minimum: 0
                    maximum: 1
                    description: Whether the current worker is the chat admin.
                  silenced:
                    type: integer
                    minimum: 0
                    maximum: 1
                    description: Whether the chat is silenced for the current worker.
                  on_chat:
                    type: integer
                    minimum: 0
                    maximum: 1
                    description: Whether the current worker is on the chat.
                  locked:
                    type: integer
                    minimum: 0
                    maximum: 1
                    description: Whether the chat is locked.
                  date_created:
                    type: string
                    format: date-time
                    description: Timestamp when the chat was created.
                  most_recent_message_id:
                    type: string
                    nullable: true
                    description: ID of the most recent message.
                  last_message_timestamp:
                    type: string
                    format: date-time
                    nullable: true
                    description: Timestamp of the most recent message.
                  message:
                    type: string
                    nullable: true
                    description: Preview of the most recent message.
                  name_first:
                    type: string
                    nullable: true
                    description: First name of the most recent message sender.
                  selected_picture_location:
                    type: string
                    nullable: true
                    description: Profile picture URL of the most recent message sender.
                  chats_order:
                    type: string
                    format: date-time
                    description: Sort timestamp for chat ordering.
                  unread_count:
                    type: integer
                    minimum: 0
                    description: Number of unread messages.
                  members:
                    type: array
                    description: List of chat members.
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Worker ID.
                        name_first:
                          type: string
                          description: First name.
                        name_last:
                          type: string
                          description: Last name.
                        selected_picture_location:
                          type: string
                          nullable: true
                          description: Profile picture URL.
              examples:
                Success:
                  value:
                    id: yJjarB5xUW
                    name: Project Alpha Team
                    chat_admin: '1'
                    silenced: '0'
                    on_chat: '1'
                    locked: '0'
                    date_created: '2024-01-05T20:13:00.000Z'
                    most_recent_message_id: null
                    last_message_timestamp: null
                    message: null
                    name_first: null
                    selected_picture_location: null
                    chats_order: '2024-01-05T20:13:00.000Z'
                    unread_count: '0'
                    members:
                      - id: '3158'
                        name_first: Chris
                        name_last: Davis
                        selected_picture_location: example/1
                      - id: '120915'
                        name_first: Aaron
                        name_last: Labrado
                        selected_picture_location: example/2
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                No update data provided:
                  value:
                    code: WRK-3500
                    error: No update data provided
                Invalid members data:
                  value:
                    code: WRK-3500
                    error: Invalid members data
                Invalid member IDs:
                  value:
                    code: WRK-3500
                    error: Invalid member IDs
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Invalid or missing API key:
                  value:
                    code: ATH-100
                    error: Invalid or missing API key
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Insufficient permissions to manage chats:
                  value:
                    code: WRK-3200
                    error: Insufficient permissions to manage chats
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Worker not found:
                  value:
                    code: WRK-300
                    error: Worker not found
                Chat not found:
                  value:
                    code: WRK-3400
                    error: Chat not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Unexpected error during update:
                  value:
                    code: WRK-600
                    error: An unexpected error occurred while updating the worker
                Failed to update worker:
                  value:
                    code: WRK-310
                    error: Failed to update worker
components:
  securitySchemes:
    X-API-KEY:
      name: X-API-KEY
      type: apiKey
      in: header

````