凭据 Beta
节点访问外部系统时使用的凭据。
创建新凭据。
POST /platform-infrastructure/credential/
返回根据所提供数据创建的凭据。
认证: Bearer 令牌
请求体
要创建的凭据对象。
-
organization_idstring -
此凭据所关联组织的标识符。
-
slugstring 必填 -
在组织或租户内唯一标识此凭据的稳定语义键。
-
namestring 必填 -
凭据的可读名称,用于编辑器、日志和审计记录。
-
typePlatformInfrastructureCredentialType 必填 -
凭据类型对象 { id, name, title, color }。
-
idinteger 必填 -
类型的数字标识符。
-
namestring 必填 -
机器可读的类型名称。
-
titlestring 必填 -
可读标签。
-
colorstring -
类型徽标的 UI 颜色,可选。
-
-
descriptionstring -
可选描述,说明此凭据的用途及适用场景。
-
connector_slugstring -
此凭据主要关联的 ConnectorModel 引用,可选。
-
providerPlatformInfrastructureCredentialProvider -
标识外部服务的提供方对象 { id, name, title, color },可选。
-
idinteger 必填 -
提供方的数字标识符。
-
namestring 必填 -
机器可读的提供方名称。
-
titlestring 必填 -
可读标签。
-
colorstring -
提供方徽标的 UI 颜色,可选。
-
-
secret_backendstring -
保存实际密钥材料的密钥存储后端标识符(例如 "sommatics-vault"、"aws-kms")。
-
secret_handleobject -
以 AES-256-GCM 加密的密钥材料,存储为 { iv, content, tag }。创建时加密,仅由 resolve 端点解密。
-
masked_previewstring -
密钥的掩码预览(例如最后 4 个字符),可选,仅用于 UI 显示。
-
scopesarray<string> -
与此凭据关联的权限范围、角色或 API 授权列表,可选。
-
allowed_connector_slugsarray<string> -
允许使用此凭据进行出站调用的连接器键列表,可选。
-
expires_atstring -
过期时间戳,可选,过期后不得再使用此凭据。
-
last_rotated_atstring -
底层密钥材料最近一次成功轮换的时间戳。
-
rotation_policyPlatformInfrastructureCredentialRotationPolicy -
可选的轮换策略,说明此凭据应如何以及何时轮换。
-
enabledboolean -
此凭据是否启用轮换。
-
strategyobject -
轮换策略 { id, name, title }。
-
idinteger -
namestring -
titlestring
-
-
interval_daysinteger -
两次轮换之间的天数。strategy 为 "scheduled" 时适用。
-
notify_before_daysinteger -
轮换前多少天发送通知。
-
-
is_revokedboolean -
表示此凭据是否已被吊销、不得再使用。
-
is_enabledboolean -
表示此凭据当前是否处于激活状态且可用。
-
is_systemboolean -
表示此凭据是否由平台管理,而非用户创建。
-
tagsarray<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"
}
}'const response = await fetch('https://api.sommatic.ai/platform-infrastructure/credential/', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SOMMATIC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"slug": "<slug>",
"name": "<name>",
"type": {
"id": 1,
"name": "api-key",
"title": "API Key",
"color": "#1976d2"
}
}),
});
const { success, message, result } = await response.json();import os
import requests
response = requests.post(
"https://api.sommatic.ai/platform-infrastructure/credential/",
headers={
"Authorization": f"Bearer {os.environ['SOMMATIC_TOKEN']}",
},
json={
"slug": "<slug>",
"name": "<name>",
"type": {
"id": 1,
"name": "api-key",
"title": "API Key",
"color": "#1976d2"
}
},
)
data = response.json(){
"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"
]
}
}{
"status": 500,
"success": false,
"message": "Something was wrong while you make this action",
"result": null
}更新现有凭据。
PATCH /platform-infrastructure/credential/
使用所提供的数据更新现有凭据。
认证: Bearer 令牌
请求体
要更新的凭据对象。
-
organization_idstring -
此凭据所关联组织的标识符。
-
slugstring 必填 -
在组织或租户内唯一标识此凭据的稳定语义键。
-
namestring 必填 -
凭据的可读名称,用于编辑器、日志和审计记录。
-
typePlatformInfrastructureCredentialType 必填 -
凭据类型对象 { id, name, title, color }。
-
idinteger 必填 -
类型的数字标识符。
-
namestring 必填 -
机器可读的类型名称。
-
titlestring 必填 -
可读标签。
-
colorstring -
类型徽标的 UI 颜色,可选。
-
-
descriptionstring -
可选描述,说明此凭据的用途及适用场景。
-
connector_slugstring -
此凭据主要关联的 ConnectorModel 引用,可选。
-
providerPlatformInfrastructureCredentialProvider -
标识外部服务的提供方对象 { id, name, title, color },可选。
-
idinteger 必填 -
提供方的数字标识符。
-
namestring 必填 -
机器可读的提供方名称。
-
titlestring 必填 -
可读标签。
-
colorstring -
提供方徽标的 UI 颜色,可选。
-
-
secret_backendstring -
保存实际密钥材料的密钥存储后端标识符(例如 "sommatics-vault"、"aws-kms")。
-
secret_handleobject -
以 AES-256-GCM 加密的密钥材料,存储为 { iv, content, tag }。创建时加密,仅由 resolve 端点解密。
-
masked_previewstring -
密钥的掩码预览(例如最后 4 个字符),可选,仅用于 UI 显示。
-
scopesarray<string> -
与此凭据关联的权限范围、角色或 API 授权列表,可选。
-
allowed_connector_slugsarray<string> -
允许使用此凭据进行出站调用的连接器键列表,可选。
-
expires_atstring -
过期时间戳,可选,过期后不得再使用此凭据。
-
last_rotated_atstring -
底层密钥材料最近一次成功轮换的时间戳。
-
rotation_policyPlatformInfrastructureCredentialRotationPolicy -
可选的轮换策略,说明此凭据应如何以及何时轮换。
-
enabledboolean -
此凭据是否启用轮换。
-
strategyobject -
轮换策略 { id, name, title }。
-
idinteger -
namestring -
titlestring
-
-
interval_daysinteger -
两次轮换之间的天数。strategy 为 "scheduled" 时适用。
-
notify_before_daysinteger -
轮换前多少天发送通知。
-
-
is_revokedboolean -
表示此凭据是否已被吊销、不得再使用。
-
is_enabledboolean -
表示此凭据当前是否处于激活状态且可用。
-
is_systemboolean -
表示此凭据是否由平台管理,而非用户创建。
-
tagsarray<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"
}
}'const response = await fetch('https://api.sommatic.ai/platform-infrastructure/credential/', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.SOMMATIC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"slug": "<slug>",
"name": "<name>",
"type": {
"id": 1,
"name": "api-key",
"title": "API Key",
"color": "#1976d2"
}
}),
});
const { success, message, result } = await response.json();import os
import requests
response = requests.patch(
"https://api.sommatic.ai/platform-infrastructure/credential/",
headers={
"Authorization": f"Bearer {os.environ['SOMMATIC_TOKEN']}",
},
json={
"slug": "<slug>",
"name": "<name>",
"type": {
"id": 1,
"name": "api-key",
"title": "API Key",
"color": "#1976d2"
}
},
)
data = response.json(){
"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"
]
}
}{
"status": 500,
"success": false,
"message": "Something was wrong while you make this action",
"result": null
}按 ID 删除凭据。
DELETE /platform-infrastructure/credential/
根据提供的 ID 删除凭据。
认证: Bearer 令牌
请求体
要删除的凭据 ID
-
idstring
响应
-
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>"
}'const response = await fetch('https://api.sommatic.ai/platform-infrastructure/credential/', {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.SOMMATIC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"id": "<id>"
}),
});
const { success, message, result } = await response.json();import os
import requests
response = requests.delete(
"https://api.sommatic.ai/platform-infrastructure/credential/",
headers={
"Authorization": f"Bearer {os.environ['SOMMATIC_TOKEN']}",
},
json={
"id": "<id>"
},
)
data = response.json(){
"status": 200,
"success": true,
"message": "Credential successfully deleted",
"result": null
}{
"status": 500,
"success": false,
"message": "Something went wrong while performing this action",
"result": null
}按查询选择器获取凭据。
GET /platform-infrastructure/credential/{queryselector}
返回与路由中指定的查询选择器和搜索条件匹配的凭据信息。
认证: Bearer 令牌
参数
-
queryselectorenum 路径 必填 -
此查询可用的筛选条件
idorganization-idallstatus -
searchstring 查询 -
用于搜索实体的关键字。
-
include_statusstring 查询 -
可选的状态参数,用于包含指定状态的凭据。
-
exclude_statusstring 查询 -
可选的状态参数,用于排除指定状态的凭据。
-
pageinteger 查询 -
页码,从 1 开始(默认 1)。
-
pageSizeinteger 查询 -
每页记录数(默认 25)。
响应
-
200成功。 -
500执行此操作时出错。
curl -X GET https://api.sommatic.ai/platform-infrastructure/credential/id \
-H "Authorization: Bearer $SOMMATIC_TOKEN"const response = await fetch('https://api.sommatic.ai/platform-infrastructure/credential/id', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SOMMATIC_TOKEN}`,
},
});
const { success, message, result } = await response.json();import os
import requests
response = requests.get(
"https://api.sommatic.ai/platform-infrastructure/credential/id",
headers={
"Authorization": f"Bearer {os.environ['SOMMATIC_TOKEN']}",
},
)
data = response.json(){
"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"
]
}
}{
"status": 500,
"success": false,
"message": "Something was wrong while you make this action",
"result": null
}