openapi: 3.0.1
servers:
  - url: https://api.hubapi.com
info:
  description: Retrieve Business Unit information.
  title: Business Units
  version: v3
  x-hubspot-api-use-case: You have a third-party service to manage organizational data for your business, and you need to confirm the business unit that a specific HubSpot user is in.
  x-hubspot-documentation-banner: NONE
  x-hubspot-introduction: Use the business units API to retrieve information about the business unit associated with a user in your HubSpot account.
  x-hubspot-product-tier-requirements:
    marketing: ENTERPRISE
  x-hubspot-related-documentation:
    - name: Business Units Guide
      url: https://hubspot.dev/guides/api/settings/business-units-api
  x-logo:
    url: https://wtcfns.hubspot.com/wt-api/social-sharing
  x-origin:
    - format: openapi
      url: https://api.hubspot.com/api-catalog-public/v1/apis/business-units/v3
      version: "3.0"
  x-providerName: hubapi.com
  x-serviceName: business units
tags:
  - description: ""
    name: Business Unit
    x-hubspot-tag-name-english-source: Business Unit
paths:
  /business-units/v3/business-units/user/{userId}:
    get:
      description: Get Business Units identified by `userId`. The `userId` refers to the user’s ID.
      operationId: get-/business-units/v3/business-units/user/{userId}_getByUserID
      parameters:
        - description: Identifier of user to retrieve.
          explode: false
          in: path
          name: userId
          required: true
          schema:
            type: string
          style: simple
        - description: The names of properties to optionally include in the response body. The only valid value is `logoMetadata`.
          explode: true
          in: query
          name: properties
          required: false
          schema:
            items:
              type: string
            type: array
          style: form
        - description: The names of Business Units to retrieve. If empty or not provided, then all associated Business Units will be returned.
          explode: true
          in: query
          name: name
          required: false
          schema:
            items:
              type: string
            type: array
          style: form
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CollectionResponsePublicBusinessUnitNoPaging"
          description: successful operation
        default:
          $ref: "#/components/responses/Error"
      security:
        - private_apps_legacy: []
        - oauth2_legacy:
            - business_units_view.read
      summary: Get Business Units for a user
      tags:
        - Business Unit
components:
  responses:
    Error:
      content:
        "*/*":
          schema:
            $ref: "#/components/schemas/Error"
      description: An error occurred.
  schemas:
    CollectionResponsePublicBusinessUnitNoPaging:
      description: A response object containing a collection of Business Units
      properties:
        results:
          description: The collection of Business Units
          items:
            $ref: "#/components/schemas/PublicBusinessUnit"
          type: array
      required:
        - results
      type: object
    Error:
      example:
        category: VALIDATION_ERROR
        correlationId: aeb5f871-7f07-4993-9211-075dc63e7cbf
        links:
          knowledge-base: https://www.hubspot.com/products/service/knowledge-base
        message: Invalid input (details will vary based on the error)
      properties:
        category:
          description: The error category
          example: VALIDATION_ERROR
          type: string
        context:
          additionalProperties:
            items:
              type: string
            type: array
          description: Context about the error condition
          example:
            invalidPropertyName:
              - propertyValue
            missingScopes:
              - scope1
              - scope2
          type: object
        correlationId:
          description: A unique identifier for the request. Include this value with any error reports or support tickets
          example: aeb5f871-7f07-4993-9211-075dc63e7cbf
          format: uuid
          type: string
        errors:
          description: further information about the error
          items:
            $ref: "#/components/schemas/ErrorDetail"
          type: array
        links:
          additionalProperties:
            type: string
          description: A map of link names to associated URIs containing documentation about the error or recommended remediation steps
          example:
            knowledge-base: https://www.hubspot.com/products/service/knowledge-base
          type: object
        message:
          description: A human readable message describing the error along with remediation steps where appropriate
          example: Invalid input (details will vary based on the error)
          type: string
        subCategory:
          description: A specific category that contains more specific detail about the error
          type: string
      required:
        - category
        - correlationId
        - message
      type: object
    ErrorDetail:
      properties:
        code:
          description: The status code associated with the error detail
          type: string
        context:
          additionalProperties:
            items:
              type: string
            type: array
          description: Context about the error condition
          example:
            missingScopes:
              - scope1
              - scope2
          type: object
        in:
          description: The name of the field or parameter in which the error was found.
          type: string
        message:
          description: A human readable message describing the error along with remediation steps where appropriate
          type: string
        subCategory:
          description: A specific category that contains more specific detail about the error
          type: string
      required:
        - message
      type: object
    PublicBusinessUnit:
      description: A Business Unit
      example:
        id: "101"
        logoMetadata:
          logoAltText: logo sample text
          logoUrl: examplelogourl.com
          resizedUrl: sillystring
        name: sample business unit name
      properties:
        id:
          description: The Business Unit's unique ID
          example: "101"
          type: string
        logoMetadata:
          $ref: "#/components/schemas/PublicBusinessUnitLogoMetadata"
        name:
          description: The Business Unit's name
          example: sample business unit name
          type: string
      required:
        - id
        - name
      type: object
    PublicBusinessUnitLogoMetadata:
      description: A Business Unit's logo metadata
      example:
        logoAltText: logo sample text
        logoUrl: examplelogourl.com
        resizedUrl: sillystring
      properties:
        logoAltText:
          description: The logo's alt text
          example: logo sample text
          type: string
        logoUrl:
          description: The logo's url
          example: examplelogourl.com
          type: string
        resizedUrl:
          description: The logo's resized url
          example: sillystring
          type: string
      type: object
  securitySchemes:
    oauth2_legacy:
      flows:
        authorizationCode:
          authorizationUrl: https://app.hubspot.com/oauth/authorize
          scopes:
            business_units_view.read: Read business unit resources
          tokenUrl: https://api.hubapi.com/oauth/v1/token
      type: oauth2
    private_apps_legacy:
      in: header
      name: private-app-legacy
      type: apiKey
x-hubspot-available-client-libraries:
  - PHP
  - Node
  - Ruby
  - Python
x-hubspot-documentation-banner: NONE
x-hubspot-product-tier-requirements:
  marketing: ENTERPRISE
