Rotate stored credentials for an MCP server
curl --request POST \
--url https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"bearerToken": "<string>",
"apiKeyValue": "<string>",
"apiKeyHeader": "<string>",
"oauthClientId": "<string>",
"oauthClientSecret": "<string>",
"oauthTokenUrl": "<string>",
"oauthScopes": [
"<string>"
]
}
'import requests
url = "https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential"
payload = {
"bearerToken": "<string>",
"apiKeyValue": "<string>",
"apiKeyHeader": "<string>",
"oauthClientId": "<string>",
"oauthClientSecret": "<string>",
"oauthTokenUrl": "<string>",
"oauthScopes": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
bearerToken: '<string>',
apiKeyValue: '<string>',
apiKeyHeader: '<string>',
oauthClientId: '<string>',
oauthClientSecret: '<string>',
oauthTokenUrl: '<string>',
oauthScopes: ['<string>']
})
};
fetch('https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'bearerToken' => '<string>',
'apiKeyValue' => '<string>',
'apiKeyHeader' => '<string>',
'oauthClientId' => '<string>',
'oauthClientSecret' => '<string>',
'oauthTokenUrl' => '<string>',
'oauthScopes' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential"
payload := strings.NewReader("{\n \"bearerToken\": \"<string>\",\n \"apiKeyValue\": \"<string>\",\n \"apiKeyHeader\": \"<string>\",\n \"oauthClientId\": \"<string>\",\n \"oauthClientSecret\": \"<string>\",\n \"oauthTokenUrl\": \"<string>\",\n \"oauthScopes\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.post("https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"bearerToken\": \"<string>\",\n \"apiKeyValue\": \"<string>\",\n \"apiKeyHeader\": \"<string>\",\n \"oauthClientId\": \"<string>\",\n \"oauthClientSecret\": \"<string>\",\n \"oauthTokenUrl\": \"<string>\",\n \"oauthScopes\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bearerToken\": \"<string>\",\n \"apiKeyValue\": \"<string>\",\n \"apiKeyHeader\": \"<string>\",\n \"oauthClientId\": \"<string>\",\n \"oauthClientSecret\": \"<string>\",\n \"oauthTokenUrl\": \"<string>\",\n \"oauthScopes\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_bodyMCP Servers
Rotate stored credentials for an MCP server
Security Requirements
| Auth Types | Entities | Permissions | Required Roles |
|---|---|---|---|
| USER | MCP_REGISTRY | WRITE | MCP_REGISTRY:WRITE |
POST
/
registry
/
v1
/
mcp-servers
/
{mcpServerId}
/
credential
Rotate stored credentials for an MCP server
curl --request POST \
--url https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"bearerToken": "<string>",
"apiKeyValue": "<string>",
"apiKeyHeader": "<string>",
"oauthClientId": "<string>",
"oauthClientSecret": "<string>",
"oauthTokenUrl": "<string>",
"oauthScopes": [
"<string>"
]
}
'import requests
url = "https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential"
payload = {
"bearerToken": "<string>",
"apiKeyValue": "<string>",
"apiKeyHeader": "<string>",
"oauthClientId": "<string>",
"oauthClientSecret": "<string>",
"oauthTokenUrl": "<string>",
"oauthScopes": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
bearerToken: '<string>',
apiKeyValue: '<string>',
apiKeyHeader: '<string>',
oauthClientId: '<string>',
oauthClientSecret: '<string>',
oauthTokenUrl: '<string>',
oauthScopes: ['<string>']
})
};
fetch('https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'bearerToken' => '<string>',
'apiKeyValue' => '<string>',
'apiKeyHeader' => '<string>',
'oauthClientId' => '<string>',
'oauthClientSecret' => '<string>',
'oauthTokenUrl' => '<string>',
'oauthScopes' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential"
payload := strings.NewReader("{\n \"bearerToken\": \"<string>\",\n \"apiKeyValue\": \"<string>\",\n \"apiKeyHeader\": \"<string>\",\n \"oauthClientId\": \"<string>\",\n \"oauthClientSecret\": \"<string>\",\n \"oauthTokenUrl\": \"<string>\",\n \"oauthScopes\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.post("https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"bearerToken\": \"<string>\",\n \"apiKeyValue\": \"<string>\",\n \"apiKeyHeader\": \"<string>\",\n \"oauthClientId\": \"<string>\",\n \"oauthClientSecret\": \"<string>\",\n \"oauthTokenUrl\": \"<string>\",\n \"oauthScopes\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swarmd.ai/registry/v1/mcp-servers/{mcpServerId}/credential")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bearerToken\": \"<string>\",\n \"apiKeyValue\": \"<string>\",\n \"apiKeyHeader\": \"<string>\",\n \"oauthClientId\": \"<string>\",\n \"oauthClientSecret\": \"<string>\",\n \"oauthTokenUrl\": \"<string>\",\n \"oauthScopes\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
JWT token (USER, AGENT, or SERVICE auth)
Path Parameters
Body
application/json
Auth scheme used when calling the MCP server.
Available options:
NONE, BEARER, API_KEY, OAUTH2_CLIENT_CREDENTIALS Bearer token (BEARER scheme only).
API key value (API_KEY scheme only).
Header name for the API key, e.g. 'X-Api-Key' (API_KEY scheme only).
OAuth2 client ID (OAUTH2_CLIENT_CREDENTIALS scheme only).
OAuth2 client secret (OAUTH2_CLIENT_CREDENTIALS scheme only).
OAuth2 token endpoint (OAUTH2_CLIENT_CREDENTIALS scheme only).
OAuth2 scopes (OAUTH2_CLIENT_CREDENTIALS scheme only).
OAuth2 scopes (OAUTH2_CLIENT_CREDENTIALS scheme only).
Response
204
No Content
⌘I
