{
  "openapi": "3.0.1",
  "servers": [
    {
      "url": "https://api.hubapi.com/"
    }
  ],
  "info": {
    "description": "Retrieve Business Unit information.",
    "title": "Business Unit",
    "version": "v3",
    "x-logo": {
      "url": "https://api.apis.guru/v2/cache/logo/https_wtcfns.hubspot.com_wt-api_social-sharing.png"
    },
    "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": "Get Business Unit information.",
      "name": "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}",
        "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",
            "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",
            "type": "object"
          },
          "message": {
            "description": "A human readable message describing the error along with remediation steps where appropriate",
            "example": "An error occurred",
            "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",
            "type": "string"
          },
          "logoMetadata": {
            "$ref": "#/components/schemas/PublicBusinessUnitLogoMetadata"
          },
          "name": {
            "description": "The Business Unit's 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",
            "type": "string"
          },
          "logoUrl": {
            "description": "The logo's url",
            "type": "string"
          },
          "resizedUrl": {
            "description": "The logo's resized url",
            "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"
      }
    }
  }
}