API process flow
Init Protocol Multi
Init Protocol Multi
Use initProtocolMulti when a single session consists of multiple audio files — for example, a recording split into parts. All files are processed together as a single session.
This mutation is identical to initProtocol with two differences:
- It accepts
uniqueObjNames: [String!]!(a list) instead of a singleuniqueObjName. - The protocol slug is derived from
uniqueObjNames[0].
Call getUploadUrl once per file, upload each to S3, then call initProtocolMulti with all names in one request.
Input Parameters
uniqueObjNames([String!]!) — One entry per uploaded file. The first entry is used to derive the protocol slug.name(String!) — Name or title of the protocol.date(Date!) — Date the session took place.language(String!) — Language code. Supported values:"de-DE","de-CH","de-AT","en-EN".typeOfDocument(String!) —"summary"or"politics".projectSlug(String!) — Slug of the target project.addressConfig(AddressConfigInput) — Optional. Controls which speaker name fields appear in the generated output. All fields default totrueif omitted. Fields:gender,givenName,familyName,preTitle,postTitle,party,posLong,posShort.speakerList([PersonInputList]) — Optional pre-defined speaker list.agendaItemList([AgendaItemListInput]) — Optional agenda items.
GraphQL Mutation
fragment protocolDetails on ApiProtocolType {
slug
name
status
date
language
empty
creatingStep
renamedSpeakers
}
mutation InitProtocolMulti(
$uniqueObjNames: [String!]!
$projectSlug: String!
$name: String!
$date: Date!
$language: String!
$typeOfDocument: String!
$addressConfig: AddressConfigInput
$agendaItemList: [AgendaItemListInput]
$speakerList: [PersonInputList]
) {
initProtocolMulti(
uniqueObjNames: $uniqueObjNames
projectSlug: $projectSlug
name: $name
date: $date
language: $language
typeOfDocument: $typeOfDocument
addressConfig: $addressConfig
agendaItemList: $agendaItemList
speakerList: $speakerList
) {
success
protocol {
...protocolDetails
}
}
}
Mutation Variables
{
"uniqueObjNames": ["part1_abc123def456ghi789jkl012", "part2_mno345pqr678stu901vwx234"],
"projectSlug": "my-project",
"name": "Stadtratssitzung 2024-03-18",
"date": "2024-03-18",
"language": "de-DE",
"typeOfDocument": "politics",
"addressConfig": {
"gender": true,
"givenName": true,
"familyName": true,
"preTitle": true,
"postTitle": false,
"party": true,
"posLong": true,
"posShort": false
},
"agendaItemList": [
{ "title": "TOP 1", "systemId": "top-1", "startTime": "" },
{ "title": "TOP 2", "systemId": "top-2", "startTime": "" }
]
}
Example JavaScript Implementation
import axios from "axios";
async function initProtocolMulti(session, uniqueObjNames) {
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_MULTI,
variables: {
uniqueObjNames,
projectSlug: session.projectSlug,
name: session.name,
date: session.date,
language: session.language,
typeOfDocument: session.typeOfDocument,
addressConfig: session.addressConfig,
agendaItemList: session.agendaItemList,
speakerList: session.speakerList,
},
}),
});
console.log("Multi-file protocol created:", res.data.data.initProtocolMulti.protocol);
}
Notes
- Each
uniqueObjNamemust match the key used for that file’s S3 upload. - The order of
uniqueObjNamesdetermines the order the audio files are stitched together for processing. - After calling this mutation, poll
getProtocolBySluguntilstatusistruebefore proceeding.
Have questions?
Still have questions? Talk to support.