Mobile API Documentation¶
Base URL: https://txpaxbxhnvnhsjwwaeoy.supabase.co/functions/v1/mobile-api
1. Login¶
POST /login — No auth required
Request¶
Response (200)¶
{
"access_token": "eyJ...",
"refresh_token": "abc...",
"expires_in": 2592000,
"user": {
"id": "uuid",
"first_name": "Ahmed",
"last_name": "Ali",
"email": "agent@company.com",
"organization_id": "uuid",
"avatar_url": null
}
}
Errors¶
| Status | Description |
|---|---|
| 401 | Invalid credentials |
| 403 | Account deactivated/suspended |
2. List Contacts¶
GET /contacts — Bearer token required
Headers¶
Query Parameters¶
| Param | Default | Description |
|---|---|---|
| page | 1 | Page number |
| limit | 50 | Items per page (max 200) |
| search | Search by name or phone number |
Response (200)¶
{
"contacts": [
{
"id": "uuid",
"first_name": "Sara",
"last_name": "Hassan",
"phones": ["+201001234567"],
"emails": ["sara@example.com"],
"tags": ["VIP"],
"company_id": "uuid",
"created_at": "2026-03-10T...",
"updated_at": "2026-03-15T..."
}
],
"total": 150,
"page": 1,
"limit": 50,
"total_pages": 3
}
3. View Single Contact¶
GET /contacts/:id — Bearer token required
Headers¶
Response (200)¶
{
"id": "uuid",
"first_name": "Sara",
"last_name": "Hassan",
"phones": ["+201001234567"],
"emails": ["sara@example.com"],
"tags": ["VIP"],
"description": "Key account",
"company_id": "uuid",
"assignee_id": "uuid",
"source": "whatsapp",
"opt_in_status": true,
"custom_fields": {},
"created_at": "2026-03-10T...",
"updated_at": "2026-03-15T...",
"company": { "id": "uuid", "name": "Acme Corp" }
}
4. Upload Call Recording¶
POST /call-recording — Bearer token required, multipart/form-data
Headers¶
Form Fields¶
| Field | Required | Description |
|---|---|---|
| file | ✅ | Audio file (MP3, M4A, WAV, OGG, WebM, AAC, 3GP, AMR). Max 50 MB |
| contact_id | UUID of the contact (if known) | |
| customer_phone | Phone number — used to auto-match contact if contact_id is empty |
|
| duration_seconds | Call duration in seconds | |
| call_timestamp | ISO 8601 timestamp (defaults to now) | |
| direction | inbound (default) or outbound |
|
| notes | Free-text notes about the call |
Response (200)¶
{
"success": true,
"call_record_id": "uuid",
"status": "received",
"contact_matched": true,
"recording_stored": true
}
Processing Pipeline¶
After upload, the recording is automatically processed: 1. Transcription — Speech-to-text (Arabic/English optimized) 2. AI Analysis — Sentiment, keywords, action items, summary 3. Timeline — Results appear on the contact's activity timeline
Errors¶
| Status | Description |
|---|---|
| 400 | Missing file or unsupported format |
| 401 | Invalid/expired token |
| 403 | Account deactivated/suspended |
| 500 | Upload or processing failure |
cURL Examples¶
Login¶
curl -X POST https://txpaxbxhnvnhsjwwaeoy.supabase.co/functions/v1/mobile-api/login \
-H "Content-Type: application/json" \
-d '{"email":"agent@company.com","password":"secret123"}'
List Contacts¶
curl https://txpaxbxhnvnhsjwwaeoy.supabase.co/functions/v1/mobile-api/contacts?page=1&limit=20 \
-H "Authorization: Bearer <access_token>"