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

# Box Hubコラボレーションを作成

> Box Hubに個々のユーザーまたはグループのコラボレーションを追加します。

コラボレーションは、メールアドレス、ユーザーID、またはグループIDを使用して作成できます。

<Note>
  「[Box SDKのバージョニング戦略](/ja/guides/tooling/sdks/sdk-versioning/)について詳しく学ぶ。」
</Note>


## OpenAPI

````yaml box-openapi-v2025.0-jp.json POST /hub_collaborations
openapi: 3.0.2
info:
  title: Box Platform API
  description: >-
    [Box
    Platform](https://developer.box.com)では、[Box](https://box.com)内に保存されているコンテンツへのアクセス権限を付与する機能が提供されています。また、ファイルとフォルダの基本操作、会社内のユーザーの管理、リーガルホールドやリテンションポリシーなどの複雑なトピックのためのエンドポイントも提供されています。
  termsOfService: https://cloud.app.box.com/s/rmwxu64h1ipr41u49w3bbuvbsa29wku9
  contact:
    name: Box, Inc
    url: https://developer.box.com
    email: devrel@box.com
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: '2025.0'
  x-box-commit-hash: 92c221bf9d
servers:
  - url: https://api.box.com/2.0
    description: Box Platform APIサーバー。
security:
  - OAuth2Security: []
tags:
  - name: Archives
    description: アーカイブを管理するために使用される、一連のエンドポイント。
    x-box-tag: archives
  - name: Enterprise構成
    description: 管理者がBox製品の動作を制御するために操作するEnterprise構成。
    x-box-tag: enterprise_configurations
  - name: Box Doc Gen
    description: Doc Genは、ドキュメントを自動的に生成するために使用されます。
    x-box-tag: docgen
  - name: Box Doc Genテンプレート
    description: Doc Genテンプレートは、ドキュメントを生成するための入力として使用されます。
    x-box-tag: docgen_template
  - name: 外部ユーザー
    description: 外部ユーザーは、自社に所属していないコラボレータです。
    x-box-tag: external_users
  - name: Box Hubs
    description: Box Hubsを管理するために使用される、一連のエンドポイント。
    x-box-tag: hubs
  - name: Box Hubコラボレーション
    description: Box Hub内のコラボレーションを管理するために使用される、一連のエンドポイント。
    x-box-tag: hub_collaborations
  - name: Box Hubドキュメント
    description: Box Hubドキュメント要素 (ページとコンテンツブロック) を取得するために使用される、一連のエンドポイント。
    x-box-tag: hub_document
  - name: Box Hubの項目
    description: Box Hub内の項目を管理するために使用される、一連のエンドポイント。
    x-box-tag: hub_items
  - name: Shieldリスト
    description: Shieldリストを使用すると、管理者は、さまざまなShieldスマートアクセスルールや脅威検出ルールで共有される項目のリストを作成できます。
    x-box-tag: shield_lists
externalDocs:
  description: Box Developerドキュメント。
  url: https://developer.box.com
paths:
  /hub_collaborations:
    post:
      tags:
        - Box Hubコラボレーション
      summary: Box Hubコラボレーションを作成
      description: |-
        Box Hubに個々のユーザーまたはグループのコラボレーションを追加します。

        コラボレーションは、メールアドレス、ユーザーID、またはグループIDを使用して作成できます。
      operationId: post_hub_collaborations_v2025.0
      parameters:
        - $ref: '#/components/parameters/BoxVersionHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HubCollaborationCreateRequest'
      responses:
        '201':
          description: 新しいBox Hubコラボレーションオブジェクトを返します。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubCollaboration'
        '403':
          description: ユーザーにコラボレーションを作成するための適切な権限がない場合にエラーを返します。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientError'
        default:
          description: 予期しないクライアントエラー。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientError'
      x-codeSamples:
        - lang: curl
          label: Box Hubコラボレーションを作成
          source: |-
            curl -i -X POST "https://api.box.com/2.0/hub_collaborations" \
                 -H "box-version: 2025.0" \
                 -H "authorization: Bearer <ACCESS_TOKEN>" \
                 -H "content-type: application/json" \
                 -d '{
                   "hub": {
                     "type": "hubs",
                     "id": "42037322"
                   },
                   "accessible_by": {
                     "type": "user",
                     "id": "23522323"
                   },
                   "role": "viewer"
                 }'
        - lang: dotnet
          label: Box Hubコラボレーションを作成
          source: >-
            await
            client.HubCollaborations.CreateHubCollaborationV2025R0Async(requestBody:
            new HubCollaborationCreateRequestV2025R0(hub: new
            HubCollaborationCreateRequestV2025R0HubField(id: hub.Id),
            accessibleBy: new
            HubCollaborationCreateRequestV2025R0AccessibleByField(type: "user")
            { Id = user.Id }, role: "viewer"));
        - lang: swift
          label: Box Hubコラボレーションを作成
          source: >-
            try await
            client.hubCollaborations.createHubCollaborationV2025R0(requestBody:
            HubCollaborationCreateRequestV2025R0(hub:
            HubCollaborationCreateRequestV2025R0HubField(id: hub.id),
            accessibleBy:
            HubCollaborationCreateRequestV2025R0AccessibleByField(type: "user",
            id: user.id), role: "viewer"))
        - lang: java
          label: Box Hubコラボレーションを作成
          source: >-
            client.getHubCollaborations().createHubCollaborationV2025R0(new
            HubCollaborationCreateRequestV2025R0(new
            HubCollaborationCreateRequestV2025R0HubField(hub.getId()), new
            HubCollaborationCreateRequestV2025R0AccessibleByField.Builder("user").id(user.getId()).build(),
            "viewer"))
        - lang: node
          label: Box Hubコラボレーションを作成
          source: |-
            await client.hubCollaborations.createHubCollaborationV2025R0({
              hub: new HubCollaborationCreateRequestV2025R0HubField({ id: hub.id }),
              accessibleBy: {
                type: 'user',
                id: user.id,
              } satisfies HubCollaborationCreateRequestV2025R0AccessibleByField,
              role: 'viewer',
            } satisfies HubCollaborationCreateRequestV2025R0);
        - lang: python
          label: Box Hubコラボレーションを作成
          source: |-
            client.hub_collaborations.create_hub_collaboration_v2025_r0(
                CreateHubCollaborationV2025R0Hub(id=hub.id),
                CreateHubCollaborationV2025R0AccessibleBy(type="user", id=user.id),
                "viewer",
            )
