Skip to Content
GuidesTranscription Workflow

Transcription Workflow

Understanding the asynchronous transcription process helps you build robust integrations with the IdentityCall API.

How Transcription Works

  1. Upload: Audio file is received and validated
  2. Pending: Recording is queued for processing
  3. Processing: AI transcription and analysis in progress
  4. Completed: Results are ready to retrieve
  5. Failed: An error occurred (rare)

Processing Times

Recording LengthTypical Processing Time
1-5 minutes30-60 seconds
5-15 minutes1-3 minutes
15-30 minutes3-5 minutes
30-60 minutes5-10 minutes

Processing time depends on audio length, quality, and current system load.

Polling for Status

The simplest approach is to poll the recording status:

import requests import time def wait_for_transcription(recording_id, api_key, timeout=600, interval=5): """ Wait for transcription to complete. Args: recording_id: Recording ID to check api_key: API key for authentication timeout: Maximum wait time in seconds interval: Poll interval in seconds Returns: Recording data when complete Raises: TimeoutError: If transcription doesn't complete in time RuntimeError: If transcription fails """ base_url = "https://api.identitycall.com/api/v1/public" headers = {"Authorization": f"Bearer {api_key}"} start_time = time.time() while True: response = requests.get( f"{base_url}/recordings/{recording_id}", headers=headers ) recording = response.json()["data"] status = recording["status"] if status == "completed": return recording if status == "failed": raise RuntimeError("Transcription failed") if time.time() - start_time > timeout: raise TimeoutError("Transcription timed out") print(f"Status: {status}, waiting {interval}s...") time.sleep(interval) # Usage recording_id = 123 api_key = os.environ.get("IDENTITYCALL_API_KEY") try: recording = wait_for_transcription(recording_id, api_key) print(f"Transcription complete! Duration: {recording['duration_ms']}ms") except TimeoutError: print("Transcription is taking too long") except RuntimeError as e: print(f"Error: {e}")

Optimizing Poll Intervals

Use exponential backoff to reduce API calls:

def get_poll_interval(elapsed_seconds): """ Return poll interval based on elapsed time. Start fast, slow down over time. """ if elapsed_seconds < 30: return 2 # Every 2 seconds for first 30s elif elapsed_seconds < 120: return 5 # Every 5 seconds up to 2 minutes elif elapsed_seconds < 300: return 10 # Every 10 seconds up to 5 minutes else: return 30 # Every 30 seconds after 5 minutes

Complete Workflow Example

import requests import os import time API_KEY = os.environ.get("IDENTITYCALL_API_KEY") BASE_URL = "https://api.identitycall.com/api/v1/public" def transcribe_audio(file_path, language="en"): """ Complete workflow: upload, wait, and retrieve transcription. """ headers = {"Authorization": f"Bearer {API_KEY}"} # Step 1: Upload print(f"Uploading {file_path}...") with open(file_path, "rb") as f: response = requests.post( f"{BASE_URL}/recordings", headers=headers, files={"file": f}, data={"language": language} ) if response.status_code != 201: raise Exception(f"Upload failed: {response.json()}") recording_id = response.json()["data"]["id"] print(f"Uploaded! Recording ID: {recording_id}") # Step 2: Wait for completion print("Processing...") start_time = time.time() while True: response = requests.get( f"{BASE_URL}/recordings/{recording_id}", headers=headers ) status = response.json()["data"]["status"] if status == "completed": elapsed = time.time() - start_time print(f"Completed in {elapsed:.1f}s") break elif status == "failed": raise Exception("Transcription failed") time.sleep(5) # Step 3: Get transcription response = requests.get( f"{BASE_URL}/recordings/{recording_id}/transcription", headers=headers ) return response.json()["data"] # Usage transcription = transcribe_audio("customer-call.mp3") print(f"\nTranscript:\n{transcription['full_text']}")

Next Steps