Loading...
API & Developers 2 min read Also available in: PT ES

Generating an API token and sending your first message via the API

Create a Bearer token for your WhatsApp instance and send your first message through the Zapini REST API with a curl example.

Updated on

Zapini API overview

Zapini offers a REST API to integrate WhatsApp with your systems. With it you can send messages, media and audio, manage contacts and conversations, and control automation. Authentication uses a Bearer token, and each token is tied to a single WhatsApp instance.

Step 1 — Generate an API token

Go to the /tokens page in the panel, pick the instance you want, and generate a new token. The full token is shown only once at creation time, so copy and store it somewhere safe.

💡 Tip: treat the token like a password. Never expose it in frontend code, public repositories or URLs.
📷 Image: /tokens page with the generate new token button

Step 2 — Authenticate your requests

Include the token in the Authorization header on every call:

Authorization: Bearer {token}
Content-Type: application/json

Step 3 — Send your first message

Use the send-message endpoint, providing the recipient in international format and the text:

curl -X POST https://zapini.app/api/v1/messages/send \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "recipient": "+5511999999999",
    "message": "Hello! This is my first message through the Zapini API."
  }'

A successful response returns the message identifier so you can track its status:

{
  "success": true,
  "data": {
    "message_id": "550e8400-e29b-41d4-a716-446655440000",
    "status": "pending"
  }
}

Sending media

To send an image or document, use the media endpoint with the public URL of the file:

curl -X POST https://zapini.app/api/v1/messages/send-media \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "recipient": "+5511999999999",
    "media_url": "https://example.com/file.jpg",
    "media_type": "image",
    "caption": "Check out our latest update"
  }'

Usage limits

The API enforces rate limits to protect the platform. If you receive too-many-requests responses, space out your calls and implement a retry with progressive backoff. The full endpoint reference is on the public API documentation page.

Frequently asked questions

Yes. Each token is tied to one WhatsApp instance. To operate several instances, generate one token per instance.
No. The full token is shown only once. If you lost it, revoke the old token and generate a new one at /tokens.
Use the international format with the country code, for example +5511999999999.
On the public API documentation page, which lists the endpoints for messages, media, audio, contacts, conversations and automation.

Thanks for your feedback!

Related articles