components:
  parameters:
    BoxVersionHeader:
      name: box-version
      in: header
      description: Version header.
      allowEmptyValue: false
      required: true
      schema:
        type: string
        enum:
          - '2025.0'
      example: '2025.0'
  schemas:
    HubCollaborationCreateRequest:
      description: 新しいBox Hubコラボレーションを作成するためのリクエスト本文。
      type: object
      properties:
        hub:
          description: Box Hubsの参照。
          type: object
          properties:
            type:
              description: 値は常に`hubs`になります。
              type: string
              example: hubs
              enum:
                - hubs
            id:
              description: オブジェクトのID。
              type: string
              example: '42037322'
          required:
            - type
            - id
          title: Box Hubsの参照
        accessible_by:
          description: その項目へのアクセス権限を取得するユーザーまたはグループ。
          type: object
          properties:
            type:
              description: 招待するコラボレータの種類。使用可能な値は`user`または`group`です。
              type: string
              example: user
            id:
              description: |-
                ユーザーまたはグループのID。

                `login`を使用してメールアドレスでユーザーを指定することもできます。
              type: string
              example: '23522323'
            login:
              description: |-
                項目に対するアクセス権限を取得するユーザーのメールアドレス。

                `id`を使用してユーザーIDでユーザーを指定することもできます。
              type: string
              example: john@example.com
          required:
            - type
        role:
          description: Box Hubに付与されるアクセスレベル。使用可能な値は`editor`、`viewer`、`co-owner`です。
          type: string
          example: editor
      required:
        - hub
        - accessible_by
        - role
      title: Box Hubコラボレーションの作成リクエスト
    HubCollaboration:
      description: >-
        Box Hubコラボレーションオブジェクトは、特定のロールによって定義される権限を含んだBox
        Hubへのアクセス権限をユーザーまたはグループに付与します。
      type: object
      properties:
        id:
          description: このコラボレーションの一意の識別子。
          type: string
          example: '12345678'
        type:
          description: 値は常に`hub_collaboration`になります。
          type: string
          example: hub_collaboration
          enum:
            - hub_collaboration
        hub:
          $ref: '#/components/schemas/Hub--Base'
        accessible_by:
          $ref: '#/components/schemas/HubAccessGrantee'
        role:
          description: Box Hubに付与されるアクセスレベル。使用可能な値は`editor`、`viewer`、`co-owner`です。
          type: string
          example: editor
        status:
          description: コラボレーション招待のステータス。ステータスが`pending`の場合、`login`と`name`は空の文字列を返します。
          type: string
          example: accepted
          enum:
            - accepted
            - pending
            - rejected
        acceptance_requirements_status:
          type: object
          properties:
            terms_of_service_requirement:
              type: object
              properties:
                is_accepted:
                  description: サービス利用規約に同意済みかどうか。利用規約への同意が必要ない場合、このフィールドは`null`です。
                  type: boolean
                  example: true
                  nullable: true
                terms_of_service:
                  allOf:
                    - $ref: '#/components/schemas/TermsOfService--Base'
                    - description: >-
                        コラボレーションが承認される前に同意する必要があるサービス利用規約。利用規約への同意が必要ない場合、このフィールドは`null`です。
            strong_password_requirement:
              type: object
              properties:
                enterprise_has_strong_password_required_for_external_users:
                  description: >-
                    コンテンツを所有する企業が、コンテンツのコラボレーションに強力なパスワードを要求するかどうか、または外部コラボレータに対して漏えいが確認されたパスワードの検出を適用するかどうか。
                  type: boolean
                  example: true
                user_has_strong_password:
                  description: >-
                    ユーザーのアカウントに対して、強力なパスワードの要求と漏えいが確認されたパスワードの検出が設定されているかどうか。強力なパスワードが要求されていない場合、このフィールドは`null`になります。
                  type: boolean
                  example: true
                  nullable: true
            two_factor_authentication_requirement:
              type: object
              properties:
                enterprise_has_two_factor_auth_enabled:
                  description: このコンテンツを所有する会社が、このコンテンツでのコラボレーションを行うために2要素認証を有効にする必要があるかどうか。
                  type: boolean
                  example: true
                user_has_two_factor_authentication_enabled:
                  description: ユーザーが2要素認証を有効にしているかどうか。2要素認証が必要ない場合、このフィールドは`null`です。
                  type: boolean
                  example: true
                  nullable: true
      required:
        - id
        - type
      title: Box Hubコラボレーション
      x-box-resource-id: hub_collaboration_v2025.0
      x-box-tag: hub_collaborations
    ClientError:
      description: 一般的なエラー。
      type: object
      properties:
        type:
          description: 値は常に`error`になります。
          type: string
          example: error
          enum:
            - error
          nullable: false
        status:
          description: レスポンスのHTTPステータス。
          type: integer
          format: int32
          example: 400
          nullable: false
        code:
          description: Box固有のエラーコード。
          type: string
          example: item_name_invalid
          enum:
            - created
            - accepted
            - no_content
            - redirect
            - not_modified
            - bad_request
            - unauthorized
            - forbidden
            - not_found
            - method_not_allowed
            - conflict
            - precondition_failed
            - too_many_requests
            - internal_server_error
            - unavailable
            - item_name_invalid
            - insufficient_scope
        message:
          description: エラーについての短い説明メッセージ。
          type: string
          example: Method Not Allowed
          nullable: false
        context_info:
          description: >-
            このエラーに関する追加コンテキストを含む自由形式のオブジェクト。使用できるフィールドは、エンドポイントごとに定義されています。`message`は唯一の例です。
          type: object
          example:
            message: Something went wrong
          additionalProperties: {}
          nullable: true
        help_url:
          description: このエラーの原因に関する詳細情報にリンクされたURL。
          type: string
          example: >-
            https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/
          nullable: false
        request_id:
          description: Boxサポートに連絡するときに使用できる、このレスポンスの一意の識別子。
          type: string
          example: abcdef123456
          nullable: false
      title: クライアントエラー
      x-box-resource-id: client_error_v2025.0
    Hub--Base:
      description: 最も基本的なBox HubのBase版の表示。
      type: object
      properties:
        id:
          description: >-
            Box Hubを表す一意の識別子。


            Box HubのIDを確認するには、ウェブアプリでBox
            Hubにアクセスして、URLからIDをコピーします。たとえば、URLが`https://*.app.box.com/hubs/123`の場合、`hub_id`は`123`です。
          type: string
          example: '12345'
        type:
          description: 値は常に`hubs`になります。
          type: string
          example: hubs
          enum:
            - hubs
      required:
        - id
        - type
      title: Box Hub (Base)
      x-box-resource-id: hub_v2025.0--base
      x-box-tag: hubs
      x-box-variant: base
      x-box-variants:
        - base
        - standard
    HubAccessGrantee:
      description: アクセス権限が付与されるユーザーまたはグループ。
      type: object
      oneOf:
        - $ref: '#/components/schemas/HubCollaborationUser'
        - $ref: '#/components/schemas/Group--Mini'
      title: Box Hubにアクセスできるユーザー
    TermsOfService--Base:
      description: 1つのサービス利用規約に該当するとみなされるルートレベルのレコード。
      type: object
      properties:
        id:
          description: このサービス利用規約の一意の識別子。
          type: string
          example: '11446498'
        type:
          description: 値は常に`terms_of_service`になります。
          type: string
          example: terms_of_service
          enum:
            - terms_of_service
      required:
        - id
        - type
      title: サービス利用規約 (Base)
    HubCollaborationUser:
      description: ユーザーのMini版の表示は、ステータスが`pending`の場合にのみ返すことができます。
      type: object
      allOf:
        - $ref: '#/components/schemas/User--Base'
        - properties:
            name:
              description: このユーザーの表示名。コラボレーションのステータスが`pending`の場合、空の文字列が返されます。
              type: string
              example: Aaron Levie
              maxLength: 50
              nullable: false
            login:
              description: このユーザーのプライマリメールアドレス。コラボレーションのステータスが`pending`の場合、空の文字列が返されます。
              type: string
              format: email
              example: ceo@example.com
              nullable: false
      title: Box Hubコラボレーションユーザー
    Group--Mini:
      description: グループのIDや名前を含むグループのMini版の表示。
      type: object
      allOf:
        - $ref: '#/components/schemas/Group--Base'
        - properties:
            name:
              description: グループの名前。
              type: string
              example: Support
            group_type:
              description: グループのタイプ。
              type: string
              example: managed_group
              enum:
                - managed_group
                - all_users_group
      title: グループ (Mini)
    User--Base:
      description: 他のリソース内にネストされたときに使用されるユーザーのMini版の表示。
      type: object
      properties:
        id:
          description: このユーザーの一意の識別子。
          type: string
          example: '11446498'
        type:
          description: 値は常に`user`になります。
          type: string
          example: user
          enum:
            - user
          nullable: false
      required:
        - type
        - id
      title: ユーザー (Base)
    Group--Base:
      description: グループのBase版の表示。
      type: object
      properties:
        id:
          description: このオブジェクトの一意の識別子。
          type: string
          example: '11446498'
        type:
          description: 値は常に`group`になります。
          type: string
          example: group
          enum:
            - group
      required:
        - id
        - type
      title: グループ (Base)
  securitySchemes:
    OAuth2Security:
      type: oauth2
      description: >-
        The access token received from the authorization server in the OAuth 2.0
        flow.
      flows:
        authorizationCode:
          authorizationUrl: https://account.box.com/api/oauth2/authorize
          tokenUrl: https://api.box.com/oauth2/token
          scopes:
            root_readonly: Boxに格納されているすべてのファイルとフォルダの読み取り
            root_readwrite: Boxに格納されているすべてのファイルとフォルダの読み取りと書き込み
            manage_app_users: App Userのプロビジョニングと管理
            manage_managed_users: 管理対象ユーザーのプロビジョニングと管理
            manage_groups: 企業のグループの管理
            manage_webhook: APIを使用したプログラムによるWebhookの作成
            manage_enterprise_properties: Enterpriseのプロパティを管理
            manage_data_retention: データリテンションポリシーの管理
            manage_legal_hold: リーガルホールドの管理

````