Save GitHub tool connection¶
Save the GitHub tool connection for the current workspace. The access token in the request is only used to establish or update credentials, the token is not echoed on a successful response.
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/tools/github/connect
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
Request¶
curl -X POST "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/tools/github/connect" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"access_token": "<GITHUB_ACCESS_TOKEN>"
}'
Path parameters
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
The current workspace ID. |
Request body
Field |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
GitHub access token. Do not include the |
Successful response¶
Returns 200 on success. Reconnecting updates the GitHub connection in the workspace.
{
"code": 0,
"data": {
"tool_id": "moi.github.tools",
"credential_ref": "cred_01",
"status": "connected",
"connected_at": "2026-01-02T15:04:05Z",
"requires_reconnect": false
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
GitHub built-in tool identifier. |
|
string |
A reference to a saved credential, not an access token. |
|
string |
Connection status; new connection is |
|
string |
The time the connection was established, using RFC 3339 format. |
|
boolean |
Whether to reconnect; the new connection is |
Error response¶
{
"code": 2,
"message": "<错误信息>"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The request body is invalid, or the access token is empty, contains the |
Submit the token value itself and check the field format. |
|
|
Lack of valid identity credentials. |
Check API Key. |
|
|
The current identity does not have permission to manage tool connections in the workspace. |
Check workspace authorization. |
|
|
The GitHub tool connection service or authorization dependency is temporarily unavailable. |
Try again later. |
Follow-up operations¶
After saving, Query GitHub tool connection confirms the connection configuration.