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

# Devin Connect gatewayに宛先を追加

> 既存の宛先を保持したまま、gateway のリストに宛先を追加します。

宛先がすでに別の gateway 経由でルーティングされている場合は 409 を、
追加によって gateway の宛先数が 256 を超える場合は 422 を返します。

[Devin Connect](https://docs.devin.ai/ja/enterprise/deployment/devin-connect.md) の gateway に宛先を**追加**します。既存のルーティング先はそのまま保持されます。このリストは、ウェブアプリの「Add destination」で編集するリストと同じものです。リスト全体をまとめて設定する場合は、[Replace gateway destinations](https://docs.devin.ai/ja/api-reference/v3/devin-connect/put-enterprise-devin-connect-gateway-destinations.md) を利用してください。

## 権限

エンタープライズレベルで `ManageEnterpriseSettings` 権限を持つ[サービスユーザー](https://docs.devin.ai/ja/api-reference/v3/service-users/members-service-users.md)または[個人用アクセストークン](https://docs.devin.ai/ja/api-reference/personal-access-tokens.md)が必要です。また、エンタープライズで Devin Connect が有効になっている必要があります。有効になっていない場合、このエンドポイントは `403` を返します。

## 動作

* 各宛先は `{"hostname": "scm.corp.example"}` (ワイルドカードを含まない完全一致のホスト名) または `{"ipv4": "10.20.0.0/16"}` (IPv4 アドレスまたは CIDR) のいずれかです。ホスト名は小文字に変換され、末尾のドットは削除されます。また、単一のアドレスは `/32` CIDR に変換されます。
* gateway がすでにルーティングしている宛先はそのまま維持されるため、同じリクエストを繰り返しても問題ありません。
* 1 つの宛先は 1 つの gateway にのみ所属できます。別の gateway がすでにルーティングしている宛先を追加すると `409` が返されます。
* 1 つの gateway が保持できる宛先は最大 256 件です。上限を超える追加を行うと `422` が返されます。
* 宛先をルーティングしただけでは、セッションからその宛先にアクセスすることはできません。セッションの[セキュリティプロファイル](https://docs.devin.ai/ja/product-guides/security-profiles.md)でも許可する必要があります。両方のステップをまとめて行う方法については、[API で宛先を管理する](https://docs.devin.ai/ja/enterprise/deployment/devin-connect.md#manage-destinations-with-the-api)を参照してください。
* gateway は独自の `config.yaml` も強制適用するため、新しい宛先はそのファイルでも許可されていなければ機能しません。
* 変更は `update_gateway_hostnames` として[監査ログ](https://docs.devin.ai/ja/api-reference/v3/audit-logs/enterprise-audit-logs.md)に記録されます。


## OpenAPI

````yaml ja/v3-openapi.yaml POST /v3beta1/enterprise/devin-connect/gateways/{gateway_id}/destinations
openapi: 3.1.0
info:
  description: Service User 認証および RBAC に対応した Devin v3 API
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3beta1/enterprise/devin-connect/gateways/{gateway_id}/destinations:
    post:
      tags:
        - devin-connect
      summary: Devin Connect gatewayに宛先を追加
      description: |-
        既存の宛先を保持したまま、gateway のリストに宛先を追加します。

        宛先がすでに別の gateway 経由でルーティングされている場合は 409 を、
        追加によって gateway の宛先数が 256 を超える場合は 422 を返します。
      operationId: >-
        handle_add_devin_connect_gateway_destinations_v3beta1_enterprise_devin_connect_gateways__gateway_id__destinations_post
      parameters:
        - in: path
          name: gateway_id
          required: true
          schema:
            title: Gateway Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DevinConnectDestinationsAddRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DevinConnectGateway'
          description: 成功レスポンス
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 認証されていません
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: アクセスが禁止されています
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 見つかりません
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 競合
        '410':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 削除済み
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 処理できないコンテンツ
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: リクエスト過多
components:
  schemas:
    DevinConnectDestinationsAddRequest:
      description: 既存の宛先を保持したまま、1つのgatewayに宛先を追加します。
      properties:
        destinations:
          description: >-
            追加する宛先。gatewayに登録済みの宛先は変更されません。gatewayに登録できる宛先は合計で最大256件で、各宛先を登録できるgatewayは1つのみです。
          items:
            $ref: '#/components/schemas/DevinConnectDestination'
          title: Destinations
          type: array
      required:
        - destinations
      title: DevinConnectDestinationsAddRequest
      type: object
    DevinConnectGateway:
      description: Devin Connect gatewayと、それを経由してルーティングされる宛先。
      properties:
        connected:
          anyOf:
            - type: boolean
            - type: 'null'
          description: トンネルgatewayが現在接続されているかどうか。directの場合はnull
          title: Connected
        destinations:
          description: このgateway経由でルーティングされる宛先
          items:
            $ref: '#/components/schemas/DevinConnectDestination'
          title: Destinations
          type: array
        gateway_id:
          description: gatewayのID
          title: Gateway Id
          type: string
        kind:
          description: >-
            tunnel：顧客側のgatewayから接続します。direct：Devinからgatewayに接続します（例：AWS
            PrivateLink経由）
          enum:
            - tunnel
            - direct
          title: Kind
          type: string
        last_connected_at:
          anyOf:
            - type: integer
            - type: 'null'
          description: トンネルgatewayから最後に通信があった日時
          title: Last Connected At
        name:
          description: gateway名
          title: Name
          type: string
      required:
        - gateway_id
        - name
        - kind
        - destinations
      title: DevinConnectGateway
      type: object
    ProblemDetail:
      description: >-
        v3 API 用の RFC 9457 application/problem+json エラーボディ。


        detail は後方互換性のため、レガシーな {"detail": ...}
        ボディから引き継がれます。その他のメンバーは追加式です。errors にはフィールドレベルのバリデーションエラーが含まれます（422
        の場合のみ）。
      properties:
        detail:
          anyOf:
            - type: string
            - type: 'null'
          description: この事象に固有の、人が読める説明。
          title: Detail
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          description: ブロックされた操作の拒否理由を示す機械可読コード（例："user_frozen"、"migrated_session"）。
          title: Error Code
        errors:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: フィールド単位のバリデーションエラー（422 レスポンスのみ）。
          title: Errors
        instance:
          anyOf:
            - type: string
            - type: 'null'
          description: この発生箇所の URI 参照（リクエストパス）。
          title: Instance
        status:
          description: HTTP ステータスコード。
          title: Status
          type: integer
        title:
          description: 問題タイプを人が読める短い要約。
          title: Title
          type: string
        type:
          default: about:blank
          description: 問題タイプを識別する URI 参照。
          title: Type
          type: string
      required:
        - title
        - status
      title: ProblemDetail
      type: object
    DevinConnectDestination:
      description: 1つの宛先：``hostname``または``ipv4``のいずれか一方のみ。
      properties:
        hostname:
          anyOf:
            - type: string
            - type: 'null'
          description: 完全一致のDNS名（ワイルドカード不可）。例：git.corp.example
          title: Hostname
        ipv4:
          anyOf:
            - type: string
            - type: 'null'
          description: IPv4アドレスまたはCIDR。例：10.20.0.0/16。アドレスのみの場合は/32として扱われます
          title: Ipv4
      title: DevinConnectDestination
      type: object
  securitySchemes:
    bearerAuth:
      description: 'サービスユーザーの認証情報（接頭辞: cog_）'
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.