Skip to Content

SDK Setup

While the IdentityCall API can be used directly with HTTP requests, we recommend using our language-specific patterns for the best developer experience.

Python

Installation

pip install requests

Configuration

Create a reusable client:

identitycall.py
import os import requests from typing import Optional, Dict, Any class IdentityCallClient: """Simple client for the IdentityCall API.""" BASE_URL = "https://api.identitycall.com/api/v1/public" def __init__(self, api_key: Optional[str] = None): self.api_key = api_key or os.environ.get("IDENTITYCALL_API_KEY") if not self.api_key: raise ValueError("API key is required") @property def _headers(self) -> Dict[str, str]: return {"Authorization": f"Bearer {self.api_key}"} def list_recordings(self, page: int = 1, per_page: int = 20) -> Dict[str, Any]: """List recordings with pagination.""" response = requests.get( f"{self.BASE_URL}/recordings", headers=self._headers, params={"page": page, "per_page": per_page} ) response.raise_for_status() return response.json() def get_recording(self, recording_id: int) -> Dict[str, Any]: """Get a recording by ID.""" response = requests.get( f"{self.BASE_URL}/recordings/{recording_id}", headers=self._headers ) response.raise_for_status() return response.json() def upload_recording( self, file_path: str, language: str = "en", name: Optional[str] = None ) -> Dict[str, Any]: """Upload a recording for transcription.""" with open(file_path, "rb") as f: data = {"language": language} if name: data["name"] = name response = requests.post( f"{self.BASE_URL}/recordings", headers=self._headers, files={"file": f}, data=data ) response.raise_for_status() return response.json() def get_transcription(self, recording_id: int) -> Dict[str, Any]: """Get transcription for a recording.""" response = requests.get( f"{self.BASE_URL}/recordings/{recording_id}/transcription", headers=self._headers ) response.raise_for_status() return response.json() def get_results(self, recording_id: int) -> Dict[str, Any]: """Get analysis results for a recording.""" response = requests.get( f"{self.BASE_URL}/recordings/{recording_id}/results", headers=self._headers ) response.raise_for_status() return response.json() def get_summary(self, recording_id: int) -> Dict[str, Any]: """Get summary for a recording.""" response = requests.get( f"{self.BASE_URL}/recordings/{recording_id}/summary", headers=self._headers ) response.raise_for_status() return response.json()

Usage

from identitycall import IdentityCallClient # Initialize client client = IdentityCallClient() # Upload a recording result = client.upload_recording("call.mp3", language="en", name="Sales Call") recording_id = result["data"]["id"] # Get transcription transcription = client.get_transcription(recording_id) print(transcription["data"]["full_text"])

Node.js

Installation

npm install node-fetch form-data

Configuration

identitycall.js
const fs = require('fs'); const FormData = require('form-data'); class IdentityCallClient { constructor(apiKey) { this.apiKey = apiKey || process.env.IDENTITYCALL_API_KEY; this.baseUrl = 'https://api.identitycall.com/api/v1/public'; if (!this.apiKey) { throw new Error('API key is required'); } } get headers() { return { 'Authorization': `Bearer ${this.apiKey}` }; } async request(method, path, options = {}) { const url = `${this.baseUrl}${path}`; const response = await fetch(url, { method, headers: { ...this.headers, ...options.headers }, body: options.body }); if (!response.ok) { const error = await response.json(); throw new Error(error.error || 'Request failed'); } return response.json(); } async listRecordings(page = 1, perPage = 20) { return this.request('GET', `/recordings?page=${page}&per_page=${perPage}`); } async getRecording(recordingId) { return this.request('GET', `/recordings/${recordingId}`); } async uploadRecording(filePath, language = 'en', name = null) { const formData = new FormData(); formData.append('file', fs.createReadStream(filePath)); formData.append('language', language); if (name) formData.append('name', name); const url = `${this.baseUrl}/recordings`; const response = await fetch(url, { method: 'POST', headers: { 'Authorization': `Bearer ${this.apiKey}` }, body: formData }); if (!response.ok) { const error = await response.json(); throw new Error(error.error || 'Upload failed'); } return response.json(); } async getTranscription(recordingId) { return this.request('GET', `/recordings/${recordingId}/transcription`); } async getResults(recordingId) { return this.request('GET', `/recordings/${recordingId}/results`); } async getSummary(recordingId) { return this.request('GET', `/recordings/${recordingId}/summary`); } } module.exports = { IdentityCallClient };

Usage

