Bash / Unix Shell 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.
Bash / Unix Shell
/api/v1/tone
: "${SAPLING_API_KEY:?Set SAPLING_API_KEY first.}"
curl --fail-with-body \
--request POST \
--url https://api.sapling.ai/api/v1/tone \
--header "Authorization: Bearer ${SAPLING_API_KEY}" \
--header "Content-Type: application/json" \
--data '{
"text": "Really stoked about this! Will it be ready by next week?"
}'
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 Bash / Unix Shell
Bash is a command-line interpreter that provides an interface for Unix-like operating systems. It's a popular scripting language for Unix, Linux, and macOS.