Wahero REST API

The Wahero API lets you send WhatsApp messages, manage contacts, handle groups, and receive real-time events — all through a simple REST interface with JSON payloads.

REST API

Standard HTTP verbs, JSON request & response

API Key Auth

Simple header-based authentication

Webhooks

Real-time push events to your endpoint

Base URLhttps://api.wahero.id

Authentication

All API requests must include your API key in the X-Api-Key header. Generate and manage your keys from the dashboard.

http
X-Api-Key: YOUR_API_KEY
Content-Type: application/json

Never expose your API key in client-side code or public repositories. Store it as an environment variable and rotate immediately if compromised.

API Scopes

ParameterTypeRequiredDescription
messages.sendscopeSend text, bulk, media, reply, reaction, poll, location, contact card, link preview
messages.readscopeRead message status, list chats, chat messages, profile pictures
contacts.readscopeList contacts and validate numbers
instances.readscopeView instance list and connection status
agent.chatscopeChat with AI agent, read knowledge base (Q&A, products, URLs, files)
agent.managescopeManage knowledge base, teach agent from conversations

Quick Start

Send your first message in under 2 minutes. Get your API key, find your instance ID in the dashboard, and run the example below.

curl
curl -X POST https://api.wahero.id/api/v1/messages/send \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "phone": "628123456789",
    "message": "Hello from Wahero!"
  }'
Response200
{
  "success": true,
  "data": {
    "messageId": "BADID_abc123xyz",
    "status": "sent",
    "timestamp": "2026-03-20T10:30:00.000Z"
  }
}

Rate Limits

Limits are enforced per API key. Exceeding the limit returns 429 Too Many Requests.

PlanRequests / 15 min
Free100
Pro1,000
EnterpriseCustom
http
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 87
X-RateLimit-Reset: 1742468400

API Reference

Messages

Send single, bulk, or media messages to any WhatsApp number via your connected instances.

Send Message

Send a text message to a single WhatsApp number.

POST/api/v1/messages/send

Body

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance to send from
phonestringRequiredRecipient in international format (e.g. 628123456789)
messagestringRequiredText content
curl
curl -X POST https://api.wahero.id/api/v1/messages/send \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "phone": "628123456789",
    "message": "Hello from Wahero!"
  }'
Response200
{
  "success": true,
  "data": {
    "messageId": "BADID_abc123xyz",
    "status": "sent",
    "timestamp": "2026-03-20T10:30:00.000Z"
  }
}

Send Bulk Messages

Send up to 100 personalised messages in one request.

POST/api/v1/messages/bulk

Body

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
messagesarrayRequiredArray of message objects (max 100)
messages[].phonestringRequiredRecipient number
messages[].messagestringRequiredMessage text for this recipient
curl
curl -X POST https://api.wahero.id/api/v1/messages/bulk \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "messages": [
      { "phone": "628111000001", "message": "Hi Alice!" },
      { "phone": "628111000002", "message": "Hi Bob!" }
    ]
  }'
Response200
{
  "success": true,
  "data": {
    "sent": 2,
    "failed": 0,
    "results": [
      { "phone": "628111000001", "messageId": "BADID_xxx", "status": "sent" },
      { "phone": "628111000002", "messageId": "BADID_yyy", "status": "sent" }
    ]
  }
}

Send Media

Send an image, video, audio, or document via a publicly accessible HTTPS URL.

POST/api/v1/messages/media

Body

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
phonestringRequiredRecipient number
mediaUrlstringRequiredPublicly accessible HTTPS URL of the file
mediaTypestringRequired"image" | "video" | "audio" | "document"
captionstringOptionalCaption text (image/video only)
filenamestringOptionalCustom filename for the media (useful for documents)
curl
curl -X POST https://api.wahero.id/api/v1/messages/media \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "phone": "628123456789",
    "mediaUrl": "https://example.com/image.jpg",
    "mediaType": "image",
    "caption": "Check this out!"
  }'
Response200
{
  "success": true,
  "data": {
    "messageId": "BADID_media456",
    "status": "sent",
    "mediaType": "image"
  }
}

Get Message

Retrieve full details of a previously sent or received message.

GET/api/v1/messages/:messageId

Path

ParameterTypeRequiredDescription
messageIdstringRequiredID returned when the message was sent

Query

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the instance that sent the message
Response200
{
  "success": true,
  "data": {
    "messageId": "BADID_abc123xyz",
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "chatId": "628123456789@c.us",
    "type": "chat",
    "fromMe": true,
    "status": "read",
    "timestamp": "2026-03-20T10:30:00.000Z"
  }
}

Message Status

