Thisbit VoiceStudio engine

THISBIT VOICE & TRANSCRIPTS / DOCUMENTATION

Upload and transcribe

Create a recording, upload checked audio chunks, request transcription, then poll for the result. Finishing an upload and starting processing are separate operations.

Implemented audio API. This walkthrough assumes an approved Entra client, project write access and an enrolled device with active entitlement. It is not a general backend API-key flow. For an operator-delegated backend credential, hosted microphone recording, live events and completion notifications, use recording sessions.

Before the first call

Use your deployment’s HTTPS addresses as STUDIO_CONTROL_URL and STUDIO_CUSTOMER_URL, without a trailing slash. Obtain separate delegated tokens as STUDIO_CONTROL_TOKEN and STUDIO_CUSTOMER_TOKEN. Never send one token to the other API.

The examples use curl, jq, Python 3 and a valid, synthetic M4A file named sample.m4a of at most 4 MiB. Run in a private scratch directory outside Git. Set WORKSPACE_ID, PROJECT_ID and DEVICE_ID to your verified workspace, writable project and enrolled device. UUIDs are lowercase. Keep the chosen identifiers and request files if a reply is lost.

1. Create the upload

POST /v1/uploads · customer API

Choose UPLOAD_ID once for this recording. original holds the original capture metadata and live text. Keep its shape intact on retries; it will not be overwritten by refinement.

# Run once for this recording; reuse upload.json on a retry.
UPLOAD_ID=$(python3 -c 'import uuid; print(uuid.uuid4())')
jq -n --arg project "$PROJECT_ID" --arg upload "$UPLOAD_ID" \
  '{project_id:$project, upload_id:$upload, title:"Synthetic example",
    original:{text:"Synthetic live text"}, private:true}' > upload.json

curl --fail-with-body -sS "$STUDIO_CUSTOMER_URL/v1/uploads" \
  -H "Authorization: Bearer $STUDIO_CUSTOMER_TOKEN" \
  -H 'Content-Type: application/json' --data-binary @upload.json \
  -o recording.json
CONVERSATION_ID=$(jq -er '.id' recording.json)

Success is 200 with the recording object; its id equals your upload ID and its initial state is uploading. All following capture routes use this conversation ID.

2. Upload the audio

PUT /v1/uploads/{conversation_id}/chunks/{index} · customer API

CHUNK_SHA256=$(python3 -c 'import hashlib; print(hashlib.sha256(open("sample.m4a","rb").read()).hexdigest())')
curl --fail-with-body -sS \
  "$STUDIO_CUSTOMER_URL/v1/uploads/$CONVERSATION_ID/chunks/0" \
  -X PUT -H "Authorization: Bearer $STUDIO_CUSTOMER_TOKEN" \
  -H 'Content-Type: application/octet-stream' \
  -H "X-Content-SHA256: $CHUNK_SHA256" --data-binary @sample.m4a

Success is 200 with {"index":0,"sha256":"…"}. For larger audio, split the original file into consecutive binary chunks of at most 4 MiB and upload indices 0–63. The worker reassembles the bytes in manifest order; these are file chunks, not independently encoded audio clips.

3. Finish the upload

POST /v1/uploads/{conversation_id}/finish · customer API

jq -n --arg sha "$CHUNK_SHA256" '{manifest:[$sha]}' > manifest.json
curl --fail-with-body -sS \
  "$STUDIO_CUSTOMER_URL/v1/uploads/$CONVERSATION_ID/finish" \
  -H "Authorization: Bearer $STUDIO_CUSTOMER_TOKEN" \
  -H 'Content-Type: application/json' --data-binary @manifest.json

For multiple chunks, include every digest in index order. Success is 200 with state: uploaded. Repeating the same manifest is safe. New or changed original chunks are refused after finalization.

4. Authorize processing on control

POST /v1/workspaces/{workspace_id}/challenges · control API

# Run once for a new processing pass; reuse payload.json for retries.
OPERATION_ID=$(python3 -c 'import uuid; print(uuid.uuid4())')
jq -n --arg conversation "$CONVERSATION_ID" --arg operation "$OPERATION_ID" \
  '{conversation_id:$conversation, operation_id:$operation,
    language_profile:"en-US"}' > payload.json
jq -n --arg device "$DEVICE_ID" --slurpfile payload payload.json \
  '{device_id:$device, action:"process", payload:$payload[0]}' > challenge-request.json

curl --fail-with-body -sS \
  "$STUDIO_CONTROL_URL/v1/workspaces/$WORKSPACE_ID/challenges" \
  -H "Authorization: Bearer $STUDIO_CONTROL_TOKEN" \
  -H 'Content-Type: application/json' --data-binary @challenge-request.json \
  -o challenge.json

Sign the returned challenge within 120 seconds using the enrolled device’s private key and the device proof contract. Have the device signer return the compact token as DEVICE_PROOF. There is deliberately no key generation or enrollment shortcut in this example: a new arbitrary key does not prove ownership of the enrolled device.

5. Request transcription

POST /v1/jobs · customer API

jq -n --arg device "$DEVICE_ID" --arg proof "$DEVICE_PROOF" \
  --slurpfile payload payload.json --slurpfile challenge challenge.json \
  '{payload:$payload[0], device_id:$device,
    proof:{challenge_id:$challenge[0].id, proof:$proof}}' > job.json
curl --fail-with-body -sS "$STUDIO_CUSTOMER_URL/v1/jobs" \
  -H "Authorization: Bearer $STUDIO_CUSTOMER_TOKEN" \
  -H 'Content-Type: application/json' --data-binary @job.json

Success is 200 with a job ID, conversation_id and state: queued. It is not a completed transcript. On a lost reply, keep the same payload and operation ID, request a fresh challenge and sign again before resubmitting. The server authorizes first, then deduplicates the job; a consumed proof cannot be replayed.

6. Follow the result and export

curl --fail-with-body -sS \
  "$STUDIO_CUSTOMER_URL/v1/conversations/$CONVERSATION_ID" \
  -H "Authorization: Bearer $STUDIO_CUSTOMER_TOKEN"

# Once processing is complete:
curl --fail-with-body -sS \
  "$STUDIO_CUSTOMER_URL/api/conversations/$CONVERSATION_ID/export.md" \
  -H "Authorization: Bearer $STUDIO_CUSTOMER_TOKEN" -o transcript.md
curl --fail-with-body -sS \
  "$STUDIO_CUSTOMER_URL/v1/conversations/$CONVERSATION_ID/audio" \
  -H "Authorization: Bearer $STUDIO_CUSTOMER_TOKEN" -o original.m4a

Poll the conversation ID with backoff while queued or running. A completed recording has state: review and retained results (the job itself becomes complete); failed and revoked need attention. The /v1/…/export route returns recording JSON, while /api/…/export.md and export.vtt return formatted text.

These upload/job routes use polling. The separate capture API offers invokable recording, live streams, signed completion webhooks and an external-session timeline contract.