WhatsApp identifies every participant — users, groups, broadcast lists, and status feeds — with a JID (Jabber ID). JIDs originated in the XMPP protocol and follow the formatDocumentation Index
Fetch the complete documentation index at: https://whiskeysockets-docs-jids-socket-config-ptbr.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
local@server. You will encounter them constantly in Baileys: as the target of sock.sendMessage, in the key.remoteJid of every incoming message, and as parameters to group and contact queries.
Modern WhatsApp identifies the same person in two different ways depending on context. Both are JIDs:
- PNJID — Phone Number Jabber Identifier. Lives on
@s.whatsapp.netand is derived from the user’s phone number. This is the legacy identifier and the one you use when looking someone up by their number. - LIDJID — Linked Identity Jabber Identifier. Lives on
@lidand is an opaque per-user identifier WhatsApp assigns to anonymize phone numbers in groups, communities, and other shared surfaces. This is the identifier WhatsApp uses by default in Baileys 7.x and later.
JID formats
User (PNJID)
[countrycode][number]@s.whatsapp.netExample: 19999999999@s.whatsapp.netUser (LIDJID)
[lid]@lidExample: 123456789012345@lidGroup
[timestamp]-[random]@g.usExample: 123456789-123345@g.usBroadcast list
[timestamp]@broadcastExample: 1234567890@broadcastStories / Status
status@broadcastFixed constant — all status updates go to this JID.Newsletter
[id]@newsletterExample: 12345@newsletter| Server | Meaning |
|---|---|
@hosted | Hosted PN — phone-number user routed through Meta hosting |
@hosted.lid | Hosted LID — LID-form user routed through Meta hosting |
@bot | Meta AI / first-party bot account |
@c.us | Legacy WhatsApp server domain (still used for 0@c.us, the official business JID, and PSA messages) |
@call | Voice/video call signaling |
Phone number rules
When constructing a PNJID from a phone number:- Include the country code (e.g.,
1for the US,44for the UK). - Do not include
+,-, spaces, or parentheses. 19999999999@s.whatsapp.netis correct;+1 (999) 999-9999@s.whatsapp.netis not.
PN ↔ LID: the dual-identity model
Since 2024, WhatsApp has been migrating from phone-number identifiers to LIDs (Linked Identity JIDs). A LID is an opaque, per-user identifier that hides the underlying phone number — it lets WhatsApp expose your account inside large groups, communities, and channels without leaking your number to other participants. In Baileys 7.x and later:- New Signal sessions are created in LID form by default.
- A single user has both a PNJID (
...@s.whatsapp.net) and a LIDJID (...@lid). They refer to the same person. - Group participant fields are typically LIDs;
participantAltcarries the matching PN, and vice versa. MessageKey.remoteJidAltandMessageKey.participantAltgive you the alternate identifier for direct messages and group/broadcast/channel messages respectively.- The
Contacttype now exposes a singleidplus pairedphoneNumber(whenidis a LID) andlid(whenidis a PN).
Don’t try to “restore” PN JIDs in your application. Migrate your storage, indexing, and routing logic to LIDs — WhatsApp treats LIDs as the canonical identifier going forward.
PNJID ↔ LIDJID resolution
WhatsApp lets you resolve a phone number to its LID. The reverse — going from a LID back to a phone number — is not generally supported. UseonWhatsApp for one-off PN existence checks, and the lidMapping store on sock.signalRepository for direct conversions:
lid-mapping.update event fires whenever Baileys learns a new PN ↔ LID pair from the wire. For more advanced directory queries (device lists, bulk metadata), see USync protocol.
Phone number sharing between accounts
Because LIDs hide phone numbers by default, WhatsApp provides explicit opt-in flags to exchange them when both sides agree:- Businesses can request the recipient’s number with
{ requestPhoneNumber: true }on a sent message. - Users can share their number with
{ sharePhoneNumber: true }.
Multi-device JIDs
In the WhatsApp multi-device protocol, a single account can have multiple connected devices. Each device gets a device suffix appended to the user portion:19999999999:2@s.whatsapp.net or 123456789012345:3@lid. The part before the : is the user, and the number after is the device ID.
This is why you must never compare or split JIDs with string operations — a message from device :0 and a message from device :2 belong to the same user.
JID helper functions
Baileys exports a set of helper functions from@whiskeysockets/baileys. Always use these instead of manual string manipulation.
Parsing and encoding
domainType field on the decoded result corresponds to the WAJIDDomains enum:
| Value | Constant | Server domain |
|---|---|---|
0 | WHATSAPP | s.whatsapp.net |
1 | LID | lid |
128 | HOSTED | hosted |
129 | HOSTED_LID | hosted.lid |
Type checks
isJidUser from earlier Baileys versions has been removed. Use isPnUser or isLidUser depending on which form you mean. Both PNs and LIDs are JIDs, so the old name was misleading.