SwaggerHub Organizations API

Manage organization membership and roles

OpenAPI Specification

swaggerhub-organizations-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: SwaggerHub Registry APIs Organizations API
  description: 'The SwaggerHub Registry API provides programmatic access to all SwaggerHub resources: APIs, domains, integrations, projects, templates, and standardization rulesets. Use it to manage API versions, publish APIs, run CI/CD integrations, manage projects, and retrieve OpenAPI definitions.'
  version: 1.3.0
  contact:
    name: SmartBear SwaggerHub Support
    url: https://support.smartbear.com/swaggerhub/
  license:
    name: SmartBear License
    url: https://swagger.io/license/
  x-logo:
    url: https://kinlane-images.s3.amazonaws.com/shared/apis-json/apis-json-logo.jpg
servers:
- url: https://api.swaggerhub.com
  description: SwaggerHub Registry API
security:
- ApiKeyAuth: []
tags:
- name: Organizations
  description: Manage organization membership and roles
paths:
  /orgs/{org}/members:
    get:
      operationId: getOrganizationMembers
      summary: Get Organization Members
      description: Returns a paginated list of members in the specified organization with their user IDs, usernames, email addresses, roles, and account status.
      tags:
      - Organizations
      parameters:
      - name: org
        in: path
        required: true
        schema:
          type: string
        description: Organization name
      - name: page
        in: query
        schema:
          type: integer
          default: 0
      - name: limit
        in: query
        schema:
          type: integer
          default: 25
      - name: q
        in: query
        schema:
          type: string
        description: Filter by first name, last name, or email
      responses:
        '200':
          description: List of organization members
          content:
            application/json:
              schema:
                type: object
                properties:
                  totalCount:
                    type: integer
                  offset:
                    type: integer
                  members:
                    type: array
                    items:
                      $ref: '#/components/schemas/OrgMember'
        '401':
          description: Unauthorized
        '403':
          description: Insufficient permissions
    post:
      operationId: addOrganizationMembers
      summary: Add Organization Members
      description: Invite one or more users to an organization by email address. Optionally set their role (OWNER, DESIGNER, or CONSUMER). Non-existing users will receive an invitation email.
      tags:
      - Organizations
      parameters:
      - name: org
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - members
              properties:
                members:
                  type: array
                  items:
                    $ref: '#/components/schemas/MemberInvite'
      responses:
        '200':
          description: Members added/invited
        '400':
          description: Invalid request
        '403':
          description: Only owners can add members
  /orgs/{org}/members/{user}:
    delete:
      operationId: removeOrganizationMember
      summary: Remove Organization Member
      description: Remove a user from an organization. The user loses access to all org resources.
      tags:
      - Organizations
      parameters:
      - name: org
        in: path
        required: true
        schema:
          type: string
      - name: user
        in: path
        required: true
        schema:
          type: string
        description: Email address or username of the member to remove
      responses:
        '200':
          description: Member removed
        '403':
          description: Insufficient permissions
        '404':
          description: Member not found
    put:
      operationId: updateOrganizationMemberRole
      summary: Update Organization Member Role
      description: Change a user's role within an organization.
      tags:
      - Organizations
      parameters:
      - name: org
        in: path
        required: true
        schema:
          type: string
      - name: user
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - role
              properties:
                role:
                  type: string
                  enum:
                  - OWNER
                  - DESIGNER
                  - CONSUMER
      responses:
        '200':
          description: Role updated
        '400':
          description: Invalid role
        '404':
          description: Member not found
components:
  schemas:
    OrgMember:
      type: object
      description: A member of a SwaggerHub organization
      properties:
        userId:
          type: string
        username:
          type: string
        email:
          type: string
          format: email
        role:
          type: string
          enum:
          - OWNER
          - DESIGNER
          - CONSUMER
        status:
          type: string
          enum:
          - ACTIVE
          - PENDING
          - INACTIVE
    MemberInvite:
      type: object
      description: An invitation to add a user to an organization
      required:
      - email
      properties:
        email:
          type: string
          format: email
        role:
          type: string
          enum:
          - OWNER
          - DESIGNER
          - CONSUMER
          default: CONSUMER
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: SwaggerHub API key. Obtain from My Account > API Key in SwaggerHub. Pass the key as the Authorization header value without any prefix.