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.

HTTP
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/tools/github/connect

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. Prepare a personal access token and target workspace ID that can access the target workspace.

Request body

Shell
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>"
  }'

Parameter

Type

Required

Description

workspace_id

string

Yes

Current workspace ID.

access_token

string

Yes

The GitHub access token itself, do not include the Bearer prefix. The token cannot contain leading or trailing whitespace, newlines, or path separators.

Successful response

JSON
{
  "code": 0,
  "data": {
    "tool_id": "moi.github.tools",
    "credential_ref": "cred_01",
    "status": "connected",
    "connected_at": "2026-01-02T15:04:05Z",
    "requires_reconnect": false
  }
}

Returns 200 on success. Reconnecting will update the GitHub connection in the workspace.

Field

Type

Description

code

integer

0 on success.

data.tool_id

string

GitHub built-in tool identification.

data.credential_ref

string

A reference to saved credentials, not an access token.

data.status

string

Connection status. The new connection is connected.

data.connected_at

string

The time the connection was established, using RFC 3339 format.

data.requires_reconnect

boolean

Does it need to be reconnected? The new connection is false.

Error response

JSON
{
  "code": 2,
  "message": "<错误信息>"
}

Common HTTP errors

HTTP status code

error code

Description

400

2(INVALID_ARGUMENT)

Common reasons: The request body is invalid, or the access token is empty, contains the Bearer prefix, newlines, or disallowed characters. Recommended Action: Submit the token value itself, and check the field format.

401

6(UNAUTHENTICATED)

Common Cause: Valid identity credentials are missing. Recommended Action: Check the API Key.

403

5(PERMISSION_DENIED)

Common reasons: The current identity does not have the permission to manage tool connections in the workspace. Recommended Action: Check the workspace authorization.

503

15(UNAVAILABLE)

Common reasons: The GitHub tool connection service or authorization dependency is temporarily unavailable. Recommended Action: Try again later.

Last updated on