English ← MyDocs

创建工作区

post /v1/organizations/workspaces

创建工作区

请求头参数

  • "anthropic-beta": optional array of string

    可选的请求头,用于指定要使用的 beta 版本。

    如需使用多个 beta 版本,请使用逗号分隔的列表,如 beta1,beta2,或为每个 beta 版本分别指定该请求头。

请求体参数

  • name: string

    工作区的名称。

  • data_residency: optional object { allowed_inference_geos, default_inference_geo, workspace_geo }

    工作区的数据驻留配置。如果省略,默认值为 workspace_geo="us"、allowed_inference_geos="unrestricted" 和 default_inference_geo="global"

    • allowed_inference_geos: optional array of string or "unrestricted"

      允许的推理地理位置值。如果省略,默认为 'unrestricted',即允许所有地理位置。使用字符串 'unrestricted' 允许所有地理位置,或使用特定地理位置的列表。

      • array of string

      • "unrestricted"

        • "unrestricted"
    • default_inference_geo: optional string

      当请求省略该参数时应用的默认推理地理位置。如果省略,默认为 'global'。除非 allowed_inference_geos 为 "unrestricted",否则必须是 allowed_inference_geos 的成员。

    • workspace_geo: optional string

      工作区数据存储的地理区域。创建后不可更改。如果省略,默认为 'us'。

  • tags: optional map[string]

    用户自定义的字符串键值对标签。键不能以 anthropic 开头。

返回值

  • Workspace object { id, archived_at, created_at, 5 more }

    • id: string

      工作区的 ID。

    • archived_at: string

      RFC 3339 格式的日期时间字符串,表示工作区被归档的时间。如果工作区未被归档,则为 null

    • created_at: string

      RFC 3339 格式的日期时间字符串,表示工作区的创建时间。

    • data_residency: object { allowed_inference_geos, default_inference_geo, workspace_geo }

      数据驻留配置。

      • allowed_inference_geos: array of string or "unrestricted"

        允许的推理地理位置值。'unrestricted' 表示允许所有地理位置。

        • array of string

        • "unrestricted"

          • "unrestricted"
      • default_inference_geo: string

        当请求省略该参数时应用的默认推理地理位置。

      • workspace_geo: string

        工作区数据存储的地理区域。创建后不可更改。

    • display_color: string

      在 Anthropic 控制台中代表该工作区的十六进制颜色代码。

    • name: string

      工作区的名称。

    • tags: map[string]

      用户自定义的字符串键值对标签。键不能以 anthropic 开头。

    • type: "workspace"

      对象类型。

      对于工作区,始终为 "workspace"

      • "workspace"

示例

curl https://api.anthropic.com/v1/organizations/workspaces \
    -H 'Content-Type: application/json' \
    -H 'anthropic-version: 2023-06-01' \
    -H "X-Api-Key: $ANTHROPIC_ADMIN_API_KEY" \
    -d '{
          "name": "x",
          "tags": {
            "env": "prod",
            "team": "platform"
          }
        }'

响应

{
  "id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",
  "archived_at": "2024-11-01T23:59:27.427722Z",
  "created_at": "2024-10-30T23:58:27.427722Z",
  "data_residency": {
    "allowed_inference_geos": "unrestricted",
    "default_inference_geo": "default_inference_geo",
    "workspace_geo": "workspace_geo"
  },
  "display_color": "#6C5BB9",
  "name": "Workspace Name",
  "tags": {
    "env": "prod",
    "team": "platform"
  },
  "type": "workspace"
}