Quickstart Guide
This guide will help you get started with the Klen AI API. We’ll walk through the process of setting up your account, creating an API key, and making your first API call.
Prerequisites
Before you begin, you’ll need:
- A Klen AI account (sign up at app.klen.ai if you don’t have one)
- Basic knowledge of REST APIs and your preferred programming language
- A tool to make API requests (like cURL, Postman, or your programming language’s HTTP client)
Step 1: Create an API Key
- Log in to your Klen AI dashboard at app.klen.ai
- Navigate to Settings > API Keys
- Click “Create New API Key”
- Give your key a descriptive name and select the appropriate permissions
- Click “Create” and copy your API key
Important: This key will only be shown once, so make sure to store it securely. Treat it like a password!
Step 2: Make Your First API Call
Let’s make a simple API call to list your agents. This will help verify that your API key is working correctly.
curl -X GET 'https://api.klen.ai/api/v1/agents' \
-H 'Authorization: Bearer klen_YOUR_API_KEY'
If everything is set up correctly, you should receive a JSON response containing a list of your agents.
Step 3: Initiate a Call
Now let’s make an outbound call using one of your AI agents.
Make sure your account has sufficient funds and that the agent you’re using has an assigned phone number.
curl -X POST 'https://api.klen.ai/api/v1/calls' \
-H 'Authorization: Bearer klen_YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"phone_number": "+15551234567",
"agent_id": "YOUR_AGENT_ID",
"variables": {
"customer_name": "John Doe"
}
}'
If successful, you’ll receive a JSON response with details about the call that was initiated.
Step 4: Set Up a Webhook (Optional)
To receive real-time updates about call events, you can set up a webhook endpoint.
- Create a publicly accessible endpoint on your server that can receive POST requests
- Register the webhook in the Klen AI dashboard or using the API:
curl -X POST 'https://api.klen.ai/api/v1/api/webhooks/create' \
-H 'Authorization: Bearer klen_YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "Call Events Webhook",
"url": "https://your-server.com/webhooks/klen",
"subscribed_events": ["call.started", "call.ended", "call.transcript"]
}'
- Implement logic on your endpoint to handle the webhook events
Next Steps
Congratulations! You’ve successfully set up your Klen AI API key and made your first API calls. Here are some suggested next steps:
Need help? Contact our support team for assistance.
Responses are generated using AI and may contain mistakes.