Check the delivery status of a previously sent message.

GET/api/v1/messages/:messageId/status

Path

ParameterTypeRequiredDescription
messageIdstringRequiredID returned when the message was sent

Query

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the instance that sent the message
Response200
{
  "success": true,
  "data": {
    "messageId": "BADID_abc123xyz",
    "status": "read",
    "sentAt": "2026-03-20T10:30:00.000Z",
    "deliveredAt": "2026-03-20T10:30:03.000Z",
    "readAt": "2026-03-20T10:32:15.000Z"
  }
}

API Reference

Groups

List WhatsApp groups, send messages, and retrieve group members.

List Groups

Returns all groups the instance belongs to.

GET/api/v1/groups

Query

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
Response200
{
  "success": true,
  "data": [
    {
      "id": "120363012345678901@g.us",
      "name": "Team Wahero",
      "participantsCount": 12,
      "isAdmin": true
    }
  ]
}

Send to Group

Send a text message to a WhatsApp group.

POST/api/v1/groups/:groupId/message

Path

ParameterTypeRequiredDescription
groupIdstringRequiredWhatsApp group ID (e.g. 120363012345678901@g.us)

Body

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
messagestringRequiredText to send
Response200
{
  "success": true,
  "data": { "messageId": "BADID_grp789", "status": "sent" }
}

Group Members

Get the participants list for a specific group.

GET/api/v1/groups/:groupId/members

Path

ParameterTypeRequiredDescription
groupIdstringRequiredWhatsApp group ID

Query

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
Response200
{
  "success": true,
  "data": {
    "groupId": "120363012345678901@g.us",
    "participants": [
      { "id": "628123456789@c.us", "isAdmin": true, "isSuperAdmin": false },
      { "id": "628987654321@c.us", "isAdmin": false, "isSuperAdmin": false }
    ],
    "total": 2
  }
}

API Reference

Contacts

Access contacts synced from WhatsApp and validate numbers before sending.

List Contacts

Returns paginated contacts from the instance.

GET/api/v1/contacts

Query

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
limitintegerOptionalMax contacts to return, max 100 (default: 100)
offsetintegerOptionalNumber of contacts to skip for pagination (default: 0)
Response200
{
  "success": true,
  "data": [
    { "phone": "628123456789", "name": "Alice", "isMyContact": true }
  ],
  "pagination": { "total": 142, "limit": 100, "offset": 0, "hasMore": true }
}

Contact Detail

Get details for a specific contact.

GET/api/v1/contacts/:phone

Path

ParameterTypeRequiredDescription
phonestringRequiredPhone number without + (e.g. 628123456789)

Query

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the instance
Response200
{
  "success": true,
  "data": {
    "phone": "628123456789",
    "name": "Alice",
    "about": "Busy",
    "isOnWhatsApp": true,
    "profilePicUrl": "https://..."
  }
}

Check Number

Verify whether a phone number is registered on WhatsApp.

POST/api/v1/contacts/check

Body

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the instance
phonestringRequiredNumber to validate
Response200
{
  "success": true,
  "data": {
    "phone": "628123456789",
    "isOnWhatsApp": true,
    "chatId": "628123456789@c.us"
  }
}

API Reference

Instances

An instance is a connected WhatsApp number. Use the instanceId returned here in all messaging and contact endpoints.

List Instances

Returns all WhatsApp instances for your account.

GET/api/v1/instances
Response200
{
  "success": true,
  "data": [
    {
      "instanceId": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Customer Support",
      "status": "WORKING",
      "phone": "628123456789"
    }
  ]
}

Instance Status

Check the live connection state of a specific instance.

GET/api/v1/instances/:instanceId/status

Path

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the instance
Response200
{
  "success": true,
  "data": {
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "status": "WORKING",
    "lastSeen": "2026-03-20T10:30:00.000Z"
  }
}
Status valueMeaning
WORKINGConnected and ready to send messages
SCAN_QR_CODEAwaiting QR scan to authenticate
STARTINGInstance is initializing
STOPPEDInstance is offline

v2 API

Messages Advanced

Advanced messaging capabilities: replies, reactions, polls, location, contact cards, and link previews. Requires messages.send scope.

Reply to Message

Reply to a specific message by quoting it.

POST/api/v2/messages/reply

Body

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
phonestringRequiredRecipient number
messagestringRequiredReply text
quotedMessageIdstringRequiredID of the message to quote/reply to
curl
curl -X POST https://api.wahero.id/api/v2/messages/reply \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "phone": "628123456789",
    "message": "Thanks for your message!",
    "quotedMessageId": "BAE5abc123"
  }'
