# Source: https://docs.claude.com/en/api/admin-api/workspace_members/create-workspace-member.md

# Add Workspace Member

## OpenAPI

````yaml post /v1/organizations/workspaces/{workspace_id}/members
paths:
  path: /v1/organizations/workspaces/{workspace_id}/members
  method: post
  servers:
    - url: https://api.anthropic.com
  request:
    security: []
    parameters:
      path:
        workspace_id:
          schema:
            - type: string
              required: true
              title: Workspace Id
              description: ID of the Workspace.
      query: {}
      header:
        x-api-key:
          schema:
            - type: string
              required: true
              title: X-Api-Key
              description: >-
                Your unique Admin API key for authentication. 


                This key is required in the header of all Admin API requests, to
                authenticate your account and access Anthropic's services. Get
                your Admin API key through the
                [Console](https://console.anthropic.com/settings/admin-keys).
        anthropic-version:
          schema:
            - type: string
              required: true
              title: Anthropic-Version
              description: >-
                The version of the Claude API you want to use.


                Read more about versioning and our version history
                [here](https://docs.claude.com/en/docs/build-with-claude/versioning).
      cookie: {}
    body:
      application/json:
        schemaArray:
          - type: object
            properties:
              user_id:
                allOf:
                  - type: string
                    title: User Id
                    description: ID of the User.
                    examples:
                      - user_01WCz1FkmYMm4gnmykNKUu3Q
              workspace_role:
                allOf:
                  - $ref: '#/components/schemas/NoBillingWorkspaceRoleSchema'
                    description: >-
                      Role of the new Workspace Member. Cannot be
                      "workspace_billing".
            required: true
            title: CreateWorkspaceMemberParams
            refIdentifier: '#/components/schemas/CreateWorkspaceMemberParams'
            requiredProperties:
              - user_id
              - workspace_role
            additionalProperties: false
        examples:
          example:
            value:
              user_id: user_01WCz1FkmYMm4gnmykNKUu3Q
              workspace_role: workspace_user
    codeSamples:
      - lang: bash
        source: >-
          curl
          "https://api.anthropic.com/v1/organizations/workspaces/wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ/members"
          \
            --header "anthropic-version: 2023-06-01" \
            --header "content-type: application/json" \
            --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
            --data '{
              "user_id": "user_01WCz1FkmYMm4gnmykNKUu3Q",
              "workspace_role": "workspace_user"
            }'
  response:
    '200':
      application/json:
        schemaArray:
          - type: object
            properties:
              type:
                allOf:
                  - type: string
                    enum:
                      - workspace_member
                    const: workspace_member
                    title: Type
                    description: >-
                      Object type.


                      For Workspace Members, this is always
                      `"workspace_member"`.
                    default: workspace_member
              user_id:
                allOf:
                  - type: string
                    title: User Id
                    description: ID of the User.
                    examples:
                      - user_01WCz1FkmYMm4gnmykNKUu3Q
              workspace_id:
                allOf:
                  - type: string
                    title: Workspace Id
                    description: ID of the Workspace.
                    examples:
                      - wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ
              workspace_role:
                allOf:
                  - $ref: '#/components/schemas/WorkspaceRoleSchema'
                    description: Role of the Workspace Member.
                    examples:
                      - workspace_user
                      - workspace_developer
                      - workspace_admin
                      - workspace_billing
            title: WorkspaceMemberSchema
            refIdentifier: '#/components/schemas/WorkspaceMemberSchema'
            requiredProperties:
              - type
              - user_id
              - workspace_id
              - workspace_role
        examples:
          example:
            value:
              type: workspace_member
              user_id: user_01WCz1FkmYMm4gnmykNKUu3Q
              workspace_id: wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ
              workspace_role: workspace_user
        description: Successful Response
    4XX:
      application/json:
        schemaArray:
          - type: object
            properties:
              error:
                allOf:
                  - oneOf:
                      - $ref: '#/components/schemas/InvalidRequestError'
                      - $ref: '#/components/schemas/AuthenticationError'
                      - $ref: '#/components/schemas/BillingError'
                      - $ref: '#/components/schemas/PermissionError'
                      - $ref: '#/components/schemas/NotFoundError'
                      - $ref: '#/components/schemas/RateLimitError'
                      - $ref: '#/components/schemas/GatewayTimeoutError'
                      - $ref: '#/components/schemas/APIError'
                      - $ref: '#/components/schemas/OverloadedError'
                    title: Error
                    discriminator:
                      propertyName: type
                      mapping:
                        api_error: '#/components/schemas/APIError'
                        authentication_error: '#/components/schemas/AuthenticationError'
                        billing_error: '#/components/schemas/BillingError'
                        invalid_request_error: '#/components/schemas/InvalidRequestError'
                        not_found_error: '#/components/schemas/NotFoundError'
                        overloaded_error: '#/components/schemas/OverloadedError'
                        permission_error: '#/components/schemas/PermissionError'
                        rate_limit_error: '#/components/schemas/RateLimitError'
                        timeout_error: '#/components/schemas/GatewayTimeoutError'
              request_id:
                allOf:
                  - anyOf:
                      - type: string
                      - type: 'null'
                    title: Request Id
              type:
                allOf:
                  - type: string
                    enum:
                      - error
                    const: error
                    title: Type
                    default: error
            title: ErrorResponse
            refIdentifier: '#/components/schemas/ErrorResponse'
            requiredProperties:
              - error
              - request_id
              - type
        examples:
          example:
            value:
              error:
                message: Invalid request
                type: invalid_request_error
              request_id: <string>
              type: error
        description: >-
          Error response.


          See our [errors
          documentation](https://docs.claude.com/en/docs/build-with-claude/errors)
          for more details.
  deprecated: false
  type: path
components:
  schemas:
    APIError:
      properties:
        message:
          type: string
          title: Message
          default: Internal server error
        type:
          type: string
          enum:
            - api_error
          const: api_error
          title: Type
          default: api_error
      type: object
      required:
        - message
        - type
      title: APIError
    AuthenticationError:
      properties:
        message:
          type: string
          title: Message
          default: Authentication error
        type:
          type: string
          enum:
            - authentication_error
          const: authentication_error
          title: Type
          default: authentication_error
      type: object
      required:
        - message
        - type
      title: AuthenticationError
    BillingError:
      properties:
        message:
          type: string
          title: Message
          default: Billing error
        type:
          type: string
          enum:
            - billing_error
          const: billing_error
          title: Type
          default: billing_error
      type: object
      required:
        - message
        - type
      title: BillingError
    GatewayTimeoutError:
      properties:
        message:
          type: string
          title: Message
          default: Request timeout
        type:
          type: string
          enum:
            - timeout_error
          const: timeout_error
          title: Type
          default: timeout_error
      type: object
      required:
        - message
        - type
      title: GatewayTimeoutError
    InvalidRequestError:
      properties:
        message:
          type: string
          title: Message
          default: Invalid request
        type:
          type: string
          enum:
            - invalid_request_error
          const: invalid_request_error
          title: Type
          default: invalid_request_error
      type: object
      required:
        - message
        - type
      title: InvalidRequestError
    NoBillingWorkspaceRoleSchema:
      type: string
      enum:
        - workspace_user
        - workspace_developer
        - workspace_admin
      title: NoBillingWorkspaceRoleSchema
    NotFoundError:
      properties:
        message:
          type: string
          title: Message
          default: Not found
        type:
          type: string
          enum:
            - not_found_error
          const: not_found_error
          title: Type
          default: not_found_error
      type: object
      required:
        - message
        - type
      title: NotFoundError
    OverloadedError:
      properties:
        message:
          type: string
          title: Message
          default: Overloaded
        type:
          type: string
          enum:
            - overloaded_error
          const: overloaded_error
          title: Type
          default: overloaded_error
      type: object
      required:
        - message
        - type
      title: OverloadedError
    PermissionError:
      properties:
        message:
          type: string
          title: Message
          default: Permission denied
        type:
          type: string
          enum:
            - permission_error
          const: permission_error
          title: Type
          default: permission_error
      type: object
      required:
        - message
        - type
      title: PermissionError
    RateLimitError:
      properties:
        message:
          type: string
          title: Message
          default: Rate limited
        type:
          type: string
          enum:
            - rate_limit_error
          const: rate_limit_error
          title: Type
          default: rate_limit_error
      type: object
      required:
        - message
        - type
      title: RateLimitError
    WorkspaceRoleSchema:
      type: string
      enum:
        - workspace_user
        - workspace_developer
        - workspace_admin
        - workspace_billing
      title: WorkspaceRoleSchema

````