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

# 设置组织默认平台（Devin API）

> 通过 v3 组织 API 设置或清除组织默认的 Devin 会话运行位置，可指定为托管平台或 outpost pool

设置新会话的组织级默认运行位置。该设置与 webapp 中 **Settings > Devin > Default platform** 的设置相同。创建会话时若未显式指定 `platform`，将优先使用创建者的个人默认设置，其次使用此设置。

<h2 id="permissions">
  权限
</h2>

需要使用在组织级别具有 `ManageOrgSettings` 权限的[服务用户](/zh/api-reference/v3/service-users/members-service-users)或[个人访问令牌](/zh/api-reference/personal-access-tokens)。

<h2 id="request-fields">
  请求字段
</h2>

以下字段最多只能发送其中一个：

* `platform`：为该组织配置的托管平台标签 (例如 `linux`、`windows` 或 `macos`) ，或共享 outpost pool 的名称，不区分大小写。如果某个名称同时匹配两者，则优先匹配平台。
* `outpost_pool_id`：该组织可用的共享 outpost pool 的 ID。

如需清除默认设置，请发送空 JSON 对象 (`{}`) ，或将两个字段都设为 `null`。请求体为必填项。

只有共享 outpost pool 才能设为组织默认设置。个人 outpost 不能作为组织默认设置，因为只有其所有者才能在上面启动会话。

<h2 id="outposts-only-organizations">
  仅限 Outposts 的组织
</h2>

当企业处于仅限 Outposts 模式时，只接受 outpost pool；使用托管平台标签将返回 `400`。

<h2 id="errors">
  错误
</h2>

* 返回 `400` 的情况：`platform` 未匹配任何已配置的平台或共享 outpost pool、匹配到多个 outpost pool，或在仅限 Outposts 的组织中指定了托管平台；或者 `outpost_pool_id` 并非该组织可用的共享 pool。错误响应体中会列出可用的平台和 outpost pool。
* 返回 `403` 的情况：调用方不具备 `ManageOrgSettings` 权限。
* 返回 `422` 的情况：同时设置了 `platform` 和 `outpost_pool_id`。

<h2 id="example">
  示例
</h2>

```bash theme={null}
curl -X PUT "https://api.devin.ai/v3beta1/organizations/$ORG_ID/default-platform" \
  -H "Authorization: Bearer $DEVIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"platform": "gpu-pool"}'
```


## OpenAPI

````yaml zh/v3-openapi.yaml PUT /v3beta1/organizations/{org_id}/default-platform
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/organizations/{org_id}/default-platform:
    put:
      tags:
        - organization-settings
      summary: 设置组织默认平台
      description: |-
        设置或清除组织中新会话的默认运行位置。

        接受托管平台标签、共享 outpost 资源池名称
        （``platform``）或共享 outpost 资源池 ID（``outpost_pool_id``）。
        仅使用 Outposts 的组织只接受 outpost 资源池。若两个参数均未提供，
        则清除默认值。
      operationId: >-
        handle_update_org_default_platform_v3beta1_organizations__org_id__default_platform_put
      parameters:
        - description: 组织 ID（前缀：org-）
          in: path
          name: org_id
          required: true
          schema:
            example: org-abc123def456
            title: Org Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrgDefaultPlatformUpdateRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrgDefaultPlatformResponse'
          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: 冲突
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 无法处理的内容
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 请求过多
components:
  schemas:
    OrgDefaultPlatformUpdateRequest:
      description: |-
        设置组织中新会话的默认运行位置。

        ``platform`` 和 ``outpost_pool_id`` 最多提供一个；将两者均设为
        null（例如 ``{}``）即可清除默认设置。
      properties:
        outpost_pool_id:
          anyOf:
            - maxLength: 128
              type: string
            - type: 'null'
          description: 组织可用的共享 outpost 资源池的 ID。
          title: Outpost Pool Id
        platform:
          anyOf:
            - maxLength: 128
              type: string
            - type: 'null'
          description: >-
            为组织配置的托管平台标签（例如 'linux'、'windows'、'macos'）或共享 outpost
            资源池的名称，不区分大小写；当名称同时匹配两者时，平台优先。无法识别的值会被拒绝，并返回 400，响应中会列出可用的平台和
            outpost 资源池。
          title: Platform
      title: OrgDefaultPlatformUpdateRequest
      type: object
    OrgDefaultPlatformResponse:
      description: 组织中新会话的默认运行位置。
      properties:
        outpost_pool_id:
          anyOf:
            - type: string
            - type: 'null'
          description: 新会话默认使用的 outpost 资源池。默认运行位置为托管平台或未设置时，为 Null。
          title: Outpost Pool Id
        outpost_pool_name:
          anyOf:
            - type: string
            - type: 'null'
          description: 默认 outpost 资源池的名称。默认运行位置不是 outpost 资源池，或该资源池已不再对组织可用时，为 Null。
          title: Outpost Pool Name
        platform:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            新会话默认使用的托管平台标签（例如 'linux'、'windows'）。默认运行位置为 outpost 资源池或未设置时，为
            Null。
          title: Platform
      required:
        - platform
        - outpost_pool_id
        - outpost_pool_name
      title: OrgDefaultPlatformResponse
      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
  securitySchemes:
    bearerAuth:
      description: 服务用户凭据（前缀：cog_）
      scheme: bearer
      type: http

````

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