Response200
{
  "success": true,
  "data": { "messageId": "BAE5reply789", "status": "sent" }
}

Send Reaction

React to a message with an emoji.

PUT/api/v2/messages/reaction

Body

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
phonestringRequiredRecipient number
messageIdstringRequiredMessage ID to react to
emojistringRequiredEmoji character (e.g. 👍 ❤️ 😂 🔥). Empty string to remove reaction.
bash
curl -X PUT https://api.wahero.id/api/v2/messages/reaction \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"instanceId":"550e8400-...","phone":"628123456789","messageId":"BAE5abc123","emoji":"👍"}'
Response200
{ "success": true, "data": { "reacted": true } }

Forward Message

Forward an existing message to another contact.

POST/api/v2/messages/forward

Body

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
messageIdstringRequiredMessage ID to forward
toPhonestringRequiredTarget phone number
bash
curl -X POST https://api.wahero.id/api/v2/messages/forward \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"instanceId":"550e8400-...","messageId":"BAE5abc123","toPhone":"628987654321"}'

Send Location

Send GPS coordinates as a location pin.

POST/api/v2/messages/location

Body

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
phonestringRequiredRecipient number
latitudenumberRequiredLatitude (−90 to 90)
longitudenumberRequiredLongitude (−180 to 180)
namestringOptionalLocation name
addressstringOptionalStreet address
bash
curl -X POST https://api.wahero.id/api/v2/messages/location \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "phone": "628123456789",
    "latitude": -6.2088,
    "longitude": 106.8456,
    "name": "Jakarta Office",
    "address": "Jl. Sudirman No.1, Jakarta"
  }'
Response200
{ "success": true, "data": { "messageId": "BAE5loc456", "status": "sent" } }

Send Contact Card

Share a contact as a vCard message.

POST/api/v2/messages/contact

Body

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
phonestringRequiredRecipient number
contactPhonestringRequiredPhone number of the contact to share
contactNamestringRequiredDisplay name of the contact
bash
curl -X POST https://api.wahero.id/api/v2/messages/contact \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"instanceId":"550e8400-...","phone":"628123456789","contactPhone":"628987654321","contactName":"John Doe"}'

Poll & Vote

Create polls and submit votes programmatically.

POST/api/v2/messages/poll

Create Poll — Body

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
phonestringRequiredRecipient number
questionstringRequiredPoll question
optionsarrayRequiredArray of option strings (2–12 items)
multipleAnswersbooleanOptionalAllow multiple selections (default: false)
bash
curl -X POST https://api.wahero.id/api/v2/messages/poll \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "phone": "628123456789",
    "question": "Your favourite colour?",
    "options": ["Red", "Blue", "Green"],
    "multipleAnswers": false
  }'
Response200
{ "success": true, "data": { "messageId": "BAE5poll789", "status": "sent" } }

Vote on Poll

POST/api/v2/messages/poll/vote
ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
messageIdstringRequiredPoll message ID
selectedOptionsarrayRequiredArray of selected option indices (0-based)

v2 API

Chats

List chats, retrieve message history, and manage chat states. Requires messages.read scope for reads, messages.send for actions.

List Chats

Returns paginated chats for the instance.

GET/api/v2/chats

Query

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
limitintegerOptionalResults per page (default: 50)
offsetintegerOptionalPagination offset (default: 0)
curl
curl -G https://api.wahero.id/api/v2/chats \
  -H "X-Api-Key: YOUR_API_KEY" \
  --data-urlencode "instanceId=550e8400-e29b-41d4-a716-446655440000" \
  --data-urlencode "limit=50"
Response200
{
  "success": true,
  "data": [
    {
      "id": "628123456789@c.us",
      "name": "Alice",
      "lastMessage": { "body": "Hello!", "timestamp": 1742468400 },
      "unreadCount": 2,
      "isGroup": false
    }
  ],
  "pagination": { "limit": 50, "offset": 0, "total": 124 }
}

Chat Messages

Retrieve message history for a specific chat.

GET/api/v2/chats/:chatId/messages

Path

ParameterTypeRequiredDescription
chatIdstringRequiredChat ID (e.g. 628123456789@c.us)

Query

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
limitintegerOptionalNumber of messages (default: 100)
bash
curl -G https://api.wahero.id/api/v2/chats/628123456789%40c.us/messages \
  -H "X-Api-Key: YOUR_API_KEY" \
  --data-urlencode "instanceId=550e8400-e29b-41d4-a716-446655440000" \
  --data-urlencode "limit=50"
