Call Logs API Integration
Overview
The Call Logs API provides access to user call records including transcripts, summaries, and metadata. This API powers the CDC (Change Data Capture) pipeline that syncs external call data into the Syntropy-Journals health check-in system. The API is Directus-based (REST) and backed by Bland.ai telephony.Base URL
Authentication
Bearer token via theAuthorization header:
CALL_LOGS_API_KEY environment variable.
Endpoints
GET /items/call_logs
Fetch call log records with filtering, sorting, and pagination. Headers:| Header | Value | Required |
|---|---|---|
accept | application/json | Yes |
Authorization | Bearer <token> | Yes |
| Parameter | Type | Description | Example |
|---|---|---|---|
limit | integer | Max records to return | 50 |
offset | integer | Records to skip | 0 |
sort | string | Sort field (- prefix = descending) | -call_date |
fields | string | Fields to include | *.* |
meta | string | Metadata fields | total_count,filter_count |
filter[field][operator] | string | Filter conditions | See below |
| Operator | Description | Example |
|---|---|---|
_eq | Equals | filter[caller_phone][_eq]=+12126804645 |
_nnull | Is not null | filter[full_transcript][_nnull]=true |
_gt | Greater than | filter[duration][_gt]=60 |
_gte | Greater than or equal | filter[call_date][_gte]=2025-01-01 |
Response Schema
Success Response (200 OK)
Call Log Record Fields
| Field | Type | Nullable | Description |
|---|---|---|---|
id | integer | No | Unique identifier |
date_created | string (ISO 8601) | No | Record creation timestamp |
call_date | string (ISO 8601) | No | When the call occurred |
duration | integer | No | Call duration in seconds |
summary | string | Yes | Human-readable summary |
notes | string (JSON) | Yes | Additional metadata |
call_id | string (UUID) | No | Unique call identifier |
full_transcript | string | Yes | Complete call transcript |
caller_phone | string | No | Phone number (E.164 format) |
CDC Pipeline Integration
The call logs API feeds into the check-in CDC pipeline:Processing Flow
fetch_and_sync_raw()— Pull new records from API, upsert intocall_logstableclaim_unprocessed_call_logs_sync()— Atomically claim unprocessed records- LLM extraction — Parse transcript into structured health data
update_call_log_metrics()— Create CheckIn + MedicationEntry + FoodLogEntry + SymptomEntry- On failure:
unclaim_call_log_sync()— Reset for retry
Data Integrity
- 1:1 mapping: Every processed CallLog has a corresponding CheckIn record
- Idempotent: Same call log is never processed twice (claimed atomically)
- Auto-fix: Orphaned CallLogs (processed=True but no CheckIn) are detected and reset on page load
Python Usage
Error Responses
| Status | Code | Description |
|---|---|---|
| 401 | INVALID_TOKEN | Invalid or expired bearer token |
| 403 | FORBIDDEN | Insufficient permissions |
| 400 | INVALID_QUERY | Malformed query parameters |
Rate Limits
- Default: 100 requests per minute per token
- Burst: Up to 10 concurrent requests
Environment Variables
| Variable | Description | Required |
|---|---|---|
CALL_LOGS_API_KEY | Bearer token for API authentication | Yes |
CALL_LOGS_API_BASE | Base URL override | No |
Related Documentation
- State Management — CDC pipeline and periodic sync pattern
- Environment Variables — Configuration