本页内容
Sommatic 文档
打开控制台

凭据 Beta

节点访问外部系统时使用的凭据。

以 Markdown 查看
在以下应用中打开

创建新凭据。

POST /platform-infrastructure/credential/

返回根据所提供数据创建的凭据。

认证: Bearer 令牌

请求体

要创建的凭据对象。

organization_id string

此凭据所关联组织的标识符。

slug string 必填

在组织或租户内唯一标识此凭据的稳定语义键。

name string 必填

凭据的可读名称,用于编辑器、日志和审计记录。

type PlatformInfrastructureCredentialType 必填

凭据类型对象 { id, name, title, color }。

id integer 必填

类型的数字标识符。

name string 必填

机器可读的类型名称。

title string 必填

可读标签。

color string

类型徽标的 UI 颜色,可选。

description string

可选描述,说明此凭据的用途及适用场景。

connector_slug string

此凭据主要关联的 ConnectorModel 引用,可选。

provider PlatformInfrastructureCredentialProvider

标识外部服务的提供方对象 { id, name, title, color },可选。

id integer 必填

提供方的数字标识符。

name string 必填

机器可读的提供方名称。

title string 必填

可读标签。

color string

提供方徽标的 UI 颜色,可选。

secret_backend string

保存实际密钥材料的密钥存储后端标识符(例如 "sommatics-vault"、"aws-kms")。

secret_handle object

以 AES-256-GCM 加密的密钥材料,存储为 { iv, content, tag }。创建时加密,仅由 resolve 端点解密。

masked_preview string

密钥的掩码预览(例如最后 4 个字符),可选,仅用于 UI 显示。

scopes array<string>

与此凭据关联的权限范围、角色或 API 授权列表,可选。

allowed_connector_slugs array<string>

允许使用此凭据进行出站调用的连接器键列表,可选。

expires_at string

过期时间戳,可选,过期后不得再使用此凭据。

last_rotated_at string

底层密钥材料最近一次成功轮换的时间戳。

rotation_policy PlatformInfrastructureCredentialRotationPolicy

可选的轮换策略,说明此凭据应如何以及何时轮换。

enabled boolean

此凭据是否启用轮换。

strategy object

轮换策略 { id, name, title }。

id integer
name string
title string
interval_days integer

两次轮换之间的天数。strategy 为 "scheduled" 时适用。

notify_before_days integer

轮换前多少天发送通知。

is_revoked boolean

表示此凭据是否已被吊销、不得再使用。

is_enabled boolean

表示此凭据当前是否处于激活状态且可用。

is_system boolean

表示此凭据是否由平台管理,而非用户创建。

tags array<string>

用于治理、搜索和报表的自由格式标签列表,可选。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X POST https://api.sommatic.ai/platform-infrastructure/credential/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "<slug>",
    "name": "<name>",
    "type": {
      "id": 1,
      "name": "api-key",
      "title": "API Key",
      "color": "#1976d2"
    }
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_1234567890",
    "slug": "cred_slack_support_bot",
    "name": "Slack Support Bot OAuth Credential",
    "type": {
      "id": 2,
      "name": "oauth2",
      "title": "OAuth 2.0",
      "color": "#7b1fa2"
    },
    "description": "OAuth2 access token for the Slack support bot used in customer support flows.",
    "connector_slug": "connector:http.slack",
    "provider": {
      "id": 5,
      "name": "slack",
      "title": "Slack",
      "color": "#4A154B"
    },
    "secret_backend": "sommatic-vault",
    "secret_handle": "vault://slack/support-bot/oauth-token",
    "masked_preview": "xoxb-****-1234",
    "scopes": [
      "chat:write",
      "users:read"
    ],
    "allowed_connector_slugs": [
      "connector:http.slack"
    ],
    "expires_at": "2026-01-01T00:00:00.000Z",
    "last_rotated_at": "2025-07-01T10:15:00.000Z",
    "rotation_policy": {
      "enabled": true,
      "strategy": {
        "id": 2,
        "name": "scheduled",
        "title": "Scheduled"
      },
      "interval_days": 90,
      "notify_before_days": 7
    },
    "is_system": false,
    "tags": [
      "slack",
      "oauth2",
      "support"
    ]
  }
}

更新现有凭据。

PATCH /platform-infrastructure/credential/

使用所提供的数据更新现有凭据。

认证: Bearer 令牌

请求体

要更新的凭据对象。

organization_id string

此凭据所关联组织的标识符。

slug string 必填

在组织或租户内唯一标识此凭据的稳定语义键。

name string 必填

凭据的可读名称,用于编辑器、日志和审计记录。

type PlatformInfrastructureCredentialType 必填

凭据类型对象 { id, name, title, color }。

id integer 必填

类型的数字标识符。

name string 必填

机器可读的类型名称。

title string 必填

可读标签。

color string

类型徽标的 UI 颜色,可选。

description string

可选描述,说明此凭据的用途及适用场景。

connector_slug string

此凭据主要关联的 ConnectorModel 引用,可选。

provider PlatformInfrastructureCredentialProvider

标识外部服务的提供方对象 { id, name, title, color },可选。

id integer 必填

提供方的数字标识符。

name string 必填

机器可读的提供方名称。

title string 必填

可读标签。

color string

提供方徽标的 UI 颜色,可选。

secret_backend string

保存实际密钥材料的密钥存储后端标识符(例如 "sommatics-vault"、"aws-kms")。

secret_handle object

