Skip to content

Contacts

Online and last seen

Asks WhatsApp for a contact’s presence: online now, or the time they were last seen. WhatsApp answers only when the contact shares their last seen and online status with your number; otherwise known is false. Numbers linked by QR code only (the Cloud API has no presence).

GET/api/v1/contacts/presence
  • Bearer API key
  • Scope: read, write or admin
  • or app session
  • Workspace: X-Tenant-ID (optional with a key)

Headers

  • Authorizationstringrequired

    Your API key as Bearer <key>. The word Bearer and the space are case-sensitive. Browser clients signed in to the app use the session cookie instead.

    Constraints
    Keys start with pk_live_ and are 47 characters long (56 for keys created before 10 October 2026).
    Example
    Bearer pk_live_…
  • X-Tenant-IDuuidoptional

    Workspace id. Optional with an API key (a key always acts in its own workspace); if you send it, it must match the key’s workspace. Required with a session cookie. You can pass ?tenant=<id> instead.

    Example
    8d0f6c2e-3b1a-4c55-9a7e-2f4b6d1e9c30

Query parameters

  • contactstringrequired

    The contact’s phone number with country code (919812345678, +91 98123 45678) or WhatsApp id (…@s.whatsapp.net). phone is accepted as another name for it.

    Example
    919812345678

Response

200 OKapplication/json

  • jidstring

    The contact’s WhatsApp id.

  • knownboolean

    false when WhatsApp did not tell: the contact hides last seen and online from your number, or did not answer in time. online and last_seen then mean nothing.

  • onlineboolean

    true when the contact is online now.

  • last_seentimestampnullable

    When the contact was last online (RFC 3339), or null.

  • checked_attimestamp

    When WhatsApp answered. Answers are reused for up to 1 minute.

Status codes

  • 200OK. The contact’s presence.
  • 400Bad request. contact is missing or is not a phone number with country code or a WhatsApp user id.
  • 401Unauthorized. The API key is unknown, revoked or expired (invalid or expired API key), the key was blocked because it may have been leaked (code: "api_key_blocked"), or there is no key and no signed-in session (unauthorized).
  • 402Payment required. Only when subscriptions are enforced and the workspace has no active subscription. The body includes code: "payment_required".
  • 403Forbidden. The X-Tenant-ID header or tenant query does not match the API key’s workspace (API key belongs to a different workspace), a signed-in user is not a member of the workspace (forbidden), or the key is limited to other IP addresses (this API key is not allowed from your IP address, with code: "ip_not_allowed").
  • 409Conflict. No number is linked by QR code, or it is disconnected right now.
  • 429Too many requests. More than 30 lookups in a minute for this workspace. Wait for the Retry-After seconds and try again.
  • 504Gateway timeout. WhatsApp did not answer in time.

How does a lookup work?

Your number goes online for a few seconds, asks WhatsApp for the contact’s presence, waits up to 4 seconds for the answer and goes back offline, so your phone keeps getting notifications. While it is online, contacts may see your number as online. Lookups run one at a time per number, and an answer is reused for 1 minute.

Why is known false?

WhatsApp shares presence only with numbers the contact allows in Settings → Privacy → Last seen and online. If they chose "Nobody", or "My contacts" and your number is not saved in their phone, WhatsApp sends nothing.