API documentation

Chat API for developers

Detailed documentation of WhatsApp API
2 Swagger formats - Test online

Native    Chat-api

Native format example


API Request Authorization

In all requests you must add in header your "client-id" and "token".

Example (Python) to return last 100 messages:

            import requests

url = "https://api.apichat.io/v1/messages"
headers = {
    "client-id": MY_CLIENT_ID,
    "token": MY_TOKEN
}

req = requests.get(url, headers=headers)
          

Connect to Whatsapp

Get account status and QR code for authorization.
Reauthorization is only required in case of switching to another device or when you log out manually.

GET /status

            curl -X GET "https://api.apichat.io/v1/status"
-H "client-id: MY_CLIENT_ID"
-H "token: MY_TOKEN"
          

If you are already logged in, you will get a response like:

{"is_connected": true}

And if you are not logged in, then:

{"qr": "data:image/png;base64,iVBORw0KGgoAAAA..."}

You can insert the response directly into HTML tag to display QR code:

<img src="data:image/png;base64,iVBORw0KGgoAAAA..."/>

Send Image

Send a image to a new or existing chat.

POST /sendImage

            curl -X 'POST' \
'https://api.apichat.io/v1/sendImage' \
-H 'accept: application/json' \
-H 'client-id: MY_CLIENT_ID' \
-H 'token: MY_TOKEN' \
-d '{
    "number": "12345678901",
    "url": "https://my_website/my_image.png",
    "caption": "Hello!"
}'
          

You will be returned a message's Id:

{"id": "3EB0107C8BF7"}