Skip to main content
POST

Overview

Create a WhatsApp agent for the user who owns the API key. Optionally attach it to one of your WhatsApp integrations with phoneNumberId; you can also attach it later with Assign Agent to WhatsApp Number. Tools, templates, analysis metrics and memory settings are easiest to set up in the dashboard after the agent exists.

Prerequisites

  • An API key for your workspace

Request

string
required
Your workspace API key. Create one from the profile menu in the dashboard → API Keys.
string
required
Name of the agent.
string
required
The agent’s instructions (prompt).
integer
required
Minutes of user inactivity after which a conversation ends. The dashboard allows 1 to 360; the API only requires a value.
string
Integration ID (_id from Get WhatsApp Numbers) to attach the agent to.
string
Male, Female or Other. Used for verb forms in some languages.
array[string]
Language codes the agent speaks.
string
Knowledge base to answer from: the vectorDbCollection of one of your knowledge bases, from Get Knowledge Bases.
array[object]
Variables the agent uses.

Response

array
Always empty: the response doesn’t include the new agent or its ID. Find it with Get WhatsApp Agents (most recently edited first).

Error Handling

Errors return status: false, with the reason in errorMessage.
  • 400 Bad Request
    • Agent name, system message, and session timeout are required.
    • Invalid Phone Number ID.
    • Only one send_whatsapp_start_message tool is allowed.
  • 401 Unauthorized – Missing or invalid API key.
  • 403 Forbidden – The request sets settings.cross_memory, which only super admins can change.
  • 429 Too Many Requests – More than 1,000 WhatsApp requests in 15 minutes from your IP address.
  • 500 Internal Server Error – Unexpected server error.