Response200
{
  "success": true,
  "data": [
    { "id": "BAE5abc", "body": "Hello!", "fromMe": false, "timestamp": 1742468400 },
    { "id": "BAE5def", "body": "Hi there!", "fromMe": true,  "timestamp": 1742468450 }
  ]
}

Chat Actions

All chat management endpoints. All POST/DELETE endpoints require messages.send scope and a body of { instanceId, chatId } unless noted.

MethodPathDescription
POST/api/v2/chats/mark-readMark chat as read
POST/api/v2/chats/archiveArchive chat
POST/api/v2/chats/unarchiveUnarchive chat
POST/api/v2/chats/muteMute chat (optional: duration ms)
POST/api/v2/chats/unmuteUnmute chat
POST/api/v2/chats/pinPin chat to top
POST/api/v2/chats/unpinUnpin chat
POST/api/v2/chats/typingShow/hide typing indicator (isTyping: bool)
GET/api/v2/chats/:chatId/profile-pictureGet profile picture URL (query: instanceId)
DELETE/api/v2/chats/:chatIdDelete chat locally (query: instanceId)
bash
# Example: archive a chat
curl -X POST https://api.wahero.id/api/v2/chats/archive \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"instanceId":"550e8400-e29b-41d4-a716-446655440000","chatId":"628123456789@c.us"}'
Response200
{ "success": true, "data": { "archived": true } }

v2 API

AI Agent

Interact with your AI agent and manage its knowledge base. Chat endpoints require agent.chat scope; management endpoints require agent.manage.

Chat with Agent

Send a message to the AI agent and receive an automated response. The agent uses the instance's knowledge base and conversation history to reply.

POST/api/v2/agent/chat

Body

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
phonestringRequiredUser WhatsApp number
messagestringRequiredUser message text
agentIdstringOptionalSpecific agent ID (defaults to instance agent)
curl
curl -X POST https://api.wahero.id/api/v2/agent/chat \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "phone": "628123456789",
    "message": "Berapa harga produk X?"
  }'
Response200
{
  "success": true,
  "data": {
    "reply": "Harga produk X adalah Rp 100.000. Ada yang bisa saya bantu lagi?",
    "agentId": "agent_abc123",
    "confidence": 0.95
  }
}

Learn & Context

Teach the agent from a real conversation, check conversation statistics, retrieve config, or reset context for a user.

POST/api/v2/agent/learn

Learn from Conversation — Body (scope: agent.manage)

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
phonestringRequiredUser WhatsApp number
questionstringRequiredUser question to learn from
correctAnswerstringRequiredCorrect answer to save to knowledge base
agentIdstringOptionalSpecific agent ID
bash
curl -X POST https://api.wahero.id/api/v2/agent/learn \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "phone": "628123456789",
    "question": "Apa jam operasional?",
    "correctAnswer": "Senin-Jumat 09:00-17:00 WIB"
  }'
Response200
{ "success": true, "data": { "learned": true } }
MethodPathDescriptionScope
GET/api/v2/agent/statsConversation statistics; query: instanceId, agentIdagent.chat
GET/api/v2/agent/configAgent configuration; query: instanceId, agentIdagent.chat
DELETE/api/v2/agent/contextClear conversation context for a user; query: instanceId, phone, agentIdagent.manage

Q&A Knowledge Base

Add question–answer pairs that the agent uses to respond to customers.

POST/api/v2/agent/kb/qna

Add Q&A — Body (scope: agent.manage)

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
questionstringRequiredQuestion text
answerstringRequiredAnswer text
categorystringOptionalCategory tag (default: general)
agentIdstringOptionalSpecific agent ID
bash
curl -X POST https://api.wahero.id/api/v2/agent/kb/qna \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "question": "Jam operasional?",
    "answer": "Senin-Jumat 09:00-17:00 WIB",
    "category": "information"
  }'
Response200
{ "success": true, "data": { "id": "qna_abc123", "question": "Jam operasional?", "answer": "Senin-Jumat 09:00-17:00 WIB" } }
MethodPathDescription
POST/api/v2/agent/kb/qnaAdd Q&A entry (scope: agent.manage)
GET/api/v2/agent/kb/qnaList Q&A entries; query: instanceId, category, limit, agentId (scope: agent.chat)
DEL/api/v2/agent/kb/qna/:idDelete Q&A entry; query: instanceId (scope: agent.manage)

Products

Manage a product catalogue that the agent can reference when answering price and stock questions.

POST/api/v2/agent/kb/products

