Skip to main content

Getting Started with Truebar

This guide is the shortest path to confirming Truebar is reachable and your account works. By the end you will have a speech.pcm file produced by the platform's text-to-speech pipeline.

The flow uses bash and curl so it copy-pastes anywhere with minimal tooling. For production-quality code in JavaScript or Python, continue with the Streaming STT or Streaming TTS tutorials. For protocol depth, head to the Integrator Manuals.

1. Set credentials and target host#

Pick your environment, then export the variables. The example below targets production; uncomment the alternative lines to use the playground environment.

export TRUEBAR_AUTH_URL="https://auth.true-bar.si/realms/truebar/protocol/openid-connect/token"export TRUEBAR_API_BASE_URL="https://api.true-bar.si"# Playground:# export TRUEBAR_AUTH_URL="https://playground-auth.true-bar.si/realms/truebar/protocol/openid-connect/token"# export TRUEBAR_API_BASE_URL="https://playground-api.true-bar.si"
export TRUEBAR_USERNAME="alice@example.com"export TRUEBAR_PASSWORD="super-secret-passphrase"export TRUEBAR_CLIENT_ID="truebar-client"
Windows

On PowerShell use $env:NAME = "value"; on cmd use set NAME=value. The curl commands themselves run unchanged once curl and jq are on PATH.

2. Fetch an access token#

Truebar issues different audiences depending on which scope you request. For the pipelines API you must explicitly ask for the truebar-backend scope — without it, Keycloak returns a token aimed at the subscription manager and the API will reject it with 401.

export TRUEBAR_ACCESS_TOKEN=$(curl --silent --fail \  --request POST "$TRUEBAR_AUTH_URL" \  --header 'Content-Type: application/x-www-form-urlencoded' \  --data-urlencode 'grant_type=password' \  --data-urlencode "username=$TRUEBAR_USERNAME" \  --data-urlencode "password=$TRUEBAR_PASSWORD" \  --data-urlencode "client_id=$TRUEBAR_CLIENT_ID" \  --data-urlencode 'scope=truebar-backend' \  | jq -r '.access_token')
echo "Token: ${TRUEBAR_ACCESS_TOKEN:0:24}…"

If the echo prints null… or curl exits with a 401, the username, password, or client ID is wrong. If you get a token but later API calls return 401, decode the token at https://jwt.io and confirm aud includes the pipelines backend — if it doesn't, the scope=truebar-backend parameter wasn't applied.

3. Pick a TTS voice#

List every stage your account can call, then look for one with task: "TTS" and copy its tag:

curl --silent --fail \  --request GET "$TRUEBAR_API_BASE_URL/api/pipelines/stages" \  --header "Authorization: Bearer $TRUEBAR_ACCESS_TOKEN" \  | jq '.'

Export the tag you picked:

export TRUEBAR_TTS_TAG="RIVA:sl-SI:ZIGA:20250408-2103"  # ← replace with one from your list

4. Synthesize a sentence#

Submit a single-stage pipeline plus a JSON array of TextSegment objects. For text-consuming stages (TTS, NLP) the data part must be application/json — not raw text. The response body is a playable WAV file at the requested sample rate:

TRUEBAR_PIPELINE=$(printf '[{"task":"TTS","exceptionHandlingPolicy":"THROW","parameters":{"sampleRate":22050},"config":{"tag":"%s"}}]' "$TRUEBAR_TTS_TAG")
curl --fail \  --request POST "$TRUEBAR_API_BASE_URL/api/pipelines/process" \  --header "Authorization: Bearer $TRUEBAR_ACCESS_TOKEN" \  --form "pipeline=$TRUEBAR_PIPELINE;type=application/json" \  --form 'data=[{"text":"Pozdravljeni iz Truebar platforme."}];type=application/json' \  --output speech.wav
ls -lh speech.wav

printf builds the pipeline JSON with the voice tag substituted, avoiding the fragile single-quote/double-quote dance inside the curl arguments.

Play it with any media player. From a shell:

# macOSafplay speech.wav# Linux (FFmpeg's ffplay)ffplay -nodisp -autoexit speech.wav# Windowsstart speech.wav

Hearing the sentence means your account, network, and chosen voice all work end-to-end.

Next steps#