Scriptix API Documentation

website·Indexed 33 days ago

https://apidocs.scriptix.io/

API documentation for Scriptix Speech-to-Text services, featuring Realtime WebSocket interfaces for media streams, asynchronous Batch transcription via TUS and legacy upload protocols, and custom language model training. Includes endpoints for document management (BETA), translation, and reseller tools for automated customer management.

Tokens
20K
Snippets
103
Records
154
Agent score
56%

What's inside Scriptix

  1. Overview of Scriptix Realtime Speech-to-Text API

    The Scriptix Speech-to-text real-time API provides a WebSocket interface for processing media streams in real-time. Because WebSocket connections are asynchronous, implementation typically requires the use of coroutines or threads to achieve optimal results.
  2. Overview of Scriptix Realtime Speech-to-Text API

    The Scriptix Speech-to-text real-time API provides a WebSocket interface for processing media streams in real-time. Because WebSocket connections are asynchronous, implementation typically requires the use of coroutines or threads for optimal performance. This interface is more complex to implement than the Scriptix batch API.
  3. Understand Scriptix Documents and their types

    Documents in Scriptix are segmented representations of transcript session context designed specifically for modification. They are currently in BETA, and the API interface may change.

    There are two primary types of documents:

    1. Captions: Optimized for subtitling; these are supported by an online editor.
    2. Transcripts: Used as regular text documents.

    Currently, documents can only be created from batch sessions, as results for real-time sessions are not stored.

  4. Handle final transcription results

    Final results are emitted when the engine is confident about a segment, typically after approximately 15 words or 30 seconds of accumulated audio. These results are immutable. The is_final field is always true.
    {
      "text": "hi how are you doing today",
      "is_final": true,
      "offset_ms": 1234,
      "words": [
        [" hi", 0, 200, 0.95],
        [" how", 200, 400, 0.92],
        [" are", 400, 600, 0.94],
        [" you", 600, 800, 0.91],
        [" doing", 800, 1000, 0.93],
        [" today", 1000, 1300, 0.96]
      ]
    }

    Fields:

    • text (string): Finalized transcription text.
    • is_final (boolean): Always true.
    • offset_ms (integer): Position in audio stream in milliseconds.
    • words (array): Word-level timestamps in the format [word, start_ms, end_ms, confidence].
  5. Choose between Scriptix Batch and Realtime Speech-to-Text APIs

    Scriptix provides two primary integration methods for Speech-to-Text depending on the data source and latency requirements:

    1. Batch API: Best for processing uploaded files. It uses a JSON API over HTTPS and supports advanced features like speaker diarization, punctuation, and exporting results in subtitle formats.
    2. Realtime API: Best for processing live audio streams where immediate results are required. It uses WebSockets over HTTPS. Note that for Realtime, response speed is prioritized over quality, and results are not stored by Scriptix.
  6. Optimize audio chunk size for response time and quality

    To balance response latency and transcription quality in Scriptix Realtime sessions, adjust the size of audio data chunks sent to the API. Smaller chunks reduce response time but may lower quality due to reduced contextual awareness; larger chunks improve quality but increase latency. Scriptix recommends sending chunks between 8KB and 64KB. For 16Khz PCM Wave audio, 1 second of audio equals 32KB of data.
  7. Configure Scriptix Webhook callback URLs

    Webhook callbacks are triggered when a document undergoes a state change (Create, Update, or Delete). To be valid, the callback URL must meet the following requirements:

    • Must use HTTPS
    • Cannot be localhost or localdomain
    • Cannot be a raw IP address (IPv4 or IPv6)
    • Must be publicly resolvable by the Scriptix API (no internal/local domains)
  8. Upload media files using the TUS protocol

    Scriptix uses the TUS protocol for resumable uploads of media and alignment files. To upload files, you must use a TUS-compliant client configured to the Scriptix endpoint. The TUS client handles the file transfer, while the Scriptix API processes the uploaded content.
    TUS Endpoint: https://api.scriptix.io/api/v3/files/```
    
  9. Encode audio streams for Scriptix Realtime API

    All audio streams sent to the Scriptix API must be encoded as PCM WAVE, 16khz mono. You can use FFmpeg to convert input files or streams to this format. The command supports both file-based conversion and piping via stdin/stdout by using the - character for input and output files.
    ffmpeg -y -i "${input_file}" \
        -ac 1 -acodec pcm_s16le -ar 16000 \
        -f wav "${output_file}"
  10. Retrieve speech-to-text results using a session ID

    To retrieve transcription results, you must perform a two-step process. First, obtain the session_id by querying the file metadata using the file ID returned from the TUS upload completion. Second, use that session_id to request the final results.

    Important: You must use the same API token for retrieval that was used to create and upload the file.

    # Step 1: Get the session_id from file metadata
    curl -X GET "https://api.scriptix.io/api/v3/files/{fileId}" \
         -H "x-zoom-s2t-key: YOUR_BATCH_API_TOKEN"
    
    # Step 2: Get the transcription results using the session_id
    curl -X GET "https://api.scriptix.io/api/v3/speech-to-text/session/{sessionId}/result" \
         -H "x-zoom-s2t-key: YOUR_BATCH_API_TOKEN"
  11. Encode audio streams for Scriptix API

    All audio streams sent to the Scriptix API must be encoded as PCM WAVE, 16khz mono. You can use FFmpeg to convert your input files to this required format.
    ffmpeg -y -i "${input_file}" \
        -ac 1 -acodec pcm_s16le -ar 16000 \
        -f wav "${output_file}"