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

# Change Teammate

> Change the role, the team, or both, of a teammate who has joined.



## OpenAPI

````yaml patch /workspace/teammates/{user_id}
openapi: 3.0.3
info:
  title: Timelines Public API
  description: >
    # Timelines Public API


    _Some API calls may utilize message sending quota or be subject to message
    sending rate limits as described below._


    ### Credit Utilization 
      - Sending a message via API consumes 1 credit from message sending quota.
      - Sending a message with non-empty text and attachment consumes 2 credits from message sending quota.
      - If a message cannot be sent (invalid or not connected to WhatsApp number, WhatsApp server error), message sending quota will be restored (usually within a couple of hours).
    ### Message sending rate
      - Messages will be sent with random delay of about 2 seconds between each two messages (to avoid WhatsApp spam detection mechanisms). Contact support@timelines.ai if you want to modify delay for your workspace (available on Business plan only).
      - If you exceed message sending frequency, messages be queued and sent out with delay. Each queued message will consume a message sending credit, so the number of queued messages cannot exceed the available quota.
      
    ### Authorization:
      - Copy API token from [Public API page](https://app.timelines.ai/integrations/api/) in your TimelinesAI account.
      - Put the token in *Authorization* header of request as follows:
      ```
      Authorization: Bearer 4d2d0239-e28c-4f4a-8a4d-3a3ca40056b8
      ```
            
    ### Message formatting:
      - use "\n" for line breaks

    ### Input strings:
      - String fields must not contain the NUL character (U+0000).
  version: 1.3.0
servers:
  - url: https://app.timelines.ai/integrations/api
    description: Public API root URL
security:
  - bearerAuth: []
paths:
  /workspace/teammates/{user_id}:
    patch:
      summary: Change a teammate's role and team.
      description: >-
        Changes the role, the team, or both, of a teammate who has joined the
        workspace. At least one of `role` and `team_title` is required. Requires
        `MANAGE_MEMBERS` (admin and owner) when called with a personal token. A
        caller with a personal token cannot change their own role (403); their
        own team can still be changed. Nobody else can change the owner's role
        or team (403). A teammate who has not joined yet is rejected with 400;
        set the role and team of an invite with POST /workspace/invitations.
        Returns 404 if the teammate or the team is not found.
      parameters:
        - $ref: '#/components/parameters/user_id'
      requestBody:
        description: A JSON object with the new role, team, or both.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkspaceTeammateUpdate'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceTeammateInfoResponse'
        '400':
          description: >-
            Neither `role` nor `team_title` is given, `role` is not one of the
            allowed roles, or the teammate has not joined the workspace
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                no_fields:
                  summary: Neither role nor team_title is given
                  value:
                    status: error
                    message: role or team_title is required
                    error_code: validation_error
                    errors:
                      - fields:
                          - role
                          - team_title
                        msg: role or team_title is required
                invalid_role:
                  summary: role is not one of the allowed roles
                  value:
                    status: error
                    message: >-
                      role must be one of admin, team_supervisor, teammate,
                      agent, collaborator
                    error_code: validation_error
                    errors:
                      - fields:
                          - role
                        msg: >-
                          role must be one of admin, team_supervisor, teammate,
                          agent, collaborator
                not_joined:
                  summary: The teammate has not joined the workspace
                  value:
                    status: error
                    message: This teammate has not joined the workspace.
                    error_code: validation_error
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          description: >-
            The caller is changing their own role, the target is the owner and
            the caller is someone else, or the personal token's member does not
            have `MANAGE_MEMBERS`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                own_role:
                  summary: The caller changes their own role
                  value:
                    status: error
                    message: You cannot change your own role.
                    error_code: permission_denied
                owner_role:
                  summary: Someone else changes the owner's role
                  value:
                    status: error
                    message: The workspace owner's role cannot be changed.
                    error_code: permission_denied
                owner_team:
                  summary: Someone else changes the owner's team
                  value:
                    status: error
                    message: The workspace owner's team cannot be changed.
                    error_code: permission_denied
                no_manage_members:
                  summary: The personal token's member does not have MANAGE_MEMBERS
                  value:
                    status: error
                    message: Permission denied for MANAGE_MEMBERS
                    error_code: permission_denied
        '404':
          description: The teammate or the team is not found in the workspace
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                teammate:
                  summary: The teammate is not found in the workspace
                  value:
                    status: error
                    message: Teammate not found.
                    error_code: not_found
                team:
                  summary: The team in team_title is not found in the workspace
                  value:
                    status: error
                    message: Team not found.
                    error_code: not_found
components:
  parameters:
    user_id:
      description: >-
        Numeric user ID of the teammate, as returned by GET
        /workspace/teammates.
      in: path
      name: user_id
      schema:
        type: string
      required: true
      example: '42'
  schemas:
    WorkspaceTeammateUpdate:
      type: object
      description: At least one of `role` and `team_title` is required.
      properties:
        role:
          type: string
          enum:
            - admin
            - team_supervisor
            - teammate
            - agent
            - collaborator
          description: >-
            New role of the teammate. One of: collaborator, teammate, admin,
            agent, team_supervisor. Case-insensitive. The owner role cannot be
            assigned.
          example: admin
        team_title:
          type: string
          description: >-
            Title of the team to move the teammate to, as returned by GET
            /workspace/teammates. The default team is accepted as "Default" or
            "Default team".
          example: Sales
    WorkspaceTeammateInfoResponse:
      type: object
      required:
        - status
        - data
      properties:
        status:
          type: string
          example: ok
          enum:
            - ok
            - error
        data:
          $ref: '#/components/schemas/WorkspaceTeammatesItem'
    ErrorResponse:
      required:
        - message
        - status
      type: object
      properties:
        message:
          type: string
        status:
          type: string
          example: error
          enum:
            - ok
            - error
        error_code:
          type: string
          description: >-
            Stable, machine-readable error code. Use this for branching in
            client integrations.
          example: validation_error
          enum:
            - missing_credentials
            - invalid_token
            - member_not_found
            - permission_denied
            - insufficient_scope
            - plan_feature_unavailable
            - quota_exceeded
            - rate_limit_exceeded
            - validation_error
            - not_found
            - account_inactive
            - template_not_approved
            - template_wrong_waba
            - template_variables_mismatch
            - service_window_closed
            - not_supported
            - internal_error
            - account_already_connected
            - member_has_connected_account
            - member_has_phone_link_in_progress
            - number_pairing_in_progress
            - member_has_qr_connection_in_progress
            - connected_accounts_limit_reached
            - user_id_required
            - number_not_allowed
        errors:
          type: array
          description: >-
            Per-field validation diagnostics for request-schema (body/params)
            validation failures. Present only when the request failed schema
            validation; absent on business-rule `validation_error` rejections
            (which carry `message` and `error_code` only) and on
            auth/authorization/quota errors.
          items:
            $ref: '#/components/schemas/ValidationError'
    WorkspaceTeammatesItem:
      required:
        - user_id
        - display_name
        - email
        - role
        - team
        - status
        - created_at
      type: object
      properties:
        user_id:
          type: integer
          description: Unique identifier for the user
          example: 42
        display_name:
          type: string
          description: Display name of the user
          example: John Doe
        email:
          type: string
          description: Email address of the user
          example: admin@timelines.ai
        role:
          type: string
          description: Role of the user in the workspace
          example: owner
        team:
          type: string
          description: Team of the user in the workspace
          example: Default
        status:
          type: string
          description: Status of the user
          example: Active
        invitation_status:
          type: string
          description: Invitation status of the user
          example: Expired
        created_at:
          type: string
          description: Timestamp of user creation
          example: 2026-02-22 00:00:00 +0100
        whatsapp_accounts:
          type: array
          items:
            $ref: '#/components/schemas/WhatsappAccountItem'
    ValidationError:
      type: object
      required:
        - fields
        - msg
      properties:
        fields:
          type: array
          items:
            type: string
          description: >-
            Path of the offending field, as a list of keys/indexes from the
            request root.
          example:
            - url
        msg:
          type: string
          description: Validator message for that field.
          example: must be a valid http(s) URL
    WhatsappAccountItem:
      type: object
      required:
        - id
        - phone
        - connected_on
        - status
        - owner_name
        - owner_email
        - account_name
      properties:
        id:
          example: 972501111111@s.whatsapp.net
          type: string
        phone:
          example: '+972540000001'
          type: string
        connected_on:
          example: 2023-06-18 15:19:23 +0100
          type: string
        status:
          example: Active
          type: string
          description: >
            Connection status as exposed by this endpoint: `active` if the
            account is currently connected and syncing, `disconnected`
            otherwise. This is a deliberate binary — accounts that are
            internally suspended, banned, or paused are all reported here as
            `disconnected`.
        owner_name:
          example: John Doe
          type: string
        owner_email:
          type: string
          example: john.doe@acme.com
        account_name:
          example: John Doe
          type: string
          description: |
            The account's WhatsApp profile (push) name; empty string if not set.
        reachout_timelock_active:
          example: false
          type: boolean
          description: >
            Whether WhatsApp currently restricts this account from reaching out
            to people it has not spoken to. The account keeps working for the
            conversations it already has, so `status` is unaffected.
        reachout_timelock_type:
          example: RESTRICT_ALL_COMPANIONS
          type: string
          description: >
            The restriction WhatsApp named; empty string when the account is not
            restricted.
        reachout_timelock_ends_at:
          example: 2023-06-18 15:19:23 +0100
          type: string
          description: >
            When the restriction is due to lift, in the workspace timezone.
            Empty string when the account is not restricted, or when WhatsApp
            gave no end time.
  responses:
    UnauthorizedError:
      description: Access token is missing or invalid
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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