menu button

Chapter 3: Edit and Save Document

Get Transcript by Start and End Id

Fetch transcript textsegments between two textsegment ids, including speaker metadata and timestamps.


Use this API to fetch transcript textsegments between a start and an end id. The response includes speaker metadata and timestamps for each textsegment.

export const GET_TRANSCRIPT_BY_START_END_ID = `
    fragment textsegmentDetails on ApiTextsegmentTypeWithSpeaker {
        id
        speakerObj {
            gender
            givenName
            familyName
            posLong
            posShort
            postTitel
            preTitel
            party
            specialCase
        }
        textJson {
            startTime
            endTime
            text
        }
        pos
    }

    query GetTranscriptByStartEndId($startId:String!, $endId:String){
        getTranscriptByStartEndId(startId:$startId, endId:$endId){
            ...textsegmentDetails
        }
    }
`;

Usage notes:

  • startId (required): id of the first textsegment to include.
  • endId (optional): id of the last textsegment to include; when omitted the API returns from startId to the end of the protocol.

The returned ApiTextsegmentTypeWithSpeaker contains speakerObj with name/position metadata and textJson with timestamps and the transcribed text.

JavaScript example

import axios from "axios";

async function getTranscriptByStartEndId(startId, endId = null) {
    const dataObj = {
        query: GET_TRANSCRIPT_BY_START_END_ID,
        variables: { startId, endId },
    };

    try {
        const response = await axios({
            method: "post",
            url: process.env.VUE_APP_GRAPHQL_API,
            data: JSON.stringify(dataObj),
            headers: {
                "Content-Type": "application/json",
                "x-api-key": process.env.VUE_APP_API_KEY,
            },
        });

        const textsegments = response.data.data.getTranscriptByStartEndId;
        // textsegments is an array of ApiTextsegmentTypeWithSpeaker
        return textsegments;
    } catch (error) {
        console.error(error);
        throw error;
    }
}

Have questions?

Still have questions? Talk to support.