Making Your First Request
This guide walks you through making your first API request to CallCov, from authentication to receiving your analysis results.
Before You Startβ
Make sure you have:
- β Created a CallCov account
- β Verified your email
- β Obtained an API key or access token
- β A sample call recording file
If you haven't completed these steps, see the Quickstart Guide.
Base URLβ
All API requests are made to:
https://api.callcov.com/api/v1
Request Formatβ
CallCov uses RESTful API principles:
- Protocol: HTTPS only
- Format: JSON for request/response bodies
- Authentication: Bearer token in
Authorizationheader - Content-Type:
application/json(ormultipart/form-datafor file uploads)
Example: Submit an Analysisβ
Let's analyze a call recording step by step.
cURL Exampleβ
curl -X POST https://api.callcov.com/api/v1/analysis/ \
-H "Authorization: Bearer sk_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"audio_url": "https://example.com/recordings/call-001.wav",
"agent_id": "agent_john_doe",
"contact_id": "customer_12345",
"webhook_url": "https://your-app.com/webhooks/analysis"
}'
Python Exampleβ
import requests
# Your API credentials
API_KEY = "sk_live_abc123..."
BASE_URL = "https://api.callcov.com/api/v1"
# Prepare the request
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
payload = {
"audio_url": "https://example.com/recordings/call-001.wav",
"agent_id": "agent_john_doe",
"contact_id": "customer_12345",
"webhook_url": "https://your-app.com/webhooks/analysis"
}
# Make the request
response = requests.post(
f"{BASE_URL}/analysis/",
headers=headers,
json=payload
)
# Handle the response
if response.status_code == 201:
analysis = response.json()
print(f"β
Analysis created: {analysis['id']}")
print(f"Status: {analysis['status']}")
else:
print(f"β Error: {response.status_code}")
print(response.json())
Node.js Exampleβ
const axios = require('axios');
const API_KEY = 'sk_live_abc123...';
const BASE_URL = 'https://api.callcov.com/api/v1';
async function submitAnalysis() {
try {
const response = await axios.post(
`${BASE_URL}/analysis/`,
{
audio_url: 'https://example.com/recordings/call-001.wav',
agent_id: 'agent_john_doe',
contact_id: 'customer_12345',
webhook_url: 'https://your-app.com/webhooks/analysis'
},
{
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
}
);
console.log('β
Analysis created:', response.data.id);
console.log('Status:', response.data.status);
} catch (error) {
console.error('β Error:', error.response.status);
console.error(error.response.data);
}
}
submitAnalysis();
Response Structureβ
Success Response (201 Created)β
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"object": "analysis",
"created": 1642248000,
"status": "processing",
"livemode": true,
"call": {
"agent_id": "agent_john_doe",
"contact_id": "customer_12345"
},
"audio": {
"url": "https://s3.amazonaws.com/callcov/...",
"duration_seconds": null,
"format": "wav",
"file_size": null
},
"transcript": null,
"results": null,
"metadata": {
"processing_time_ms": null,
"version": "1.0.0"
}
}
Error Response (400 Bad Request)β
{
"detail": [
{
"type": "missing",
"loc": ["body", "audio_url"],
"msg": "Field required",
"input": {}
}
]
}
Checking Analysis Statusβ
Analyses are processed asynchronously. Check the status with:
curl -X GET https://api.callcov.com/api/v1/analysis/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer sk_live_abc123..."
Status Valuesβ
| Status | Description |
|---|---|
processing | Analysis is in progress |
completed | Analysis finished successfully |
failed | Analysis encountered an error |
Polling for Resultsβ
import time
import requests
def wait_for_analysis(analysis_id, api_key, max_wait=300):
"""Poll for analysis completion (max 5 minutes)"""
headers = {"Authorization": f"Bearer {api_key}"}
url = f"https://api.callcov.com/api/v1/analysis/{analysis_id}"
start_time = time.time()
while time.time() - start_time < max_wait:
response = requests.get(url, headers=headers)
analysis = response.json()
if analysis['status'] == 'completed':
print("β
Analysis complete!")
return analysis
elif analysis['status'] == 'failed':
print("β Analysis failed:", analysis.get('error_message'))
return None
print(f"β³ Status: {analysis['status']}... waiting")
time.sleep(10) # Poll every 10 seconds
print("β±οΈ Timeout waiting for analysis")
return None
# Usage
analysis_id = "550e8400-e29b-41d4-a716-446655440000"
result = wait_for_analysis(analysis_id, "sk_live_abc123...")
Using Webhooks (Recommended)β
Instead of polling, use webhooks for real-time notifications:
# When creating analysis, include webhook_url
payload = {
"audio_url": "https://example.com/recordings/call-001.wav",
"agent_id": "agent_john_doe",
"contact_id": "customer_12345",
"webhook_url": "https://your-app.com/webhooks/analysis" # β Your webhook endpoint
}
Your webhook will receive:
{
"event": "analysis.completed",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"results": { ... }
}
}
Learn more in the Webhooks Guide.
Common Issuesβ
401 Unauthorizedβ
{"detail": "Invalid authentication credentials"}
Solution: Check your API key is correct and included in the Authorization header.
400 Bad Requestβ
{"detail": "audio_url is required"}
Solution: Ensure all required fields are included in your request.
422 Unprocessable Entityβ
{"detail": "Invalid audio file format"}
Solution: Check that your audio file is in a supported format (WAV, MP3, etc.).
Rate Limitsβ
CallCov enforces rate limits to ensure service quality:
- Default: 100 requests per minute
- Analysis submissions: 20 per minute
Rate limit info is included in response headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1642248060
Next Stepsβ
Now that you've made your first request, explore:
- API Reference - Complete endpoint documentation
- Webhooks Guide - Real-time notifications
- Error Handling - Handle errors gracefully
- Production Best Practices - Deploy with confidence