Tutorial💻
Integrating Amaalsense API: A Developer's Guide
Developer RelationsDecember 28, 202512 min read
APIIntegrationDevelopment
Getting Started with AmalSense API
This comprehensive guide will walk you through integrating AmalSense's emotion analysis capabilities into your applications.
Prerequisites
Authentication
All API requests require authentication via Bearer token:
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.amalsense.com/v1/analyze
Core Endpoints
1. Analyze Text
POST /v1/analyze
POST /v1/analyze
Request body:
{
"text": "Your text to analyze",
"language": "en",
"include_emotions": true
}
Response:
{
"gmi": 45.2,
"cfi": 23.1,
"hri": 67.8,
"emotions": {
"joy": 0.3,
"fear": 0.1,
"anger": 0.05,
"sadness": 0.1,
"hope": 0.35,
"curiosity": 0.1
}
}
2. Get Country Data
GET /v1/countries/{country_code}
GET /v1/countries/{country_code}
3. Historical Data
GET /v1/history?country={code}&days={n}
GET /v1/history?country={code}&days={n}
Rate Limits
Plan Requests/minute Requests/day
-
-- Free 10 1,000 Pro 100 50,000 Enterprise Unlimited Unlimited
Code Examples
Python
import requestsresponse = requests.post(
"https://api.amalsense.com/v1/analyze",
headers={"Authorization": "Bearer YOUR_KEY"},
json={"text": "Great news today!"}
)
print(response.json())
import requestsresponse = requests.post(
"https://api.amalsense.com/v1/analyze",
headers={"Authorization": "Bearer YOUR_KEY"},
json={"text": "Great news today!"}
)
print(response.json())
JavaScript
const response = await fetch(
"https://api.amalsense.com/v1/analyze",
{
method: "POST",
headers: {
"Authorization": "Bearer YOUR_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({ text: "Great news today!" })
}
);
const data = await response.json();
const response = await fetch(
"https://api.amalsense.com/v1/analyze",
{
method: "POST",
headers: {
"Authorization": "Bearer YOUR_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({ text: "Great news today!" })
}
);
const data = await response.json();
Best Practices
1. Cache responses
Support
- Documentation: docs.amalsense.com
*Happy coding! We can't wait to see what you build.*