menu button

API process flow

Init Protocol

Init Protocol

After uploading a file to S3, use the initProtocol mutation to register it in the system and start processing. The uniqueObjName from the getUploadUrl step is required here — it links the uploaded file to this protocol.


Input Parameters

  • name (String!) — Name or title of the protocol.
  • date (Date!) — Date the recording took place, e.g. "2025-11-20".
  • language (String!) — Language code of the audio. Supported values: "de-DE", "de-CH", "de-AT", "en-EN".
  • typeOfDocument (String!) — "summary" or "politics".
  • uniqueObjName (String!) — The S3 object key from getUploadUrl. Must be unique — use a 30-character random alphanumeric string ending with the file extension.
  • projectSlug (String!) — Slug of the target project from getAllProjects or createProject.
  • speakerList ([PersonInputList]) — Optional. Pre-defined list of speakers. Each entry has gender, givenName, familyName, party, preTitle, postTitle, systemId.
  • agendaItemList ([AgendaItemListInput]) — Optional. Each entry has title, systemId, and optionally startTime (timestamp to pin the item to a position in the audio).

To generate a valid uniqueObjName:

function generateRandomId(length) {
  const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  let id = "";
  for (let i = 0; i < length; i++) {
    id += charset.charAt(Math.floor(Math.random() * charset.length));
  }
  return id;
}
// Example: generateRandomId(30) + ".ogg"

GraphQL Mutation

fragment protocolDetails on ApiProtocolType {
  slug
  name
  status
  date
  language
  empty
  creatingStep
  renamedSpeakers
}

mutation InitProtocol(
  $date: Date!
  $name: String!
  $agendaItemList: [AgendaItemListInput]
  $speakerList: [PersonInputList]
  $projectSlug: String!
  $language: String!
  $uniqueObjName: String!
  $typeOfDocument: String!
) {
  initProtocol(
    name: $name
    date: $date
    language: $language
    typeOfDocument: $typeOfDocument
    agendaItemList: $agendaItemList
    speakerList: $speakerList
    uniqueObjName: $uniqueObjName
    projectSlug: $projectSlug
  ) {
    success
    protocol {
      ...protocolDetails
    }
  }
}

Mutation Variables

{
  "name": "Testprotokoll",
  "date": "2025-11-20",
  "language": "de-DE",
  "typeOfDocument": "politics",
  "uniqueObjName": "UNIQUE_OBJ_NAME",
  "projectSlug": "PROJECT_SLUG",
  "speakerList": [
    { "gender": "m", "givenName": "Thomas", "familyName": "Müller", "party": "", "preTitle": "", "postTitle": "", "systemId": "" },
    { "gender": "w", "givenName": "Maxi", "familyName": "Musterfrau", "party": "", "preTitle": "", "postTitle": "", "systemId": "" }
  ],
  "agendaItemList": [
    { "title": "TOP 1", "systemId": "1", "startTime": "" },
    { "title": "Agenda Point 2", "systemId": "2", "startTime": "" }
  ]
}

Example JavaScript Implementation

import axios from "axios";

async function initProtocol(audioItem, uniqueObjName) {
  const res = await axios({
    method: "POST",
    url: "https://api-v2.speechmind.com/external/v2/graphql",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": process.env.SPEECHMIND_API_KEY,
    },
    data: JSON.stringify({
      query: INIT_PROTOCOL,
      variables: {
        date: audioItem.date,
        name: audioItem.name,
        agendaItemList: audioItem.agendaItemList,
        speakerList: audioItem.speakerList,
        projectSlug: audioItem.projectSlug,
        language: audioItem.language,
        uniqueObjName: uniqueObjName,
        typeOfDocument: audioItem.typeOfDocument,
      },
    }),
  });

  console.log("Protocol created:", res.data.data.initProtocol.protocol);
}

Notes

  • name has a maximum length of 200 characters.
  • The uniqueObjName must exactly match the key used during the S3 upload — this is how the system locates the file.
  • Use typeOfDocument: "summary" for standard meeting notes (1 depth level). Use "politics" for structured council meetings with 3 depth levels and resolution detection.
  • After calling this mutation, poll getProtocolBySlug until status is true before proceeding.

Have questions?

Still have questions? Talk to support.