Save email tool connection

Save the email tool connection for the current workspace. The service will first test the email connection. Current connection credentials are not saved or rotated on test failure. The password is only used for connection testing and saving and is not returned in the response.

HTTP
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/tools/mail/{provider}/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/mail/qq/connect" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "email": "user@example.com",
    "password": "<MAIL_PASSWORD>"
  }'

Parameter

Type

Required

Description

workspace_id

string

Yes

Current workspace ID.

provider

string

Yes

Email provider: qq or wecom.

email

string

Yes

Email address. It must be a complete and valid email address and cannot contain leading or trailing spaces.

password

string

Yes

Email password or authorization code. It cannot be empty and cannot contain leading or trailing blanks or newlines.

Successful response

JSON
{
  "code": 0,
  "data": {
    "tool_id": "moi.qq.mail",
    "provider": "qq",
    "email": "user@example.com",
    "credential_ref": "cred_01",
    "status": "connected",
    "connected_at": "2026-01-02T15:04:05Z",
    "requires_reconnect": false
  }
}

Returns 200 on success. The return value does not contain the password.

Field

Type

Description

code

integer

0 on success.

data.tool_id

string

Corresponds to the provider’s built-in tool identifier.

data.provider

string

Connected mail provider.

data.email

string

Saved email address.

data.credential_ref

string

A reference to a saved credential, not a password.

data.status

string

Connection status and whether reconnection is required.

data.requires_reconnect

boolean

Connection status and whether reconnection is required.

data.connected_at

string

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

Error response

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

Common HTTP errors

HTTP status code

error code

Description

400

2(INVALID_ARGUMENT)

Common reasons: provider, email, password or email connection test is invalid. Recommended Action: provider Use only qq or wecom. Check email, password or authorization code.

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.

404

3(NOT_FOUND)

Common reasons: The corresponding built-in email tool cannot be found in the current environment. Recommended Action: Check the provider and confirm that the tool is available.

503

15(UNAVAILABLE)

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

Last updated on