Skip to main content

Operations

Spam reporting, trust contact token management, auto-reconnect, history sync configuration, on-demand pause/resume, and app-state resync.

Spam Report

Report a message as spam.

POST /api/v1/sessions/{session_id}/spam/report

Request Body

{
"message_id": "3EB0ABC123...",
"message_timestamp": 1700000000,
"from_jid": "628123456789@s.whatsapp.net",
"spam_flow": "message_menu"
}
FieldTypeRequiredDescription
message_idstringYesMessage ID being reported
message_timestampnumberYesTimestamp of the message
from_jidstringNoJID of the message sender
participant_jidstringNoParticipant JID (group messages)
group_jidstringNoGroup JID (group reports)
group_subjectstringNoGroup name (group reports)
spam_flowstringNoReport flow type (default: message_menu)
media_typestringNoMedia type of the message

Spam Flow Types

FlowDescription
message_menuReport from message context menu
group_spam_banner_reportReport from group spam banner
group_info_reportReport from group info page
contact_infoReport from contact info page
status_reportReport from status viewer

Response

{
"success": true,
"report_id": "report-uuid"
}

Example

curl -X POST http://localhost:3451/api/v1/sessions/my-session/spam/report \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"message_id": "3EB0ABC123...",
"message_timestamp": 1700000000,
"from_jid": "628123456789@s.whatsapp.net",
"spam_flow": "message_menu"
}'

TCToken - Issue Tokens

Issue trust contact tokens for one or more JIDs.

POST /api/v1/sessions/{session_id}/tctoken/issue

Request Body

{
"jids": [
"628123456789@s.whatsapp.net",
"628987654321@s.whatsapp.net"
]
}

Response

{
"tokens": [
{
"jid": "628123456789@s.whatsapp.net",
"timestamp": 1700000000
}
]
}

Example

curl -X POST http://localhost:3451/api/v1/sessions/my-session/tctoken/issue \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"jids": ["628123456789@s.whatsapp.net"]
}'

TCToken - Get Token

Get the trust contact token for a specific JID.

GET /api/v1/sessions/{session_id}/tctoken/{jid}

Response

{
"jid": "628123456789@s.whatsapp.net",
"token_timestamp": 1700000000,
"sender_timestamp": 1700000100,
"found": true
}

If no token exists:

{
"jid": "628123456789@s.whatsapp.net",
"token_timestamp": null,
"sender_timestamp": null,
"found": false
}

Example

curl http://localhost:3451/api/v1/sessions/my-session/tctoken/628123456789@s.whatsapp.net \
-H "Authorization: Bearer YOUR_TOKEN"

TCToken - List All

List all JIDs that have trust contact tokens.

GET /api/v1/sessions/{session_id}/tctoken/list

Response

{
"jids": [
"628123456789@s.whatsapp.net",
"628987654321@s.whatsapp.net"
]
}

Example

curl http://localhost:3451/api/v1/sessions/my-session/tctoken/list \
-H "Authorization: Bearer YOUR_TOKEN"

TCToken - Prune Expired

Remove all expired trust contact tokens.

DELETE /api/v1/sessions/{session_id}/tctoken/expired

Response

{
"pruned_count": 5
}

Example

curl -X DELETE http://localhost:3451/api/v1/sessions/my-session/tctoken/expired \
-H "Authorization: Bearer YOUR_TOKEN"

Auto-Reconnect - Get Status

Get the current auto-reconnect configuration.

GET /api/v1/sessions/{session_id}/reconnect

:::note Works while the socket is down (v0.12.0+) This endpoint (and its PUT sibling, and the two history-sync endpoints) is served from stored config, so it answers even when the session's socket is down — disabling auto-reconnect on a dead session is exactly the case that needs it. An unknown session ID returns 404; config access no longer returns 503. :::

Response

{
"enabled": true,
"error_count": 0
}

Example

curl http://localhost:3451/api/v1/sessions/my-session/reconnect \
-H "Authorization: Bearer YOUR_TOKEN"

Auto-Reconnect - Set

Enable or disable automatic reconnection on disconnect.

PUT /api/v1/sessions/{session_id}/reconnect

Request Body

{
"enabled": true
}

Response

{
"enabled": true,
"error_count": 0
}

Example

curl -X PUT http://localhost:3451/api/v1/sessions/my-session/reconnect \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"enabled": true}'

History Sync - Get

Get the current history sync configuration.

GET /api/v1/sessions/{session_id}/history-sync

Response

{
"skip_history_sync": false
}

Example

curl http://localhost:3451/api/v1/sessions/my-session/history-sync \
-H "Authorization: Bearer YOUR_TOKEN"

History Sync - Set

Control whether message history is synced when connecting a new device.

PUT /api/v1/sessions/{session_id}/history-sync

Request Body

{
"skip": true
}
FieldTypeRequiredDescription
skipbooleanYesSet to true to skip history sync

Response

{
"skip_history_sync": true
}

Example

curl -X PUT http://localhost:3451/api/v1/sessions/my-session/history-sync \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"skip": true}'

Pause Session

Take a session offline on demand, without deleting or fully disconnecting it. The session stays paused (deliberately offline) until resumed — the session status reports paused: true while paused.

POST /api/v1/sessions/{session_id}/pause

Response

{
"paused": true
}

Resume Session

Bring a paused session back online.

POST /api/v1/sessions/{session_id}/resume

Response

{
"paused": false
}

App-State Resync

Force a re-fetch of one or more app-state collections (block lists, chat mute/pin state, etc.) from the WhatsApp server.

POST /api/v1/sessions/{session_id}/appstate/resync

Request Body

{
"collections": ["critical_block", "regular_low"],
"mode": "incremental"
}
FieldTypeRequiredDescription
collectionsarrayYesCollections to re-fetch: critical_block, critical_unblock_low, regular_low, regular_high, regular. Must not be empty — an unknown name returns 400
modestringNoincremental (default) asks for patches after the stored version; snapshot discards the stored state and rebuilds the collection from the server's snapshot

Response

{
"synced": ["critical_block"],
"fatal": [],
"retryable": ["regular_low"],
"skipped": [],
"all_synced": false
}
FieldDescription
syncedFetched, applied and persisted
fatalRefused by the server outright (400/404); retrying will not clear these
retryableNot synced, but a later attempt can succeed
skippedLeft to another sync already fetching the collection
all_syncedtrue when every requested collection came back synced

Returns 400 for an invalid body and 503 when the session has no live client.

Example

curl -X POST http://localhost:3451/api/v1/sessions/my-session/appstate/resync \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"collections": ["critical_block", "critical_unblock_low"]
}'