Skip to content
WhatSync/DocsAPI v1

List WhatsApp contacts

Find people in the user's own WhatsApp by name or number: people they have chatted with, plus contact names their linked WhatsApp shares.

POST/api/v1/tools/list_contactsRead
Key permissions
Read chats and messages
Authentication
Authorization: Bearer $WHATSYNC_API_KEY
How keys work

How it works

  • Only chats the user allowed WhatSync to save are included; numbers they excluded never appear.
  • Names match word by word in any order.
  • after/before limit chat history only: at most 366 days (a longer window is shortened and the result says so), before later than after; without after, a query covers all saved history and no query the last 180 days.
  • total_count gives how many people match.
  • Use next_offset to page.

Body parameters

querystringoptional

See the example and input schema for this value.

afterstring · date-timeoptional

Lower date boundary or pagination value. Keep the same filters between pages.

beforestring · date-timeoptional

Upper date boundary or pagination value. Follow the pagination instructions below.

limitintegeroptional

Maximum results per page. See the schema for bounds and defaults.

offsetintegeroptional

Use next_offset from the previous page; start at zero or omit.

Conditions and pagination

  • Pass next_offset as offset with the same filters until it is null. Counts can be null after the last page; missing data is not zero.

Response

HTTP 200 returns this tool's JSON directly, without an MCP content wrapper. Optional provider fields may be absent or null; check pagination and coverage before treating a page as complete.

Every response includes X-Request-Id. Errors use the shared error format and retry rules.

Schemas

Input JSON Schema
Input JSON Schema
{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "maxLength": 120
    },
    "after": {
      "type": "string",
      "format": "date-time"
    },
    "before": {
      "type": "string",
      "format": "date-time"
    },
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 50
    },
    "offset": {
      "type": "integer",
      "minimum": 0,
      "maximum": 10000
    }
  },
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
Response JSON Schema
Response JSON Schema
{
  "type": "object",
  "properties": {
    "total_count": {
      "type": [
        "number",
        "null"
      ]
    },
    "saved_contact_count": {
      "type": [
        "number",
        "null"
      ]
    },
    "with_chat_history_count": {
      "type": [
        "number",
        "null"
      ]
    },
    "contacts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "conversation_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "has_chat_history": {
            "type": "boolean"
          },
          "last_message_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "message_count": {
            "type": "number"
          }
        },
        "required": [],
        "additionalProperties": true
      }
    },
    "next_offset": {
      "type": [
        "number",
        "null"
      ]
    },
    "listed_after": {
      "type": "string"
    },
    "listed_before": {
      "type": "string"
    }
  },
  "required": [],
  "additionalProperties": true
}