Add Product — Body (scope: agent.manage)

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
namestringRequiredProduct name
descriptionstringRequiredProduct description
pricenumberRequiredPrice in smallest currency unit (e.g. IDR)
categorystringOptionalProduct category
stocknumberOptionalAvailable stock
skustringOptionalStock-keeping unit code
agentIdstringOptionalSpecific agent ID
bash
curl -X POST https://api.wahero.id/api/v2/agent/kb/products \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Sepatu Sport X",
    "description": "Sepatu olahraga premium anti-slip",
    "price": 350000,
    "category": "footwear",
    "stock": 25,
    "sku": "SX-001"
  }'
Response200
{ "success": true, "data": { "id": "prod_abc123", "name": "Sepatu Sport X", "price": 350000 } }
MethodPathDescription
POST/api/v2/agent/kb/productsAdd product (scope: agent.manage)
GET/api/v2/agent/kb/productsList products; query: instanceId, category, limit, agentId (scope: agent.chat)
DEL/api/v2/agent/kb/products/:idDelete product; query: instanceId (scope: agent.manage)

URLs

Register URLs for the agent to scrape and learn from. Useful for onboarding FAQ pages, product catalogues, or company info pages.

POST/api/v2/agent/kb/urls

Add URL — Body (scope: agent.manage)

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
urlstringRequiredURL to scrape and index
categorystringOptionalCategory tag (default: general)
agentIdstringOptionalSpecific agent ID
bash
curl -X POST https://api.wahero.id/api/v2/agent/kb/urls \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"instanceId":"550e8400-...","url":"https://example.com/faq","category":"support"}'
MethodPathDescription
POST/api/v2/agent/kb/urlsAdd URL to scrape (scope: agent.manage)
GET/api/v2/agent/kb/urlsList URLs; query: instanceId, agentId (scope: agent.chat)
DEL/api/v2/agent/kb/urls/:idDelete URL; query: instanceId (scope: agent.manage)

Files

Store text content for the agent to learn from. Send the file's text content as a string — useful for FAQ documents, SOPs, or knowledge articles.

POST/api/v2/agent/kb/files

Upload File — Body (scope: agent.manage)

ParameterTypeRequiredDescription
instanceIdstringRequiredUUID of the WhatsApp instance
fileNamestringRequiredDisplay name of the file (e.g. faq.txt)
contentstringRequiredText content of the file
fileTypestringOptionalFile type hint: "text" or "pdf" (default: text)
agentIdstringOptionalSpecific agent ID
bash
curl -X POST https://api.wahero.id/api/v2/agent/kb/files \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "550e8400-e29b-41d4-a716-446655440000",
    "fileName": "faq-produk.txt",
    "content": "Jam operasional: Senin-Jumat 09:00-17:00 WIB\nHubungi: cs@example.com",
    "fileType": "text"
  }'
Response200
{ "success": true, "data": { "_id": "file_abc123", "fileName": "faq-produk.txt", "fileSize": 72, "processingStatus": "completed" } }
MethodPathDescription
POST/api/v2/agent/kb/filesUpload file (multipart/form-data, scope: agent.manage)
GET/api/v2/agent/kb/filesList uploaded files; query: instanceId, agentId (scope: agent.chat)
DEL/api/v2/agent/kb/files/:idDelete file; query: instanceId (scope: agent.manage)

Reference

Error Codes

All errors share a consistent JSON shape. Check the HTTP status code and the message field.

json
{
  "success": false,
  "message": "Instance not found",
  "error": "INSTANCE_NOT_FOUND"
}
StatusNameWhen it occurs
400Bad RequestMissing or invalid request parameters
401UnauthorizedAPI key is absent or invalid
403ForbiddenAPI key lacks the required scope
404Not FoundInstance, contact, or message not found
422Unprocessable EntityPhone format invalid or instance disconnected
429Too Many RequestsRate limit exceeded — retry after X-RateLimit-Reset
500Internal Server ErrorUnexpected server-side failure

Reference

Webhooks

Wahero sends HTTP POST requests to your registered webhook URL when events occur. Configure it in the dashboard.

Payload structure

json
{
  "event":     "message",
  "session":   "550e8400-e29b-41d4-a716-446655440000",
  "timestamp": 1742468400,
  "payload": {
    "from":      "628123456789@c.us",
    "body":      "Hello!",
    "type":      "chat",
    "messageId": "BAE5abc123"
  }
}

Events

EventDescription
messageNew incoming message received
message.ackMessage delivery status updated (sent/delivered/read)
session.statusInstance connection status changed
qrcode.updatedNew QR code generated for authentication
callIncoming call received or rejected

Signature Verification

Every webhook request includes an X-Wahero-Signature header — an HMAC-SHA256 of the raw body using your webhook secret. Always verify this before processing events.

Ready to build?

Create a free account and get your API key in minutes.