Voyant Networks Docs

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)

Authentication

All requests must be signed using your apiSecret . Send the generated signature in header x-signature .

Required fields in request body:

  • • projectId
  • • apiKey
  • • nonce (random alphanumeric exactly 10 characters)
  • • timestamp
  • • text (for single request)
  • • texts (for batch request)

⚠️ All fields (including text/texts) must be included while generating the signature.

Signature Generation

1. Send a POST request with application/json body
2. Include required fields + text (single) or texts (batch)
3. Create payload including ALL fields
4. Sort keys before stringify
5. Generate HMAC-SHA256 using apiSecret
6. Send in x-signature header

import crypto from "node:crypto";

const payload = {
  nonce,
  projectId,
  apiKey,
  timestamp,
  ...(isBatch ? { texts } : { text })
};

const stable = JSON.stringify(
  Object.keys(payload)
    .sort()
    .reduce((a, k) => {
      a[k] = payload[k];
      return a;
    }, {})
);

const signature = crypto
  .createHmac("sha256", apiSecret)
  .update(stable)
  .digest("hex");

⚠️ text/texts MUST be included in signature calculation, otherwise request will fail.

Single Text

Analyze a single text input. Max length: 500 characters .

POST /v1/text/analyze

{
  "text": "I loved the service!",
  "projectId": "...",
  "apiKey": "...",
  "nonce": "...",
  "timestamp": 123456
}

Batch (Max 10 Texts)

Send multiple texts. Combined length must be ≤ 500 characters .

POST /v1/text/analyze/batch

{
  "texts": ["text1", "text2"],
  "projectId": "...",
  "apiKey": "...",
  "nonce": "...",
  "timestamp": 123456
}

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 / negative tone
obsceneContent → vulgar / explicit language
threateningContent → threats or violent intent
insultingLanguage → direct insults
identityAttack → hate toward groups (race, religion, etc)
sexuallyExplicit → adult / sexual content
spam → promotional / repetitive / low-quality text
phishing → scam / fraud attempts
sentiment → -1 (negative) → +1 (positive)
• Max 500 chars total per request
• Max 10 texts in batch
• Invalid signature → request fails
• Rate limits apply