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

# Add a team member or set their role

> Add a workspace member to the team with the given role, or change the role of someone already in it. Idempotent: repeating the call changes nothing and answers 200. Returns 404 when the user is not a member of the workspace. Returns 400 when team settings are not enabled for the workspace.



## OpenAPI

````yaml /api-reference/workspace-api.json put /workspaceapi/teams/{teamId}/members/{userId}
openapi: 3.1.0
info:
  title: Abundly Workspace API
  description: >-
    Workspace-level and per-agent data and administration. GET endpoints need a
    workspace API key (wk_) with the Workspace read API scope; POST, PUT, PATCH
    and DELETE endpoints need the Workspace write API scope. The write endpoints
    mirror the Workspace Manager capability. Most are batch operations: ids
    travel in the JSON body, each id gets its own result, and per-id failures
    still return HTTP 200. The team endpoints (create, rename, members) act on a
    single team or membership and answer with standard status codes instead.


    Private agents are listed by /workspaceapi/agents but return 403 on every
    per-agent GET except promotion-requests, so enumerate from
    /workspaceapi/agents?includeOverview=true rather than iterating agent ids.
    Write endpoints can target private agents.
  version: 1.0.0
servers:
  - url: https://service.abundly.ai
    description: Shared platform
  - url: https://{tenant}.service.abundly.ai
    description: Dedicated deployment
    variables:
      tenant:
        default: your-tenant
security:
  - workspaceApiKey: []
paths:
  /workspaceapi/teams/{teamId}/members/{userId}:
    put:
      summary: Add a team member or set their role
      description: >-
        Add a workspace member to the team with the given role, or change the
        role of someone already in it. Idempotent: repeating the call changes
        nothing and answers 200. Returns 404 when the user is not a member of
        the workspace. Returns 400 when team settings are not enabled for the
        workspace.
      operationId: put-teams-teamId-members-userId
      parameters:
        - name: teamId
          in: path
          required: true
          description: Team id.
          schema:
            type: string
        - name: userId
          in: path
          required: true
          description: User id of a workspace member.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                role:
                  description: Team role.
                  type: string
                  enum:
                    - admin
                    - member
                    - guest
              required:
                - role
      responses:
        '200':
          description: >-
            The user was already in the team; their role is now the requested
            one.
          content:
            application/json:
              schema:
                type: object
                properties:
                  teamId:
                    type: string
                  userId:
                    type: string
                  role:
                    type: string
                    enum:
                      - admin
                      - member
                      - guest
                required:
                  - teamId
                  - userId
                  - role
                additionalProperties: false
        '201':
          description: The user was added to the team.
          content:
            application/json:
              schema:
                type: object
                properties:
                  teamId:
                    type: string
                  userId:
                    type: string
                  role:
                    type: string
                    enum:
                      - admin
                      - member
                      - guest
                required:
                  - teamId
                  - userId
                  - role
                additionalProperties: false
        '400':
          $ref: '#/components/responses/Error'
        '401':
          $ref: '#/components/responses/Error'
        '403':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
components:
  responses:
    Error:
      description: >-
        Error. Every failure on this API returns JSON with a single `error`
        field.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                description: >-
                  Human-readable message. Every error on this API uses this
                  shape.
                type: string
            required:
              - error
            additionalProperties: false
  securitySchemes:
    workspaceApiKey:
      type: http
      scheme: bearer
      description: >-
        Workspace API key (wk_). GET endpoints require the Workspace read API
        scope, POST, PUT, PATCH and DELETE endpoints the Workspace write API
        scope.

````

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