const { IdentityCallClient } = require('./identitycall'); const client = new IdentityCallClient(); // Upload a recording const result = await client.uploadRecording('call.mp3', 'en', 'Sales Call'); const recordingId = result.data.id; // Get transcription const transcription = await client.getTranscription(recordingId); console.log(transcription.data.full_text);

PHP

Configuration

IdentityCallClient.php
<?php class IdentityCallClient { private string $apiKey; private string $baseUrl = 'https://api.identitycall.com/api/v1/public'; public function __construct(?string $apiKey = null) { $this->apiKey = $apiKey ?? getenv('IDENTITYCALL_API_KEY'); if (!$this->apiKey) { throw new InvalidArgumentException('API key is required'); } } private function request(string $method, string $path, array $options = []): array { $ch = curl_init(); $url = $this->baseUrl . $path; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Authorization: Bearer {$this->apiKey}" ]); if ($method === 'POST') { curl_setopt($ch, CURLOPT_POST, true); if (isset($options['postFields'])) { curl_setopt($ch, CURLOPT_POSTFIELDS, $options['postFields']); } } elseif ($method === 'DELETE') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); } elseif ($method === 'PATCH') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH'); if (isset($options['postFields'])) { curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($options['postFields'])); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Authorization: Bearer {$this->apiKey}", "Content-Type: application/json" ]); } } $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode >= 400) { $error = json_decode($response, true); throw new RuntimeException($error['error'] ?? 'Request failed'); } return json_decode($response, true); } public function listRecordings(int $page = 1, int $perPage = 20): array { return $this->request('GET', "/recordings?page={$page}&per_page={$perPage}"); } public function getRecording(int $recordingId): array { return $this->request('GET', "/recordings/{$recordingId}"); } public function uploadRecording(string $filePath, string $language = 'en', ?string $name = null): array { $postFields = [ 'file' => new CURLFile($filePath), 'language' => $language ]; if ($name) { $postFields['name'] = $name; } return $this->request('POST', '/recordings', ['postFields' => $postFields]); } public function getTranscription(int $recordingId): array { return $this->request('GET', "/recordings/{$recordingId}/transcription"); } public function getResults(int $recordingId): array { return $this->request('GET', "/recordings/{$recordingId}/results"); } public function getSummary(int $recordingId): array { return $this->request('GET', "/recordings/{$recordingId}/summary"); } }

Usage

<?php require_once 'IdentityCallClient.php'; $client = new IdentityCallClient(); // Upload a recording $result = $client->uploadRecording('call.mp3', 'en', 'Sales Call'); $recordingId = $result['data']['id']; // Get transcription $transcription = $client->getTranscription($recordingId); echo $transcription['data']['full_text'];

Ruby

Installation

gem install httparty

Configuration

identitycall.rb
require 'httparty' require 'json' class IdentityCallClient BASE_URL = 'https://api.identitycall.com/api/v1/public'.freeze def initialize(api_key = nil) @api_key = api_key || ENV['IDENTITYCALL_API_KEY'] raise ArgumentError, 'API key is required' unless @api_key end def list_recordings(page: 1, per_page: 20) request(:get, '/recordings', query: { page: page, per_page: per_page }) end def get_recording(recording_id) request(:get, "/recordings/#{recording_id}") end def upload_recording(file_path, language: 'en', name: nil) body = { file: File.open(file_path), language: language } body[:name] = name if name HTTParty.post( "#{BASE_URL}/recordings", headers: { 'Authorization' => "Bearer #{@api_key}" }, multipart: true, body: body ).parsed_response end def get_transcription(recording_id) request(:get, "/recordings/#{recording_id}/transcription") end def get_results(recording_id) request(:get, "/recordings/#{recording_id}/results") end def get_summary(recording_id) request(:get, "/recordings/#{recording_id}/summary") end private def request(method, path, options = {}) response = HTTParty.send( method, "#{BASE_URL}#{path}", headers: { 'Authorization' => "Bearer #{@api_key}" }, **options ) raise response['error'] if response.code >= 400 response.parsed_response end end

Usage

require_relative 'identitycall' client = IdentityCallClient.new # Upload a recording result = client.upload_recording('call.mp3', language: 'en', name: 'Sales Call') recording_id = result['data']['id'] # Get transcription transcription = client.get_transcription(recording_id) puts transcription['data']['full_text']

Environment Variables

All clients support loading the API key from environment variables:

VariableDescription
IDENTITYCALL_API_KEYYour API key

Set this in your shell or .env file:

export IDENTITYCALL_API_KEY="idc_your_api_key_here"

Next Steps