API & Webhooks
Programmatically interact with your agents through APIs and webhooks
Kapso provides powerful programmatic interfaces to integrate your agents with external systems, enabling automated workflows and real-time communication.
API Overview
The Kapso API enables you to:
- Trigger agent executions programmatically
- Retrieve execution status and results
- Manage agent configurations
- Access conversation history
Authentication
All API requests require authentication using your Project API Key:
Find your API keys in your Project settings under “API Keys”. Keep these keys secure and never expose them in client-side code.
For complete endpoint documentation, see the API Reference.
Agent Webhooks
Webhooks allow two-way communication: your systems can trigger Kapso agents, and Kapso agents can notify your systems.
Incoming Webhooks (Triggering Agents)
Use incoming webhooks to start an agent’s execution flow from your application (e.g., backend, CRM).
-
Endpoint: Each agent has a unique webhook URL.
-
Authentication: Include your Project API Key in the
X-API-Key
request header. -
Request Body (Optional): Send initial data in the JSON payload.
-
Example (Node.js):
Outbound Webhooks (Agent Notifications)
Configure your agents to send real-time notifications to your systems when important events occur during execution.
Configuration
- Navigate to your agent’s “API & Webhooks” settings
- Add webhook endpoints for the events you want to monitor
- Configure a Secret Key for request verification
- Select which events to subscribe to
Supported Events
Execution Started
agent_execution_started
Fired when an agent begins processing
Execution Ended
agent_execution_ended
Fired when an agent completes successfully
Execution Failed
agent_execution_failed
Fired when an agent encounters an error
Handoff Required
agent_execution_handoff
Fired when human intervention is needed
Security & Verification
Every webhook request includes an X-Webhook-Signature
header containing an HMAC SHA-256 signature of the request body. Verify this signature using your configured Secret Key to ensure authenticity.
Webhook Payloads
All webhook payloads include base execution data plus event-specific information:
Base Payload Structure
Event-Specific Data
Handoff Event includes handoff details:
Failed Event includes error information:
Webhook Best Practices
Important considerations:
- Respond quickly (within 5 seconds) with a 2xx status code
- Process webhook data asynchronously if needed