import os
from sarj_platform_sdk import SDK
with SDK(api_key_auth=os.environ["SARJ_API_KEY"], timeout_ms=10_000) as sdk:
res = sdk.calls.get_call(call_id=os.environ["SARJ_CALL_ID"])
call = res.data
print(f"Status: {call.status}, duration: {call.duration}"){
"data": {
"id": "8f9b2c1e-4a5d-4f6e-8b1a-2c3d4e5f6a7b",
"status": "completed",
"phone_number": "+966512345678",
"scenario_id": "550e8400-e29b-41d4-a716-446655440000",
"language": "ar",
"direction": "outbound",
"variables": {
"customer_name": "Ahmad",
"order_id": "ORD-123"
},
"duration": 142,
"permanent_recording_url": "https://platform-api.sarj.ai/api/v1/calls/8f9b2c1e-4a5d-4f6e-8b1a-2c3d4e5f6a7b/recording",
"transcript": [
{
"role": "assistant",
"content": "Hello Ahmad, calling about order ORD-123."
},
{
"role": "user",
"content": "Yes, hi."
},
{
"role": "assistant",
"content": "Your order is ready for delivery tomorrow."
}
],
"report": {
"generated_at": "2026-04-12T10:33:41Z",
"outcome": {
"status": "success",
"reason": "The customer confirmed the delivery appointment for tomorrow.",
"success_criteria": [
{
"text": "Customer confirms the delivery slot",
"achieved": true,
"is_primary": true
}
]
}
},
"created_at": "2026-04-12T10:30:00Z",
"updated_at": "2026-04-12T10:32:22Z",
"started_at": "2026-04-12T10:30:05Z",
"ended_at": "2026-04-12T10:32:22Z"
},
"meta": {
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"type": "unauthorized",
"message": "Authentication required."
},
"meta": {}
}{
"error": {
"type": "no_organization",
"message": "API key is not associated with an organization."
},
"meta": {
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"type": "call_not_found",
"message": "Call 8f9b2c1e-4a5d-4f6e-8b1a-2c3d4e5f6a7b was not found.",
"call_id": "8f9b2c1e-4a5d-4f6e-8b1a-2c3d4e5f6a7b"
},
"meta": {
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"message": "<string>",
"type": "validation_error",
"field_violations": [
{
"field": "phone_number.country_code",
"message": "Must start with +"
}
]
},
"meta": {
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}Calls
Get a call
Get a call’s details and latest outcome.
GET
/
calls
/
{call_id}
import os
from sarj_platform_sdk import SDK
with SDK(api_key_auth=os.environ["SARJ_API_KEY"], timeout_ms=10_000) as sdk:
res = sdk.calls.get_call(call_id=os.environ["SARJ_CALL_ID"])
call = res.data
print(f"Status: {call.status}, duration: {call.duration}"){
"data": {
"id": "8f9b2c1e-4a5d-4f6e-8b1a-2c3d4e5f6a7b",
"status": "completed",
"phone_number": "+966512345678",
"scenario_id": "550e8400-e29b-41d4-a716-446655440000",
"language": "ar",
"direction": "outbound",
"variables": {
"customer_name": "Ahmad",
"order_id": "ORD-123"
},
"duration": 142,
"permanent_recording_url": "https://platform-api.sarj.ai/api/v1/calls/8f9b2c1e-4a5d-4f6e-8b1a-2c3d4e5f6a7b/recording",
"transcript": [
{
"role": "assistant",
"content": "Hello Ahmad, calling about order ORD-123."
},
{
"role": "user",
"content": "Yes, hi."
},
{
"role": "assistant",
"content": "Your order is ready for delivery tomorrow."
}
],
"report": {
"generated_at": "2026-04-12T10:33:41Z",
"outcome": {
"status": "success",
"reason": "The customer confirmed the delivery appointment for tomorrow.",
"success_criteria": [
{
"text": "Customer confirms the delivery slot",
"achieved": true,
"is_primary": true
}
]
}
},
"created_at": "2026-04-12T10:30:00Z",
"updated_at": "2026-04-12T10:32:22Z",
"started_at": "2026-04-12T10:30:05Z",
"ended_at": "2026-04-12T10:32:22Z"
},
"meta": {
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"type": "unauthorized",
"message": "Authentication required."
},
"meta": {}
}{
"error": {
"type": "no_organization",
"message": "API key is not associated with an organization."
},
"meta": {
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"type": "call_not_found",
"message": "Call 8f9b2c1e-4a5d-4f6e-8b1a-2c3d4e5f6a7b was not found.",
"call_id": "8f9b2c1e-4a5d-4f6e-8b1a-2c3d4e5f6a7b"
},
"meta": {
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"message": "<string>",
"type": "validation_error",
"field_violations": [
{
"field": "phone_number.country_code",
"message": "Must start with +"
}
]
},
"meta": {
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}
