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.
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¶
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 |
|---|---|---|---|
|
string |
Yes |
Current workspace ID. |
|
string |
Yes |
Email provider: |
|
string |
Yes |
Email address. It must be a complete and valid email address and cannot contain leading or trailing spaces. |
|
string |
Yes |
Email password or authorization code. It cannot be empty and cannot contain leading or trailing blanks or newlines. |
Successful response¶
{
"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 |
|---|---|---|
|
integer |
|
|
string |
Corresponds to the provider’s built-in tool identifier. |
|
string |
Connected mail provider. |
|
string |
Saved email address. |
|
string |
A reference to a saved credential, not a password. |
|
string |
Connection status and whether reconnection is required. |
|
boolean |
Connection status and whether reconnection is required. |
|
string |
The time the connection was established, using RFC 3339 format. |
Error response¶
{
"code": 2,
"message": "<错误信息>"
}
Common HTTP errors
HTTP status code |
error code |
Description |
|---|---|---|
|
|
Common reasons: |
|
|
Common Cause: Valid identity credentials are missing. Recommended Action: Check the API Key. |
|
|
Common reasons: The current identity does not have the permission to manage tool connections in the workspace. Recommended Action: Check the workspace authorization. |
|
|
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. |
|
|
Common reasons: The email connection service or authorization dependency is temporarily unavailable. Recommended Action: Try again later. |