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

# Set Member Role

> Assign or clear a hub member's elevated role.

200: updated hub_memberships resource. 404: missing/left membership.
409: banned/soft_banned and not assignable (code=membership_not_active), OR
the target's current role is already 'owner' — ownership cannot be
reassigned or cleared via this endpoint, only via the dedicated
ownership-transfer endpoint (code=cannot_modify_owner_role). 422: invalid
role. 401/403 are produced by require_hub_admin_or_contact.



## OpenAPI

````yaml /openapi/mio-openapi.json patch /api/v1/admin/teams/{team_id}/hubs/{hub_id}/members/{contact_id}/role
openapi: 3.1.0
info:
  description: >-
    Production API reference for Membership.io. Use the authored guides for
    workflows and the generated endpoint pages for exact parameters and schemas.
  title: Membership.io API
  version: 0.1.0
servers:
  - description: Production
    url: https://api.member.dev
security:
  - bearerAuth: []
paths:
  /api/v1/admin/teams/{team_id}/hubs/{hub_id}/members/{contact_id}/role:
    patch:
      tags:
        - hub-memberships-admin
      summary: Set Member Role
      description: >-
        Assign or clear a hub member's elevated role.


        200: updated hub_memberships resource. 404: missing/left membership.

        409: banned/soft_banned and not assignable (code=membership_not_active),
        OR

        the target's current role is already 'owner' — ownership cannot be

        reassigned or cleared via this endpoint, only via the dedicated

        ownership-transfer endpoint (code=cannot_modify_owner_role). 422:
        invalid

        role. 401/403 are produced by require_hub_admin_or_contact.
      operationId: >-
        hub_memberships_admin.patch_hub_memberships_admin_patch_admin_teams_by_team_id_hubs_by_hub_id_members_by_contact_id_role
      parameters:
        - in: path
          name: team_id
          required: true
          schema:
            title: Team Id
            type: string
        - in: path
          name: hub_id
          required: true
          schema:
            title: Hub Id
            type: string
        - in: path
          name: contact_id
          required: true
          schema:
            title: Contact Id
            type: string
      requestBody:
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/HubMembershipRoleUpdateRequest'
        required: true
      responses:
        '200':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiResponse_HubMembershipAttributes_'
          description: Successful Response
        '409':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Error response; see `errors[0].code` where present.
        '422':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    HubMembershipRoleUpdateRequest:
      additionalProperties: false
      properties:
        data:
          $ref: '#/components/schemas/HubMembershipRoleUpdateData'
      required:
        - data
      title: HubMembershipRoleUpdateRequest
      type: object
    JsonApiResponse_HubMembershipAttributes_:
      properties:
        data:
          $ref: '#/components/schemas/JsonApiResource_HubMembershipAttributes_'
        included:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
          title: Included
        links:
          anyOf:
            - $ref: '#/components/schemas/JsonApiLinks'
            - type: 'null'
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      required:
        - data
      title: JsonApiResponse[HubMembershipAttributes]
      type: object
    JsonApiErrorResponse:
      description: Error JSON:API response.
      properties:
        errors:
          items:
            $ref: '#/components/schemas/JsonApiError'
          title: Errors
          type: array
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      required:
        - errors
      title: JsonApiErrorResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    HubMembershipRoleUpdateData:
      additionalProperties: false
      properties:
        attributes:
          $ref: '#/components/schemas/HubMembershipRoleUpdateAttributes'
        type:
          const: hub_memberships
          title: Type
          type: string
      required:
        - type
        - attributes
      title: HubMembershipRoleUpdateData
      type: object
    JsonApiResource_HubMembershipAttributes_:
      properties:
        attributes:
          $ref: '#/components/schemas/HubMembershipAttributes'
        id:
          title: Id
          type: string
        links:
          anyOf:
            - $ref: '#/components/schemas/JsonApiLinks'
            - type: 'null'
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
        relationships:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Relationships
        type:
          title: Type
          type: string
      required:
        - id
        - type
        - attributes
      title: JsonApiResource[HubMembershipAttributes]
      type: object
    JsonApiLinks:
      properties:
        self:
          anyOf:
            - type: string
            - type: 'null'
          title: Self
      title: JsonApiLinks
      type: object
    JsonApiError:
      properties:
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
        source:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Source
        status:
          title: Status
          type: string
        title:
          title: Title
          type: string
      required:
        - status
        - title
      title: JsonApiError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    HubMembershipRoleUpdateAttributes:
      additionalProperties: false
      properties:
        role:
          anyOf:
            - enum:
                - admin
                - moderator
              type: string
            - type: 'null'
          title: Role
      required:
        - role
      title: HubMembershipRoleUpdateAttributes
      type: object
    HubMembershipAttributes:
      description: |-
        Attributes for a hub_memberships resource object.

        Per JSON:API spec §"Resource Objects": id and type are excluded.
        hub_id and contact_id are lifecycle context, NOT access state.
      properties:
        ban_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Ban Reason
        banned_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Banned At
        contact_id:
          title: Contact Id
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
        hub_id:
          title: Hub Id
          type: string
        last_seen_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Last Seen At
        notification_prefs:
          additionalProperties: true
          title: Notification Prefs
          type: object
        onboarded_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Onboarded At
        role:
          anyOf:
            - type: string
            - type: 'null'
          title: Role
        status:
          default: active
          title: Status
          type: string
        team_id:
          title: Team Id
          type: string
        tos_acceptance_required:
          default: false
          title: Tos Acceptance Required
          type: boolean
        tos_accepted_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Tos Accepted At
        tos_accepted_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Tos Accepted Version
        updated_at:
          format: date-time
          title: Updated At
          type: string
        welcome_email_sent:
          default: false
          title: Welcome Email Sent
          type: boolean
      required:
        - hub_id
        - contact_id
        - team_id
        - notification_prefs
        - created_at
        - updated_at
      title: HubMembershipAttributes
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT or mio_sk API key
      description: >-
        Send platform JWTs, contact JWTs, or team API keys as `Authorization:
        Bearer <token>`.
      scheme: bearer
      type: http

````