WhatsApp API Python Client

Extract WhatsApp data with our WhatsApp API Python client. Get programmatic access to email addresses, website URLs, profile pictures, phone numbers, profile names, business descriptions, and more using simple Python code. Start free, no credit card required.

Trusted by industry leaders all over the world

Integrate our WhatsApp API

The Apify API client for Python is the official library that allows you to use WhatsApp API in Python, providing convenience functions and automatic retries on errors. Get started with simple pip installation and robust error handling built-in.

Python

Python

JavaScript

JavaScript

HTTP

HTTP

MCP

MCP

1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4# Replace '<YOUR_API_TOKEN>' with your token.
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7# Prepare the Actor input
8run_input = {
9 "numbers": [
10 "8976859807",
11 "8655907795",
12 "8860033772",
13 ],
14 "proxy": {
15 "useApifyProxy": True,
16 "apifyProxyGroups": ["RESIDENTIAL"],
17 "apifyProxyCountry": "US",
18 },
19}
20
21# Run the Actor and wait for it to finish
22run = client.actor("curious_coder/whatsapp-scraper").call(run_input=run_input)
23
24# Fetch and print Actor results from the run's dataset (if there are any)
25print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
26for item in client.dataset(run["defaultDatasetId"]).iterate_items():
27 print(item)
28
29# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

Get data with WhatsApp API Python client

Use our Python API client to extract WhatsApp profile data by providing phone numbers in bulk through the input interface. The API returns structured data, including contact names, business profiles, email addresses, website URLs, profile pictures, descriptions, business hours, and location details.

Input

{
"proxy": {
"useApifyProxy": true,
"apifyProxyGroups": [
"RESIDENTIAL"
],
"apifyProxyCountry": "US"
},
"numbers": [
"8976859807",
"8655907795",
"8860033772"
],
"sessionStoreId": "whatsapp-session-1"
}

Output

[
{
"_fromStrapi": true,
"id": {
"user": "918976859807",
"server": "c.us",
"_serialized": "918976859807@c.us"
},
"isMe": false,
"type": "in",
"about": "India’s Highest Rated Food Delivery App: 4.7",
"isUser": true,
"number": "918976859807",
"isGroup": false,
"isBlocked": false,
"isBusiness": true,
"givenNumber": "8976859807",
"isMyContact": false,
"isWAContact": true,
"profilePicUrl": "<https://pps.whatsapp.net/v/t61.24694-24/328134927_579346797408337_6534925906918654566_n.jpg?ccb=11-4&oh=01_AdTENlu80Nd9A9D7bR3Llynpj2Bp0F5mr3yZJ9r_uO1lhA&oe=6511557C&_nc_sid=000000&_nc_cat=108>",
"businessProfile": {
"_fromStrapi": true,
"id": {
"user": "918976859807",
"server": "c.us",
"_serialized": "918976859807@c.us"
},
"tag": "102921066",
"email": "hello@eatclub.in",
"fbPage": {},
"address": "No 548, 22nd Cross, 14th Main Road, HSR Layout Sector 3, Bangalore, Karnataka - 560102",
"website": [
"<https://eatclub.page.link/qrid>"
],
"categories": [
{
"_fromStrapi": true,
"id": "273819889375819",
"localized_display_name": "Restaurant"
}
],
"coverPhoto": null,
"description": "India’s Highest Rated Food Delivery App: 4.7. \\nFlat 30% OFF on every order. NO T&C. ZERO Delivery/Packaging Fees. Benefits on all Handpicked Partner Brands like BOX8, MOJO Pizza, Itminaan Biryani & more.",
"businessHours": null,
"igProfessional": {},
"profileOptions": {
"cartEnabled": true,
"directConnection": false,
"commerceExperience": "none"
},
"isProfileLinked": false,
"directConnection": {
"enabled": false
}
}
}
]

How to use WhatsApp API

Sign up for Apify account01

Creating an account is quick and free — no credit card required. Your account gives you access to more than 5,000 scrapers and APIs.

Get started for free
Install Apify Python client02

Install the Apify Python client using pip: pip install apify-client. This package provides a simple interface to interact with WhatsApp API from your Python applications.

Get your Apify API token03

Go to settings in the Apify console and navigate to the “API & Integrations” tab. There, create a new token and save it for later.

Integrate WhatsApp API04

Navigate to the WhatsApp API page and click on the API dropdown menu in the top right corner. In the dropdown menu, you can see API clients, API endpoints, and more. Use the provided Python code examples to integrate WhatsApp API into your Python application.

Open WhatsApp Python API
Get your WhatsApp data via API05

The WhatsApp API returns structured JSON data that works perfectly with pandas, NumPy, and other Python data analysis libraries.

Why use Apify?

Never get blocked

Every plan (free included) comes with Apify Proxy, which is great for avoiding blocking and giving you access to geo-specific content.

Customers love us

We truly care about the satisfaction of our users and thanks to that we're one of the best-rated data extraction platforms on both G2 and Capterra.

Monitor your runs

With our latest monitoring features, you always have immediate access to valuable insights on the status of your web scraping tasks.

Export to various formats

Your datasets can be exported to any format that suits your data workflow, including Excel, CSV, JSON, XML, HTML table, JSONL, and RSS.

Integrate Apify to your workflow

You can integrate your Apify runs with platforms such as Zapier, Make, Keboola, Google Drive, or GitHub. Connect with practically any cloud service or web app.

Large developer community

Apify is built by developers, so you'll be in good hands if you have any technical questions. Our Discord server is always here to help!

Frequently asked questions

WhatsApp does not provide an official Python API client for accessing profile data. This implementation uses web scraping techniques to extract publicly available information from WhatsApp profiles by connecting through QR code authentication, similar to WhatsApp Web.

Yes, you can try the WhatsApp Python API client for free using Apify's free tier credits. The API client connects to an actor priced at $25.00/month plus usage costs, but new users receive free credits to test the Python integration before committing to a paid plan.

From WhatsApp profiles using Python API client, you can extract contact names, profile pictures, about/bio status, business descriptions, email addresses, website URLs, physical addresses, business categories, business hours, and determine whether it's a business or personal account.

Getting started with our WhatsApp Python API is easy — simply create a free Apify account, get your API token, and start using the WhatsApp API in Python, JavaScript, CLI, cURL, OpenAPI, or MCP.

Get started with WhatsApp API Python client today

Get your first WhatsApp data in Python in less than 5 minutes. No credit card required. No commitment. Cancel anytime.