Skip to main content

Offline Pipeline API

Truebar’s offline API lets you run the same pipelines used for streaming, but as HTTP jobs. It is ideal for large audio archives, background text clean-up, and TTS workloads where real-time latency is not required.

When to choose the offline API#

  • Batch ingestion – Transcribe or synthesise long-form media without keeping a WebSocket connection open.
  • Post-processing – Re-run NLP stages on previously captured transcripts.
  • Automation – Integrate with schedulers or serverless jobs where HTTP fits better than persistent sockets.

Endpoint overview#

  • Path: POST /api/pipelines/process
  • Auth: Authorization: Bearer <access_token>
  • Pipeline: provided per request in the pipeline form part
  • Input data: uploaded as a second form part (data)
  • Async mode: append ?async=true to process large jobs asynchronously (you’ll receive a 202 ACCEPTED with a status URL)

Requests use multipart/form-data so you can send JSON metadata and binary payloads together.

curl --fail --location \\  --request POST "$TRUEBAR_API_BASE_URL/api/pipelines/process" \\  --header "Authorization: Bearer $TRUEBAR_ACCESS_TOKEN" \\  --form 'pipeline=@pipeline.json;type=application/json' \\  --form 'data=@sample.pcm;type=application/octet-stream'

pipeline.json contains the same stage definition you would send to the streaming API.

pipeline.json
[  {    "task": "ASR",    "exceptionHandlingPolicy": "THROW",    "config": {      "tag": "KALDI:sl-SI:COL:20221208-0800",      "parameters": { "enableInterims": false }    }  },  {    "task": "NLP_pc",    "exceptionHandlingPolicy": "SKIP",    "config": {      "tag": "NEMO_PUNCTUATOR:sl-SI:*:*",      "parameters": { "enableSplitToSentences": true }    }  }]

Text payload schema#

Text-based pipelines expect a JSON array of text segments. Each segment wraps one or more tokens; at minimum you must supply the token text.

[  {    "isFinal": true,    "startTimeMs": 0,    "endTimeMs": 1500,    "tokens": [      { "text": "Danes" },      { "text": "je" },      { "text": "lep" },      { "text": "dan" },      { "text": ".", "isLeftHanded": true }    ]  }]

Token fields:

  • text (required) – literal text.
  • isLeftHanded / isRightHanded – spacing hints used by the quickstarts.
  • startOffsetMs / endOffsetMs – token-level timings relative to the segment.
  • speakerCode – diarisation speaker label.
  • confidence – probability score returned by ASR/NLP stages.

Segment fields (isFinal, startTimeMs, endTimeMs) are optional unless you need precise alignment metadata.

Audio payloads#

  • Upload audio in the data form field.
  • The server accepts common WAV/FLAC/MP3/MP4 containers; prefer mono 16 kHz PCM for best accuracy.
  • Avoid multi-track media: the decoder does not auto-select an audio stream.
  • For large uploads, enable --compressed in curl or use resumable uploads in your HTTP client.

Response formats#

  • Pipelines ending in text stages (ASR, NLP) return JSON using the same segment structure as above.
  • Pipelines ending in audio stages (TTS) return raw audio bytes (Content-Type: application/octet-stream).
  • On success you’ll receive 200 OK (sync) or 202 ACCEPTED (async); failed jobs include a JSON error object with id, timestamp, and message.

Worked examples#

Punctuation-only text job#

curl --fail --location \  --request POST "$TRUEBAR_API_BASE_URL/api/pipelines/process" \  --header "Authorization: Bearer $TRUEBAR_ACCESS_TOKEN" \  --form 'pipeline=[{"task":"NLP_pc","exceptionHandlingPolicy":"THROW","config":{"tag":"NEMO_PC:sl-SI:*:*","parameters":{"enableSplitToSentences":false}}}];type=application/json' \  --form 'data=[{"tokens":[{"text":"Danes"},{"text":"je"},{"text":"lep"},{"text":"dan"}]}];type=application/json'

Response:

[  {    "isFinal": true,    "tokens": [      { "text": "Danes" },      { "text": "je" },      { "text": "lep" },      { "text": "dan" },      { "text": ".", "isLeftHanded": true }    ]  }]

Speech-to-text audio job#

curl --fail --location \  --request POST "$TRUEBAR_API_BASE_URL/api/pipelines/process" \  --header "Authorization: Bearer $TRUEBAR_ACCESS_TOKEN" \  --form 'pipeline=[{"task":"ASR","exceptionHandlingPolicy":"THROW","config":{"tag":"KALDI:sl-SI:COL:20221208-0800","parameters":{"enableInterims":false,"enableSd":false}}}];type=application/json' \  --form 'data=@sample.wav;type=audio/wav'

The response is a JSON array of text segments. To receive audio instead (e.g., TTS), end the pipeline with a TTS stage; the response body will contain PCM bytes that you can stream to a player or persist as a file.

HTTP responses & errors#

Successful operations return:

  • 200 OK – synchronous job completed with results in the body.
  • 202 ACCEPTED – async job accepted; poll the history API or the URL returned in the Location header.
  • 204 NO_CONTENT – ad-hoc helper endpoints (e.g., deletes) completed successfully.

Common error codes:

  • 400 BAD_REQUEST – malformed multipart payload or invalid pipeline definition.
  • 401 UNAUTHORIZED / 403 FORBIDDEN – missing token or insufficient roles (PIPELINE_OFFLINE_API, STAGE_*).
  • 404 NOT_FOUND – unknown session/job identifier when querying results.
  • 409 CONFLICT – duplicate submission or resource already exists.
  • 415 UNSUPPORTED_MEDIA_TYPE – decoder cannot read the uploaded audio.
  • 500 INTERNAL_SERVER_ERROR – unexpected platform error (contact support with the id from the response body).
Error response shape
{  "id": "b7f1c8c0-3a4b-4d9b-8d2e-f2b9f8a6c1de",  "timestamp": "2024-04-22T08:15:30.123Z",  "message": "Pipeline tag KALDI:sl-SI:COL:20221208-0800 not available for this tenant."}

Related guides#