跳转到内容

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

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.

Request body: NativeAccountRemovalRequest

Response: NativeAccountRemoval

GET /v1/accounts/{a}

Show one account and its connection status.

Scope: read

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.

PATCH /v1/accounts/{a}

Change an account alias or whether it connects automatically when the daemon starts.

Scope: admin

ParameterInTypeDescription
a (required)pathstringAccount 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

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.

DELETE /v1/accounts/{a}/operations/{id}

Ask a background operation to stop.

Scope: any valid token

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
id (required)pathstringOperation ID.

Response: NativeOperation

GET /v1/accounts/{a}/operations/{id}

Show the state and result of a background operation.

Scope: any valid token

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
id (required)pathstringOperation 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

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.

GET /v1/accounts/{a}/schema

Describe the layout of the account’s saved WeChat profile.

Scope: read

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.

GET /v1/accounts/{a}/settings

Show the account settings.

Scope: read

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.

Response: AccountSettings

PATCH /v1/accounts/{a}/settings

Replace the account settings, such as the largest file to download automatically.

Scope: media

ParameterInTypeDescription
a (required)pathstringAccount 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

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.

Response: StorageUsage

POST /v1/accounts/{a}/sync

Start a sync with WeChat. Poll the returned operation.

Scope: login

ParameterInTypeDescription
a (required)pathstringAccount 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.

FieldTypeDescription
autoDownloadMaxBytes (required)integerLargest 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.

FieldTypeDescription
batches (required)integerNumber of distinct sync batches blocked by this form.
commands (required)integerNumber of blocked commands matching this form.
messageType (required)integer, nullableAddMsg type, such as 51 (status) or 10002 (system).
operationIds (required)string, nullableStatus operation IDs, as a JSON array.
peerKind (required)string, nullablegroup, excluded, classified or ordinary.
reason (required)string, nullableWhy the command is blocked.
systemKind (required)string, nullableSystem message kind, such as dynacfg.

CreateAccountRequest

Request to register a new account.

FieldTypeDescription
aliasstring, nullableA friendly name that can be used in place of the ID.
idstring, nullableAccount ID. Omit it and the daemon generates one.

NativeAccountRemoval

Result of removing an account.

FieldTypeDescription
accountId (required)stringID of the account that was removed.
filesRetained (required)booleanTrue when the account’s local files were kept. They are always kept.
removed (required)booleanTrue when the account was removed.

NativeAccountRemovalRequest

Request to remove a signed-out account.

FieldTypeDescription
confirmAccountId (required)stringMust 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.

FieldTypeDescription
accountId (required)stringID of the account the operation belongs to.
createdAt (required)stringWhen the operation was created, as an RFC 3339 time.
id (required)stringOperation ID.
kind (required)stringWhat the operation does, such as login, logout, sync, metadata, group_mutation, message_recall or media-writeback.
result (required)anyDetails of the outcome. Its fields depend on kind, and it is empty until the operation has something to report.
state (required)stringWhere 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)stringWhen the operation last changed, as an RFC 3339 time.

OfficialProfileRequest

Where to find the stopped official WeChat profile to attach as an account.

FieldTypeDescription
accountIdstring, nullableID of the account expected to own this profile. The request is refused if the profile is not already attached to that account.
pathstring, nullableAbsolute 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.

FieldTypeDescription
accountId (required)stringID of the account that uses the profile.
profilePath (required)stringPath of the attached profile on the daemon’s host.
savedDeviceLoginAvailable (required)booleanTrue when the profile holds saved login details that can sign in without a QR code.
storageMode (required)stringofficial, 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.

FieldTypeDescription
batches (required)integerNumber of distinct sync batches containing this skipped form.
classification (required)string, nullableWhat kind of command it was, such as status_notification.
commandId (required)integer, nullableSync command ID, such as 5 (AddMsg) or 44.
commands (required)integerNumber of skipped commands matching this form.
messageType (required)integer, nullableAddMsg type, such as 51 (status) or 10002 (system).
operationIds (required)string, nullableStatus operation IDs, as a JSON array.
peerKind (required)string, nullablegroup, excluded, classified or ordinary.
reason (required)string, nullableWhy this build can’t apply it.
systemKind (required)string, nullableSystem message kind, such as dynacfg.

StorageCount

Row count and stored bytes of one table or runtime family.

FieldTypeDescription
bytes (required)integerStored payload bytes across those rows.
name (required)stringTable name or runtime key family prefix.
rows (required)integerNumber of stored rows in this table or family.

StorageUsage

Size of an account sidecar and the unresolved work that keeps records whole.

FieldTypeDescription
blockedControls (required)array of BlockedControlCountStatus 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)integerTotal allocated size of control.sqlite in bytes.
freeBytes (required)integerUnused freelist bytes inside control.sqlite.
retiredKeys (required)integerNumber of retired idempotency key and operation ID digests kept to prevent replay.
runtimeFamilies (required)array of StorageCountThe largest runtime key families, by stored bytes.
skippedControls (required)array of SkippedControlCountCommands 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 StorageCountPer-table row and byte counts, largest first.
unresolved (required)objectRecords retention keeps whole until they finish or expire.

UpdateAccountRequest

Request to change an account.

FieldTypeDescription
aliasstring, nullableThe new alias.
autoConnectboolean, nullableWhether the account connects automatically when the daemon starts.