Accounts
此内容尚不支持你的语言。
GET /v1/accounts
List the accounts this token can read, with their connection status.
Scope: read
POST /v1/accounts
Register a new account, optionally with an ID and alias. The token must cover every account.
Scope: admin
Request body: CreateAccountRequest
DELETE /v1/accounts/{a}
Unregister a signed-out account. Its local files are kept. The body must repeat the account ID to confirm.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
Request body: NativeAccountRemovalRequest
Response: NativeAccountRemoval
GET /v1/accounts/{a}
Show one account and its connection status.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
PATCH /v1/accounts/{a}
Change an account alias or whether it connects automatically when the daemon starts.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
Request body: UpdateAccountRequest
GET /v1/accounts/{a}/capabilities
List what this daemon can do for the account, such as media limits and group changes.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
DELETE /v1/accounts/{a}/operations/{id}
Ask a background operation to stop.
Scope: any valid token
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Operation ID. |
Response: NativeOperation
GET /v1/accounts/{a}/operations/{id}
Show the state and result of a background operation.
Scope: any valid token
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Operation ID. |
Response: NativeOperation
POST /v1/accounts/{a}/projection/recover
Repair the account profile from records the daemon already holds. It never resends messages or starts transfers.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
GET /v1/accounts/{a}/schema
Describe the layout of the account’s saved WeChat profile.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
GET /v1/accounts/{a}/settings
Show the account settings.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
Response: AccountSettings
PATCH /v1/accounts/{a}/settings
Replace the account settings, such as the largest file to download automatically.
Scope: media
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
Request body: AccountSettings
Response: AccountSettings
GET /v1/accounts/{a}/storage
Report the size of the account’s control database and counts of pending, blocked or needs-review work.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
Response: StorageUsage
POST /v1/accounts/{a}/sync
Start a sync with WeChat. Poll the returned operation.
Scope: login
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
POST /v1/profiles/official
Find and attach an official WeChat profile on the daemon host as a new account. The token must cover every account.
Scope: admin
Request body: OfficialProfileRequest
Response: OfficialProfileSelection
Types
AccountSettings
Hub policy; this is never written into an official WeChat profile.
| Field | Type | Description |
|---|---|---|
autoDownloadMaxBytes (required) | integer | Largest advertised size in bytes that the daemon downloads automatically for this account, from 0 to 536870912. Thumbnails and voice notes are always downloaded, and 0 limits automatic downloads to those; the default is 52428800. |
BlockedControlCount
Commands of one form that keep sync batches blocked. Labels only: never a peer’s identity or the control’s contents.
| Field | Type | Description |
|---|---|---|
batches (required) | integer | Number of distinct sync batches blocked by this form. |
commands (required) | integer | Number of blocked commands matching this form. |
messageType (required) | integer, nullable | AddMsg type, such as 51 (status) or 10002 (system). |
operationIds (required) | string, nullable | Status operation IDs, as a JSON array. |
peerKind (required) | string, nullable | group, excluded, classified or ordinary. |
reason (required) | string, nullable | Why the command is blocked. |
systemKind (required) | string, nullable | System message kind, such as dynacfg. |
CreateAccountRequest
Request to register a new account.
| Field | Type | Description |
|---|---|---|
alias | string, nullable | A friendly name that can be used in place of the ID. |
id | string, nullable | Account ID. Omit it and the daemon generates one. |
NativeAccountRemoval
Result of removing an account.
| Field | Type | Description |
|---|---|---|
accountId (required) | string | ID of the account that was removed. |
filesRetained (required) | boolean | True when the account’s local files were kept. They are always kept. |
removed (required) | boolean | True when the account was removed. |
NativeAccountRemovalRequest
Request to remove a signed-out account.
| Field | Type | Description |
|---|---|---|
confirmAccountId (required) | string | Must repeat the account ID from the URL, to confirm the removal. |
NativeOperation
A background operation such as signing in or out, refreshing contacts or changing a group. Poll it by ID until it finishes.
| Field | Type | Description |
|---|---|---|
accountId (required) | string | ID of the account the operation belongs to. |
createdAt (required) | string | When the operation was created, as an RFC 3339 time. |
id (required) | string | Operation ID. |
kind (required) | string | What the operation does, such as login, logout, sync, metadata, group_mutation, message_recall or media-writeback. |
result (required) | any | Details of the outcome. Its fields depend on kind, and it is empty until the operation has something to report. |
state (required) | string | Where the operation stands, such as queued, running, succeeded, failed or cancelled. Some kinds report more states, for example needs_review, or awaiting_scan and awaiting_approval during a login. |
updatedAt (required) | string | When the operation last changed, as an RFC 3339 time. |
OfficialProfileRequest
Where to find the stopped official WeChat profile to attach as an account.
| Field | Type | Description |
|---|---|---|
accountId | string, nullable | ID of the account expected to own this profile. The request is refused if the profile is not already attached to that account. |
path | string, nullable | Absolute path on the daemon’s host to a home folder containing xwechat_files, to that folder, or to one account’s folder. When omitted, the daemon searches only its own home folder. |
OfficialProfileSelection
The account an official profile is attached to.
| Field | Type | Description |
|---|---|---|
accountId (required) | string | ID of the account that uses the profile. |
profilePath (required) | string | Path of the attached profile on the daemon’s host. |
savedDeviceLoginAvailable (required) | boolean | True when the profile holds saved login details that can sign in without a QR code. |
storageMode (required) | string | official, meaning the profile is used in place and not copied. |
SkippedControlCount
Commands of one form that were skipped as handled because this build can’t apply them. Labels only: never a peer’s identity or the command’s contents.
| Field | Type | Description |
|---|---|---|
batches (required) | integer | Number of distinct sync batches containing this skipped form. |
classification (required) | string, nullable | What kind of command it was, such as status_notification. |
commandId (required) | integer, nullable | Sync command ID, such as 5 (AddMsg) or 44. |
commands (required) | integer | Number of skipped commands matching this form. |
messageType (required) | integer, nullable | AddMsg type, such as 51 (status) or 10002 (system). |
operationIds (required) | string, nullable | Status operation IDs, as a JSON array. |
peerKind (required) | string, nullable | group, excluded, classified or ordinary. |
reason (required) | string, nullable | Why this build can’t apply it. |
systemKind (required) | string, nullable | System message kind, such as dynacfg. |
StorageCount
Row count and stored bytes of one table or runtime family.
| Field | Type | Description |
|---|---|---|
bytes (required) | integer | Stored payload bytes across those rows. |
name (required) | string | Table name or runtime key family prefix. |
rows (required) | integer | Number of stored rows in this table or family. |
StorageUsage
Size of an account sidecar and the unresolved work that keeps records whole.
| Field | Type | Description |
|---|---|---|
blockedControls (required) | array of BlockedControlCount | Status and system controls (AddMsg types 51 and 10002) recorded by an earlier version as keeping sync batches blocked, by form. Such controls are now skipped (see skipped_controls), so this only lists batches no retry has reached yet. Batches waiting on local work, such as a group refresh, aren’t listed. |
fileBytes (required) | integer | Total allocated size of control.sqlite in bytes. |
freeBytes (required) | integer | Unused freelist bytes inside control.sqlite. |
retiredKeys (required) | integer | Number of retired idempotency key and operation ID digests kept to prevent replay. |
runtimeFamilies (required) | array of StorageCount | The largest runtime key families, by stored bytes. |
skippedControls (required) | array of SkippedControlCount | Commands this build couldn’t apply and skipped as handled, by form. The labels are kept for good, like the commands’ raw bytes, so a later version can find and apply them. |
tables (required) | array of StorageCount | Per-table row and byte counts, largest first. |
unresolved (required) | object | Records retention keeps whole until they finish or expire. |
UpdateAccountRequest
Request to change an account.
| Field | Type | Description |
|---|---|---|
alias | string, nullable | The new alias. |
autoConnect | boolean, nullable | Whether the account connects automatically when the daemon starts. |