凭据
创建凭据
通过 OMA API 创建凭据。
POST
/
v1
/
vaults
/
{vault_id}
/
credentials
创建凭据
curl --request POST \
--url http://localhost:38080/v1/vaults/{vault_id}/credentials \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"auth": {
"type": "static_bearer",
"token": "bearer_exampletoken",
"mcp_server_url": "https://example-server.modelcontextprotocol.io/sse"
}
}
'import requests
url = "http://localhost:38080/v1/vaults/{vault_id}/credentials"
payload = { "auth": {
"type": "static_bearer",
"token": "bearer_exampletoken",
"mcp_server_url": "https://example-server.modelcontextprotocol.io/sse"
} }
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
auth: {
type: 'static_bearer',
token: 'bearer_exampletoken',
mcp_server_url: 'https://example-server.modelcontextprotocol.io/sse'
}
})
};
fetch('http://localhost:38080/v1/vaults/{vault_id}/credentials', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:38080/v1/vaults/{vault_id}/credentials"
payload := strings.NewReader("{\n \"auth\": {\n \"type\": \"static_bearer\",\n \"token\": \"bearer_exampletoken\",\n \"mcp_server_url\": \"https://example-server.modelcontextprotocol.io/sse\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"type": "vault_credential",
"id": "vcrd_011CZkZEMt8gZan2iYOQfSkw",
"vault_id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
"display_name": "示例凭证",
"metadata": {
"environment": "production"
},
"created_at": "2026-03-15T10:00:00Z",
"updated_at": "2026-03-15T10:00:00Z",
"archived_at": null,
"auth": {
"type": "static_bearer",
"mcp_server_url": "https://example-server.modelcontextprotocol.io/sse"
}
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}每个请求都必须发送
?beta=true。授权
omaApiKeyomaBearer
OMA 工作区 API 密钥。
路径参数
密钥库标识符。
查询参数
为此接口启用 Beta API 合同,必须为 true。
可用选项:
true 请求体
application/json
该 credential 的认证配置。
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
示例:
{ "type": "static_bearer", "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse" }
凭据的可读名称。最多 255 个字符。
Maximum string length:
255示例:
"示例凭证"
附加到 credential 的任意键值元数据。最多 16 对,键最长 64 个字符,值最长 512 个字符。
Show child attributes
Show child attributes
示例:
{ "environment": "production" }
响应
请求成功。
存储在密钥库中的凭据。敏感字段永远不会在响应中返回。
可用选项:
vault_credential 示例:
"vault_credential"
凭据的唯一标识符。
示例:
"vcrd_011CZkZEMt8gZan2iYOQfSkw"
该 credential 所属密钥库的标识符。
示例:
"vlt_011CZkZDLs7fYzm1hXNPeRjv"
附加到该凭证的任意键值元数据。
Show child attributes
Show child attributes
示例:
{ "environment": "production" }
RFC 3339 格式的时间戳
示例:
"2026-03-15T10:00:00Z"
RFC 3339 格式的时间戳
示例:
"2026-03-15T10:00:00Z"
凭证的归档时间。未归档时为 null。
示例:
null
此 credential 的认证配置。
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
示例:
{ "type": "static_bearer", "mcp_server_url": "https://example-server.modelcontextprotocol.io/sse" }
凭据的人类可读名称。
示例:
"示例凭证"
此页面对您有帮助吗?
⌘I
创建凭据
curl --request POST \
--url http://localhost:38080/v1/vaults/{vault_id}/credentials \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"auth": {
"type": "static_bearer",
"token": "bearer_exampletoken",
"mcp_server_url": "https://example-server.modelcontextprotocol.io/sse"
}
}
'import requests
url = "http://localhost:38080/v1/vaults/{vault_id}/credentials"
payload = { "auth": {
"type": "static_bearer",
"token": "bearer_exampletoken",
"mcp_server_url": "https://example-server.modelcontextprotocol.io/sse"
} }
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
auth: {
type: 'static_bearer',
token: 'bearer_exampletoken',
mcp_server_url: 'https://example-server.modelcontextprotocol.io/sse'
}
})
};
fetch('http://localhost:38080/v1/vaults/{vault_id}/credentials', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:38080/v1/vaults/{vault_id}/credentials"
payload := strings.NewReader("{\n \"auth\": {\n \"type\": \"static_bearer\",\n \"token\": \"bearer_exampletoken\",\n \"mcp_server_url\": \"https://example-server.modelcontextprotocol.io/sse\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"type": "vault_credential",
"id": "vcrd_011CZkZEMt8gZan2iYOQfSkw",
"vault_id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
"display_name": "示例凭证",
"metadata": {
"environment": "production"
},
"created_at": "2026-03-15T10:00:00Z",
"updated_at": "2026-03-15T10:00:00Z",
"archived_at": null,
"auth": {
"type": "static_bearer",
"mcp_server_url": "https://example-server.modelcontextprotocol.io/sse"
}
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}