API Reference

Overview

The Tonalysis API analyses the tone and subtext of any text. It runs a 4-layer engine — phrase patterns, delta analysis, Q&A gap detection, and structural signals — then synthesises a JSON response with scores, decoded statements, and an executive summary.

POSThttps://api.tonalysis.ai/v1/analyse

Authentication

Pass your API key as a Bearer token in the Authorization header.

Authorization: Bearer tly_live_abc123...

Get your key from the dashboard. Test keys use the tly_test_ prefix and are limited to Layer 1 only.

Request

Send a JSON body with the following fields:

FieldTypeRequiredDescription
textstringThe text to analyse. Max chars depends on tier (test: 50,000; hobby/pro: 150,000).
categorystringOne of the built-in category keys, or “custom” with customConfig.
priorTextstringPrevious version of the text. Enables Layer 2 delta analysis (Hobby/Pro only).
qaContextstringThe Q&A section of a document (e.g. analyst questions on an earnings call). Improves Layer 3 gap detection.
customConfigobjectCustom category configuration. See Categories.
{
  "text": "We remain comfortable with guidance for the full year...",
  "category": "earnings_call",
  "priorText": "We are confident in our outlook...",
  "qaContext": "Analyst: Can you clarify the margin guidance?\nMgmt: We see continued progress..."
}

Response

A successful response returns HTTP 200 with the following shape:

{
  "data": {
    "category": "earnings_call",
    "overallTone": "cautious",
    "scores": [
      { "axis": "confidence",    "score": 4, "rationale": "..." },
      { "axis": "hedging",       "score": 7, "rationale": "..." },
      { "axis": "transparency",  "score": 5, "rationale": "..." },
      { "axis": "engagement",    "score": 6, "rationale": "..." },
      { "axis": "authenticity",  "score": 5, "rationale": "..." }
    ],
    "decodedStatements": [
      {
        "original":     "We remain comfortable with guidance",
        "decoded":      "Confidence is not strong — expect revision",
        "significance": "high"
      }
    ],
    "avoidedTopics":    ["cash conversion", "EMEA margin decline"],
    "keyFindings":      ["Hedging language increased 40% vs prior quarter"],
    "executiveSummary": "Management tone is guarded...",
    "layerData": {
      "phrases":    [...],
      "deltas":     [...],
      "gaps":       [...],
      "structural": [...]
    }
  },
  "meta": {
    "tier":      "Hobby",
    "used":      12,
    "limit":     500,
    "remaining": 488,
    "durationMs": 4200
  }
}

Fields

FieldTypeDescription
overallTonestringOne of: confident, cautious, defensive, evasive, neutral
scoresarray5 axis scores 0–10. Axes: confidence, hedging, transparency, engagement, authenticity
decodedStatementsarraySpecific phrases decoded: { original, decoded, significance }
avoidedTopicsstring[]Topics expected but not addressed
keyFindingsstring[]Headline observations for quick scanning
executiveSummarystring1–2 sentence synthesis
layerData.phrasesarrayLayer 1: phrase patterns with decoded meaning
layerData.deltasarrayLayer 2: language shifts vs priorText (empty if no priorText)
layerData.gapsarrayLayer 3: Q&A gaps — questions asked but not answered
layerData.structuralarrayLayer 4: structural signals (topic order, density, qualifiers)

Categories

KeyUse case
earnings_callEarnings call transcripts, management commentary
investor_presentationInvestor decks, capital markets day materials
performance_reviewEmployee performance reviews, feedback documents
exit_interviewExit interview transcripts
contract_negotiationContract drafts, term sheets, negotiation emails
sales_callSales call transcripts, demos, discovery calls
generalUniversal fallback for any text type

Custom categories

Define your own at runtime by passing category: “custom” with a customConfig object:

{
  "text": "...",
  "category": "custom",
  "customConfig": {
    "key": "my_category",
    "displayName": "Board Meeting",
    "description": "Board meeting minutes and presentations",
    "layer1Focus": ["commitment language", "risk hedging"],
    "layer3ExpectedTopics": ["financial performance", "strategy update", "risk review"],
    "layer4Checklist": ["key agenda items covered", "follow-up actions specified"]
  }
}

Tier Restrictions

TierMonthly limitLayersSynthesisDelta (Layer 2)
Test10Layer 1 onlyNoNo
Hobby500All 4YesYes
Pro1,000All 4YesYes
CustomNegotiatedAll 4YesYes

On the Test tier, overallTone, scores, decodedStatements, and executiveSummary are not returned. The response includes a _notice field explaining the upgrade path.

Error Codes

HTTPError codeMeaning
401MISSING_API_KEYNo Bearer token provided
401INVALID_API_KEYKey not found or revoked
400MISSING_TEXTtext field is required
400MISSING_CATEGORYcategory field is required
400INVALID_CATEGORYCategory key not recognised
400INPUT_TOO_LARGEText exceeds tier character limit
429QUOTA_EXCEEDEDMonthly call limit reached
500ANALYSIS_FAILEDInternal error during analysis