Text Analysis API Usage, Sentiment & Content Moderation
Analyze text for sentiment, toxicity, spam, and more using Voyant AI. Supports both single and batch requests with secure signature-based authentication.
Try Text Analysis Demo →Base URL: https://api.voyantnetworks.com
Endpoints:
• /v1/text/analyze (single)
• /v1/text/analyze/batch (max 10 texts)
Endpoints:
• /v1/text/analyze (single)
• /v1/text/analyze/batch (max 10 texts)
Official SDKs & Libraries
Use official SDKs for faster integration across platforms.
Node.js
Backend / Server-side
JavaScript (Browser)
Frontend / Web
Flutter
Mobile / Web Apps
Python
Backend / ML / Scripts
Request Flow & Authentication
Use the REST API directly or integrate using the official SDKs shown below.
All requests must be signed using your API Secret . Send the generated signature in the x-signature header.
payload = {
accountId,
projectId,
apiKey,
text OR texts
}
signature =
HMAC_SHA256(
JSON.stringify(payload),
API_SECRET
)
Headers:
x-signature: signature
SDK Usage (Recommended)
const creds = {
apiKey: "YOUR_API_KEY",
accountId: "YOUR_ACCOUNT_ID"
};
const text = new VoyantClient.TextAnalyzeApiClient({
credentials: creds,
projectId: "YOUR_PROJECT_ID"
});
// single
await text.analyze("hello world");
// batch
await text.analyze([
"hello",
"world"
]);
Single Text
POST /v1/text/analyze
{
"accountId":"...",
"projectId":"...",
"apiKey":"...",
"text":"Hello world"
}
Batch (Max 10 Texts)
POST /v1/text/analyze/batch
{
"accountId":"...",
"projectId":"...",
"apiKey":"...",
"texts":[
"Hello",
"World"
]
}
Response Format
Each request returns probability scores (0 → 1) for different content signals. Higher value = stronger confidence.
{
"success": true,
"data": {
"toxic": 0.0087,
"obsceneContent": 0.0217,
"threateningContent": 0.0182,
"insultingLanguage": 0.0755,
"identityAttack": 0.1063,
"sexuallyExplicit": 0.0349,
"spam": 1,
"phishing": 0,
"sentiment": 0.3579
}
}
toxic → general harmful tone
obsceneContent → vulgar content
threateningContent → threats
insultingLanguage → insults
identityAttack → hate speech
sexuallyExplicit → adult content
spam → promotional content
phishing → scam detection
sentiment → -1 to +1
• Max 500 chars total per request
• Max 10 texts in batch
• Invalid signature → request fails
• Rate limits apply
• Content-Type must be application/x-www-form-urlencoded
• Signature must be sent in body (not header)
• Max 10 texts in batch
• Invalid signature → request fails
• Rate limits apply
• Content-Type must be application/x-www-form-urlencoded
• Signature must be sent in body (not header)
Next Steps
Manage and optimize your text analysis usage: