Get up and running with the Hamsa API quickly. This guide walks you through making your first API call and creating a voice agent programmatically.
Prerequisites
- Hamsa account (Sign up)
- API key (Create one)
- Basic knowledge of REST APIs
- cURL, Postman, or your preferred HTTP client
Step 1: Get Your API Key
- Log in to your Hamsa dashboard
- Navigate to Settings → API Keys
- Click Create API Key
- Copy and save your key securely
Keep your API key secure. Never commit it to version control or share it publicly.
Step 2: Make Your First API Call
Test your API key with a simple request:
curl -X GET https://api.tryhamsa.com/v1/voice-agents \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
You should receive a list of your voice agents (empty if you haven’t created any yet).
Step 3: Create a Voice Agent
Create your first agent via the API:
curl -X POST https://api.tryhamsa.com/v1/voice-agents \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "My First Agent",
"type": "SINGLE_PROMPT",
"prompt": "You are a helpful customer service agent. Answer questions politely and professionally.",
"projectId": "YOUR_PROJECT_ID"
}'
Next Steps