以 AES-256-GCM 加密的密钥材料,存储为 { iv, content, tag }。创建时加密,仅由 resolve 端点解密。

masked_preview string

密钥的掩码预览(例如最后 4 个字符),可选,仅用于 UI 显示。

scopes array<string>

与此凭据关联的权限范围、角色或 API 授权列表,可选。

allowed_connector_slugs array<string>

允许使用此凭据进行出站调用的连接器键列表,可选。

expires_at string

过期时间戳,可选,过期后不得再使用此凭据。

last_rotated_at string

底层密钥材料最近一次成功轮换的时间戳。

rotation_policy PlatformInfrastructureCredentialRotationPolicy

可选的轮换策略,说明此凭据应如何以及何时轮换。

enabled boolean

此凭据是否启用轮换。

strategy object

轮换策略 { id, name, title }。

id integer
name string
title string
interval_days integer

两次轮换之间的天数。strategy 为 "scheduled" 时适用。

notify_before_days integer

轮换前多少天发送通知。

is_revoked boolean

表示此凭据是否已被吊销、不得再使用。

is_enabled boolean

表示此凭据当前是否处于激活状态且可用。

is_system boolean

表示此凭据是否由平台管理,而非用户创建。

tags array<string>

用于治理、搜索和报表的自由格式标签列表,可选。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X PATCH https://api.sommatic.ai/platform-infrastructure/credential/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "<slug>",
    "name": "<name>",
    "type": {
      "id": 1,
      "name": "api-key",
      "title": "API Key",
      "color": "#1976d2"
    }
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_1234567890",
    "slug": "cred_slack_support_bot",
    "name": "Slack Support Bot OAuth Credential",
    "type": {
      "id": 2,
      "name": "oauth2",
      "title": "OAuth 2.0",
      "color": "#7b1fa2"
    },
    "description": "OAuth2 access token for the Slack support bot used in customer support flows.",
    "connector_slug": "connector:http.slack",
    "provider": {
      "id": 5,
      "name": "slack",
      "title": "Slack",
      "color": "#4A154B"
    },
    "secret_backend": "sommatic-vault",
    "secret_handle": "vault://slack/support-bot/oauth-token",
    "masked_preview": "xoxb-****-1234",
    "scopes": [
      "chat:write",
      "users:read"
    ],
    "allowed_connector_slugs": [
      "connector:http.slack"
    ],
    "expires_at": "2026-01-01T00:00:00.000Z",
    "last_rotated_at": "2025-07-01T10:15:00.000Z",
    "rotation_policy": {
      "enabled": true,
      "strategy": {
        "id": 2,
        "name": "scheduled",
        "title": "Scheduled"
      },
      "interval_days": 90,
      "notify_before_days": 7
    },
    "is_system": false,
    "tags": [
      "slack",
      "oauth2",
      "support"
    ]
  }
}

按 ID 删除凭据。

DELETE /platform-infrastructure/credential/

根据提供的 ID 删除凭据。

认证: Bearer 令牌

请求体

要删除的凭据 ID

id string

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X DELETE https://api.sommatic.ai/platform-infrastructure/credential/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "<id>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Credential successfully deleted",
  "result": null
}

按查询选择器获取凭据。

GET /platform-infrastructure/credential/{queryselector}

返回与路由中指定的查询选择器和搜索条件匹配的凭据信息。

认证: Bearer 令牌

参数

queryselector enum 路径 必填

此查询可用的筛选条件

idorganization-idallstatus

search string 查询

用于搜索实体的关键字。

include_status string 查询

可选的状态参数,用于包含指定状态的凭据。

exclude_status string 查询

可选的状态参数,用于排除指定状态的凭据。

page integer 查询

页码,从 1 开始(默认 1)。

pageSize integer 查询

每页记录数(默认 25)。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X GET https://api.sommatic.ai/platform-infrastructure/credential/id \
  -H "Authorization: Bearer $SOMMATIC_TOKEN"
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_1234567890",
    "slug": "cred_slack_support_bot",
    "name": "Slack Support Bot OAuth Credential",
    "type": {
      "id": 2,
      "name": "oauth2",
      "title": "OAuth 2.0",
      "color": "#7b1fa2"
    },
    "description": "OAuth2 access token for the Slack support bot used in customer support flows.",
    "connector_slug": "connector:http.slack",
    "provider": {
      "id": 5,
      "name": "slack",
      "title": "Slack",
      "color": "#4A154B"
    },
    "secret_backend": "sommatic-vault",
    "secret_handle": "vault://slack/support-bot/oauth-token",
    "masked_preview": "xoxb-****-1234",
    "scopes": [
      "chat:write",
      "users:read"
    ],
    "allowed_connector_slugs": [
      "connector:http.slack"
    ],
    "expires_at": "2026-01-01T00:00:00.000Z",
    "last_rotated_at": "2025-07-01T10:15:00.000Z",
    "rotation_policy": {
      "enabled": true,
      "strategy": {
        "id": 2,
        "name": "scheduled",
        "title": "Scheduled"
      },
      "interval_days": 90,
      "notify_before_days": 7
    },
    "is_system": false,
    "tags": [
      "slack",
      "oauth2",
      "support"
    ]
  }
}

安装智能体工具

为你的编程智能体接入 Sommatic AI 官方文档:技能包、文档 MCP 服务器与 Markdown 页面,无需再抓取网页。

仅安装技能包,不会自动更新;需要时重新运行即可。

npx skills add https://docs.sommatic.ai
智能体如何读取本文档