Get Contact Info

Get basic information about a specific contact.

GET
https://api.wawp.net/v2/contacts?access_token=123456789&contactId=123456789%40c.us&instance_id=123456789

Authentication Required

Login to swap the placeholders with your real Instance ID and Access Token.

Log In
Test /v2/contacts endpoint
GET
GET

No query parameters required

This endpoint doesn't expect data in the URL.

Who is this? Get Contact Details

The /v2/contacts/[chatId] endpoint retrieves the public metadata for any valid WhatsApp user. This is your primary tool for "enriching" user profiles in your application.


🧩 Understanding the Data Fields

When you fetch a contact, you receive several fields that might seem redundant but serve very different purposes.

1. id._serialized (The Key)

  • Value: 15551234567@c.us
  • Usage: This is the immutable primary key. Always store this in your database. Do not try to parse the phone number manually; treat the whole string as the ID.

2. pushname (The Public Name)

  • Value: "Alice"
  • Source: This is the name the user set for themselves in WhatsApp Settings.
  • Reliability: High. It is what the user wants to be called.
  • Verification: This name is NOT verified. A user can set their pushname to "Bank of America Support" to scam people. Never use this for identity verification.

3. name (The Local Name)

  • Value: "Alice from Gym"
  • Source: This is the name you saved in your phone's address book for this number.
  • Availability: If you haven't saved the number, this field will be undefined or null.
  • Priority: In a UI, you should usually display name (if available) aliased over pushname (fallback), because name is your private note.

4. number (The Clean Phone)

  • Value: 15551234567
  • Usage: The raw MSISDN without the @c.us suffix. Useful if you need to pass the number to an SMS gateway.

🏢 Business & Enterprise Flags

The API returns two boolean flags that help you categorize users:

isBusiness

  • True: The user is using the "WhatsApp Business App" (SMB).
  • Implication: They might have automated greeting messages or "Away" messages. They likely have a catalog.

isEnterprise

  • True: The user is using the "WhatsApp Business API" (Cloud API/BSP).
  • Implication: This is likely a bot or a large company.
    • Warning: Bots talking to bots can create infinite loops. If you detect isEnterprise: true, tips: [ { type: 'info', title: 'Details', content: 'Fetches stored contact details like Name and Notify Name.' }, { type: 'info', title: 'Notify Name', content: 'This is the name the user set for themselves in WhatsApp.' } ], recommendations: [ "Use the 'Notify Name' if the contact is not saved in your address book.", "Update your local record if the contact's details change." ]

you might want to disable your own auto-responders for that chat to prevent a loop.


🔍 Privacy & "Ghost" Data

If you query a valid number but get limited data:

  • Scenario: You fetch 12345@c.us and get an ID, but pushname is undefined.
  • Cause: The user has strict privacy settings.
  • Action: Nothing. The API cannot force the data to appear. You should render a default placeholder (e.g., "WhatsApp User").

⚙️ Usage Patterns

Pattern A: The "Welcome" Personalization

  1. User sends "Hi".
  2. Bot calls GET /v2/contacts/[id].
  3. Bot retrieves pushname: "Sarah".
  4. Bot replies: "Hello Sarah! How can I help?"
    • Effect: High perceived personalization.

Pattern B: The Block Check

  1. You suspect a user blocked you.
  2. You call this endpoint.
  3. If you can see their pushname but cannot see their profilePic or about status (via other endpoints), and messages are single-ticking, it is a strong indicator of being blocked. (Note: The API does not have an explicit isBlockedByMe flag for privacy reasons).

⚠️ Notes on Caching

User profiles change rarely.

  • Do Not: Call this endpoint every time you render a chat message.
  • Do: Cache the result for 24-48 hours.
  • Refresh: Only aggressive fetch if the user interacts with you after a long period of silence.

Request Parameters

Configure the parameters required to interact with this endpoint. All query and body arguments are listed below with their details.

URL Parameters

Passed in the URL query string
string

Your unique WhatsApp Instance ID

Example:
string

Your API Access Token

Example:
string

The unique ID of the contact (e.g., 123456789@c.us)

Example:

Request Samples

Use these ready-to-go code snippets to integrate our API into your project quickly and efficiently. Choose your preferred language and library.

1const baseUrl = "https://api.wawp.net";
2const endpoint = "/v2/contacts";
3const params = new URLSearchParams({
4 "instance_id": "123456789",
5 "access_token": "123456789",
6 "contactId": "123456789@c.us"
7}).toString();
8
9
10fetch(`${baseUrl}${endpoint}${params ? '?' + params : ''}`, {
11 method: "GET",
12 headers: { "Content-Type": "application/json" },
13
14})
15 .then(async (response) => {
16 if (response.ok) {
17 const data = await response.json();
18 console.log("Success:", data);
19 return data;
20 }
21
22 // Error Handling
23 if (response.status === 401) {
24 console.error("Error 401: Unauthorized - Invalid or Missing Access Token");
25 }
26 if (response.status === 400) {
27 console.error("Error 400: Bad Request - Invalid Parameter Format");
28 }
29 if (response.status === 500) {
30 console.error("Error 500: Internal Server Error - Unexpected Failure");
31 }
32
33 const errorText = await response.text();
34 console.error(`Error ${response.status}: ${errorText}`);
35 })
36 .catch((error) => console.error("Network Error:", error));
Interactive Samples
Ln 36, Col 1javascript

Expected Responses

Explore all possible responses and outcomes from the server. We have documented each status code with data examples to make success and error handling easier.

Contact info retrieved successfully
application/json
string *
string *
string *
boolean *
boolean *

Example

{
"id": "123456789@c.us",
"name": "John Doe",
"pushname": "John",
"isBusiness": false,
"isEnterprise": false
}
Bad Request - Invalid Parameter Format
Unauthorized - Invalid or Missing Access Token
Internal Server Error - Unexpected Failure
Previous TopicGet All Contacts
Next TopicCheck Phone on WhatsApp

Command Palette

Search for a command to run...