Getting Started
Welcome to the IntakeDesk documentation. This guide will walk you through the basics of setting up and using IntakeDesk to streamline your referral intake process.
Installation
To get started, you will need to install our client libraries and configure your environment. We provide packages for popular EMR systems and a REST API for custom integrations.
npm install @intakedesk/clientConfiguration
To generate an API Key, use the POST /api/api-keys endpoint (authenticated via your Dashboard session) or contact support to enable the API Keys UI in your dashboard.
Authentication
The API supports two methods of authentication:
- Bearer Token: Standard Firebase ID Token. Used by frontend clients acting on behalf of a user.
Authorization: Bearer <ID_TOKEN>
- API Key: Secret key for server-side integrations. Grants full access to the organization's resources.
x-api-key: desk_...
API Reference
The IntakeDesk API provides endpoints for managing referrals, cases, patients, and documents. All endpoints require authentication.
Referrals
| Endpoint | Method | Description |
|---|---|---|
| /api/referrals?orgId=... | GET | List referrals for an organization. |
| /api/referrals | POST | Create a new referral. Returns a signed URL for file upload. |
| /api/referrals/:id | GET | Get a single referral by ID. |
| /api/referrals/:id/upload | POST | Upload an additional file to an existing referral. |
| /api/referrals/:id/process | POST | Trigger processing pipeline for a referral. |
| /api/referrals/:id/qa | POST | Run quality-assurance checks on extracted data. |
| /api/referrals/:id/triage | GET | Get current triage result for a referral. |
| /api/referrals/:id/triage | POST | Set or override triage classification. |
| /api/referrals/bulk | POST | Perform bulk actions (move to triaged, mark duplicate). |
| /api/referrals/export?orgId=...&stage=... | GET | Export referrals as CSV. Optional stage filter. |
Cases
Cases are merged patient records created from one or more referrals. Use these endpoints to manage case lifecycle.
| Endpoint | Method | Description |
|---|---|---|
| /api/cases/:caseId | PATCH | Update case fields (location, priority band, queue). |
| /api/cases/:caseId/contact | POST | Log a contact attempt, mark scheduled, close, or add a note. |
| /api/cases/match-referrer | POST | Match a case to an existing practice/provider and add alias. |
| /api/cases/create-referrer | POST | Create a new practice/provider from unmatched candidates. |
Patients
| Endpoint | Method | Description |
|---|---|---|
| /api/patients?orgId=...&q=... | GET | Search patients by name or ID. |
| /api/patients | POST | Create a new patient record. |
| /api/patients | PATCH | Update an existing patient record. |
| /api/patients | DELETE | Delete a patient record. |
Documents
| Endpoint | Method | Description |
|---|---|---|
| /api/referral-documents?orgId=... | GET | List documents for a referral or patient. |
| /api/referral-documents | POST | Attach a document to a referral/patient. |
| /api/referral-documents/sign-read | POST | Get a short-lived signed URL to read a document. |
| /api/referral-documents/update-status | PATCH | Update the processing status of a document. |
Authentication
Session management and user profile endpoints for frontend clients.
| Endpoint | Method | Description |
|---|---|---|
| /api/auth/me | GET | Get current authenticated user profile and org context. |
| /api/auth/session | POST | Create a session cookie from a Firebase ID token. |
| /api/auth/session | DELETE | Destroy the current session (logout). |
Dashboard & Reporting
Read-only endpoints for analytics, backlog monitoring, and operational metrics.
| Endpoint | Method | Description |
|---|---|---|
| /api/backlog | GET | Backlog statistics with aging buckets and status breakdown. |
| /api/dashboard/overview-stats | GET | KPI overview stats for the dashboard. |
| /api/metrics | GET | Detailed operational metrics. |
| /api/mix | GET | Case mix / referral-type distribution. |
Organization Config
| Endpoint | Method | Description |
|---|---|---|
| /api/orgs/:id/config | PATCH | Update organization configuration settings. |
API Keys (Management)
| Endpoint | Method | Description |
|---|---|---|
| /api/api-keys | POST | Generate a new API Key (requires User Token). |
| /api/api-keys | GET | List active API Keys. |
| /api/api-keys | DELETE | Revoke an API Key. |
EMR Integration
Queue-based chart creation and document delivery for external EMR systems (e.g., NextGen). Cases are queued manually or automatically, then an external service polls and reports results. When chart creation succeeds, source documents and a Case Summary PDF are automatically queued for delivery. All poll and callback endpoints use API key authentication (X-Api-Key header).
Retry behavior: Polling is read-only — items are not removed from the queue when polled. Every poll returns all non-completed items (both pending and processing). Items are only removed when a success callback is received. A failed/error callback keeps the item in the queue.
| Endpoint | Method | Description |
|---|---|---|
| /api/cases/:caseId/emr-queue | POST | Manually queue a case for EMR chart creation. Auth: Bearer token. |
| /api/emr/queue | GET | Poll pending queue items for chart creation. Returns denormalized patient/case data. Auth: API key. |
| /api/emr/queue/callback | POST | External service reports chart creation results (success/failed/error). Auto-queues documents on success. Auth: API key. |
Poll Response Format — GET /api/emr/queue
{
"orgId": "org_001",
"items": [
{
"queueItemId": "abc123...",
"orgId": "org_001",
"caseId": "case_456...",
"status": "pending",
"patientId": "pat_789...",
"firstName": "Jane",
"lastName": "Doe",
"dob": "1985-03-15",
"sex": "F",
"phone": "+15551234567",
"email": "jane@example.com",
"address": { "line1": "123 Main St", "city": "Anytown", "state": "CA", "zip": "90210" },
"insurance": { "provider": "Blue Cross", "memberId": "XYZ123", "groupNumber": "GRP456" }
},
"referrer": { ... },
"locationId": "loc_001",
"emrLocationId": "EMR_LOC_42",
"triageLevel": 1,
"priorityBand": "P1"
}
],
"count": 1
}Callback Request Format — POST /api/emr/queue/callback
{
"orgId": "org_001",
"results": [
{
"queueItemId": "abc123...",
"status": "success",
"emrChartId": "MRN12345",
"message": null
}
]
}status: "success" | "failed" | "error". On success, include emrChartId (the patient MRN). On failed/error, include an optional message. Failed items revert to pending and will be re-polled.
Callback Response Format
{
"processed": 1,
"results": [
{ "queueItemId": "abc123...", "ok": true }
]
}EMR Document Queue
After a patient chart is successfully created, source documents (referral faxes, labs, imaging) and a generated Case Summary PDF are automatically queued. The external service polls for pending documents, receives signed download URLs, and reports delivery results. Each document item includes the patient's mrn (Medical Record Number) for filing into the correct chart.
Retry behavior: Same as chart creation — polling is read-only and always returns all non-completed items. Download URLs are regenerated on each poll (15 min TTL).
| Endpoint | Method | Description |
|---|---|---|
| /api/emr/document-queue | GET | Poll pending document queue items. Returns signed download URLs (15 min TTL). Each item includes the patient MRN. Auth: API key. |
| /api/emr/document-queue/callback | POST | External service reports document delivery results (success/failed/error). Recomputes case-level emrDocumentStatus. Auth: API key. |
Poll Response Format — GET /api/emr/document-queue
{
"orgId": "org_001",
"items": [
{
"queueItemId": "doc_abc...",
"orgId": "org_001",
"caseId": "case_456...",
"mrn": "MRN12345",
"status": "pending",
"documentType": "source",
"fileName": "referral_fax_001.pdf",
"contentType": "application/pdf",
"downloadUrl": "https://storage.googleapis.com/...?X-Goog-Signature=..."
},
{
"queueItemId": "doc_def...",
"orgId": "org_001",
"caseId": "case_456...",
"mrn": "MRN12345",
"status": "pending",
"documentType": "summary",
"fileName": "Case_Summary.pdf",
"contentType": "application/pdf",
"downloadUrl": "https://storage.googleapis.com/...?X-Goog-Signature=..."
}
],
"count": 2
}Callback Request Format — POST /api/emr/document-queue/callback
{
"orgId": "org_001",
"results": [
{ "queueItemId": "doc_abc...", "status": "success" },
{ "queueItemId": "doc_def...", "status": "failed", "message": "File upload timeout" }
]
}status: "success" | "failed" | "error". Failed items revert to pending and will be re-polled with fresh download URLs.
