Sapling Logo
Tone API quickstart

PowerShell Tone Checker

Analyze overall and sentence-level tone from a PowerShell application across 28 fine-grained categories.

  • HTTPS POST
  • JSON HTTP API
  • Bearer API key
POST PowerShell logo PowerShell /api/v1/tone

PowerShell tone checker quickstart

Send text to the tone endpoint. The response ranks overall tones and returns a separate probability breakdown for every sentence.

No language-specific SDK is required. The example uses a standard or commonly used HTTP client to call Sapling's JSON API.
PowerShell /api/v1/tone
if (-not $env:SAPLING_API_KEY) {
  throw "Set SAPLING_API_KEY first."
}

$headers = @{
  Authorization = "Bearer $($env:SAPLING_API_KEY)"
}
$body = @{
  text = "Really stoked about this! Will it be ready by next week?"
} | ConvertTo-Json

$result = Invoke-RestMethod `
  -Uri "https://api.sapling.ai/api/v1/tone" `
  -Method Post `
  -Headers $headers `
  -ContentType "application/json" `
  -Body $body

$result | ConvertTo-Json -Depth 10
Example response application/json
{
  "overall": [
    [0.9247, "curious", "🤓"],
    [0.0455, "excited", "😀"],
    [0.0057, "confused", "😕"]
  ],
  "results": [
    [[0.9937, "excited", "😀"]],
    [[0.5469, "confused", "😕"], [0.3993, "curious", "🤓"]]
  ],
  "sents": [
    "Really stoked about this!",
    "Will it be ready by next week?"
  ]
}

Probabilities are returned in descending order as probability, tone, and emoji tuples. Use sentence results when a message contains mixed tones.

About PowerShell

PowerShell is Microsoft's command-line shell and scripting language for Windows, which is where it sees most adoption. It is the default automation tool for Windows-based scripts. PowerShell additionally supports Linux and macOS.