Analyze sentiment with advanced AI
Our sentiment analysis API uses state-of-the-art natural language processing to understand emotions and opinions in text.
// Analyze sentiment
const text ="I absolutely love using OnlyOneAPI! It's made our development so much easier.";
const response = await fetch('https://api.onlyoneapi.com/v1/ai/sentiment', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ text })
});
const result = await response.json();
// Result: {
// sentiment:"positive",
// confidence: 0.98,
// emotions: {
// joy: 0.85,
// trust: 0.72,
// anticipation: 0.45
// }
// }
The API returns detailed sentiment information: