Version 1.0.0
LastMileRCM provides a webhook-based integration API that allows case management systems, EMRs, and other healthcare platforms to submit patient demographics, provider information, insurance coverage, and claims data directly into LastMileRCM for processing. The tenant is automatically resolved from your API key — no tenant identification is needed in the request body.
Base URL: https://lastmilercm.com
All API requests must include an API key in the x-api-key header. API keys are provisioned per integration partner during onboarding.
x-api-keylmr_xxxxxxxx...(min 32 characters)Requests are rate-limited per partner. Two limits apply: 60 requests per minute and 10,000 requests per day (rolling from midnight UTC). Exceeding either limit returns 429 Too Many Requests. The daily limit is configurable per partner.
To prevent duplicate processing, include a unique idempotency_key in the metadata object. If a payload with the same key has already been processed, the API returns 200 with a message confirming it was already processed. No entities are re-created. If the payload is still being processed, the API returns 202.
Demo tenants have configurable limits on patient counts, claim counts, and feature access. If a limit would be exceeded by the incoming batch, the entire request is blocked and the API returns 403 Forbidden with a descriptive message indicating the current usage, limit, and how many slots remain.
Limits are checked against the batch size before processing begins — partial batches are not processed. For example, if 20/25 patients are used and a batch of 10 is submitted, the entire batch is rejected.
/api/webhooks/cms/inboundReceives patient and claim data from external case management systems. The endpoint validates the API key, processes each patient record, and creates the corresponding entities in the tenant's account.
default_tenant_id. The partner must have a tenant configured.external_id — existing patients are matched, new ones are createdPatient Deduplication: Patients are matched by external_id within the tenant. If a patient with the same external_id already exists, the existing record is reused and counted as patients_existing in the response. New patients are counted as patients_created.
Draft Enrollments: When a provider-payer pair is seen for the first time, a draft enrollment is automatically created. This appears in the provider's detail page and can be activated once the provider is registered with the clearinghouse.
patientsarrayRequiredArray of patient records to process. Always use an array, even for a single patient.
See Patient schema below
metadataobjectOptional metadata about the submission
external_idstringYour system's unique ID for this patient. Used for deduplication — if a patient with this external_id already exists for the tenant, the existing record is reused.
Example: CMS-PAT-001
first_namestringRequiredExample: Jane
last_namestringRequiredExample: Doe
date_of_birthstringdateRequiredExample: 1985-03-15
genderstringNormalized to M/F internally
MFMaleFemalephonestringExample: 603-555-0100
emailstringemailExample: jane.doe@example.com
addressobjectPatient mailing address
The NPI is validated against the CMS NPI Registry (NPPES). If valid, the provider record is enriched with official registry data (name, address, taxonomy, credentials). If the NPI already exists for this tenant, the existing provider is reused.
npistringRequiredNational Provider Identifier (10 digits). Must be a valid, active NPI in the CMS registry.
Example: 1234567890
tax_idstringEIN or SSN (9 digits). Encrypted at rest.
Example: 123456789
tax_id_typestringType of tax identifier
EINSSNcontact_emailstringemailContact email for enrollment communications. Encrypted at rest.
Example: billing@provider.com
The payer name is matched against the Stedi payer directory. Only recognized payers are accepted. Matching tries exact payer_id, RPC search, and fuzzy display name matching.
payer_namestringRequiredInsurance company name. Matched against the payer directory.
Example: Blue Cross Blue Shield
payer_idstringOptional Stedi payer ID or primary payer ID for exact matching. Takes priority over name matching.
Example: BCBS
member_idstringRequiredInsurance member/subscriber ID. Encrypted at rest with a searchable last-4 index.
Example: XYZ123456789
group_numberstringExample: GRP-001
plan_namestringExample: PPO Gold
coverage_typestringInsurance coverage tier
primarysecondarytertiaryDefault: primary
effective_datestringdateExample: 2024-01-01
termination_datestringdateExample: 2024-12-31
Requires both a provider and coverage to be successfully resolved. Claims are created in draft status.
service_datestringdateRequiredDate of service
Example: 2024-06-15
place_of_servicestringCMS Place of Service code (e.g., 11=Office, 02=Telehealth)
Default: 11
prior_auth_numberstringPrior authorization number if applicable
Example: AUTH-12345
total_chargenumberTotal charge amount. If omitted, calculated as sum of service line charges.
diagnosesarrayRequiredICD-10 diagnosis codes. Decimal points are stripped automatically.
service_linesarrayRequiredCPT/HCPCS procedure codes with charges
Payload processed successfully. Returns counts of created and matched entities. No internal IDs are exposed.
successbooleanAlways true
messagestringHuman-readable summary (e.g., '2 new patient(s), 1 existing patient(s) matched, 1 claim(s)')
webhook_idstringuuidUnique ID for this webhook invocation — use for support inquiries
patient_countintegerTotal patients processed (created + existing)
processedobjectBreakdown of created vs matched entities
errorsarrayNon-fatal warnings (e.g., payer not found, NPI lookup failed). Present only if there were issues with individual records — the overall request still succeeds.
Idempotency key matched a completed payload. Returns webhook_id only — no re-processing occurs.
Idempotency key matched a payload that is still being processed.
Invalid payload structure, missing required fields, or partner does not have a default tenant configured.
Missing or invalid API key.
IP not in allowlist, or demo tenant usage limit reached (patients or claims).
Exceeded 60 requests per minute or 10,000 requests per day. Wait and retry.
Contact ananth@thehealthcolab.com for API key provisioning, integration support, or questions.
curl --request POST \
--url "https://lastmilercm.com/api/webhooks/cms/inbound" \
--header "x-api-key: lmr_your_api_key_here" \
--header "Content-Type: application/json" \
--data '{
"patients": [
{
"external_id": "CMS-PAT-001",
"first_name": "Jane",
"last_name": "Doe",
"date_of_birth": "1985-03-15",
"gender": "F",
"phone": "603-555-0100",
"email": "jane.doe@example.com",
"address": {
"line1": "123 Main St",
"line2": "Apt 4B",
"city": "Manchester",
"state": "NH",
"postal_code": "03101"
},
"provider": {
"npi": "1003000126",
"tax_id": "061234567",
"tax_id_type": "EIN",
"contact_email": "billing@provider.com"
},
"coverage": {
"payer_name": "Blue Cross Blue Shield",
"member_id": "XYZ123456789",
"group_number": "GRP-001",
"plan_name": "PPO Gold",
"coverage_type": "primary",
"effective_date": "2024-01-01"
},
"claim": {
"service_date": "2024-06-15",
"place_of_service": "11",
"prior_auth_number": "AUTH-12345",
"diagnoses": [
{ "code": "F32.1", "type": "principal" },
{ "code": "F41.1", "type": "secondary" }
],
"service_lines": [
{
"procedure_code": "90837",
"description": "Psychotherapy, 60 min",
"units": 1,
"charge_amount": 150.00,
"modifier_1": "95"
}
]
}
}
],
"metadata": {
"source_system": "YourCMS",
"idempotency_key": "batch-20240615-001"
}
}'{
"success": true,
"message": "Processed: 1 new patient(s), 1 claim(s)",
"webhook_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"patient_count": 1,
"processed": {
"patients_created": 1,
"patients_existing": 0,
"claims_created": 1
}
}{
"success": true,
"message": "Processed: 2 new patient(s), 1 existing patient(s) matched, 1 claim(s)",
"webhook_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"patient_count": 3,
"processed": {
"patients_created": 2,
"patients_existing": 1,
"claims_created": 1
},
"errors": [
"Patient AC-PAT-ERR: Payer 'Totally Made Up Insurance' not found in payer directory"
]
}{
"success": true,
"message": "Payload already processed (idempotency key matched)",
"webhook_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}{
"success": false,
"message": "Invalid payload. Expected \"patients\" array with at least one patient."
}{
"success": false,
"message": "Integration partner does not have a default tenant configured. Contact support."
}{
"success": false,
"message": "Invalid API key"
}{
"success": false,
"message": "Demo limit exceeded. You have 45 of 50 patients used and this request would add 10 more. Contact us to upgrade.",
"webhook_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}{
"success": false,
"message": "Rate limit exceeded. Maximum 60 requests per minute."
}{
"success": false,
"message": "Rate limit exceeded. Maximum 10,000 requests per day."
}curl --request POST \
--url "https://lastmilercm.com/api/webhooks/cms/inbound" \
--header "x-api-key: lmr_your_api_key_here" \
--header "Content-Type: application/json" \
--data '{
"patients": [
{
"external_id": "CMS-PAT-001",
"first_name": "Jane",
"last_name": "Doe",
"date_of_birth": "1985-03-15",
"gender": "F",
"phone": "603-555-0100",
"email": "jane.doe@example.com",
"address": {
"line1": "123 Main St",
"line2": "Apt 4B",
"city": "Manchester",
"state": "NH",
"postal_code": "03101"
},
"provider": {
"npi": "1003000126",
"tax_id": "061234567",
"tax_id_type": "EIN",
"contact_email": "billing@provider.com"
},
"coverage": {
"payer_name": "Blue Cross Blue Shield",
"member_id": "XYZ123456789",
"group_number": "GRP-001",
"plan_name": "PPO Gold",
"coverage_type": "primary",
"effective_date": "2024-01-01"
},
"claim": {
"service_date": "2024-06-15",
"place_of_service": "11",
"prior_auth_number": "AUTH-12345",
"diagnoses": [
{ "code": "F32.1", "type": "principal" },
{ "code": "F41.1", "type": "secondary" }
],
"service_lines": [
{
"procedure_code": "90837",
"description": "Psychotherapy, 60 min",
"units": 1,
"charge_amount": 150.00,
"modifier_1": "95"
}
]
}
}
],
"metadata": {
"source_system": "YourCMS",
"idempotency_key": "batch-20240615-001"
}
}'{
"success": true,
"message": "Processed: 1 new patient(s), 1 claim(s)",
"webhook_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"patient_count": 1,
"processed": {
"patients_created": 1,
"patients_existing": 0,
"claims_created": 1
}
}{
"success": true,
"message": "Processed: 2 new patient(s), 1 existing patient(s) matched, 1 claim(s)",
"webhook_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"patient_count": 3,
"processed": {
"patients_created": 2,
"patients_existing": 1,
"claims_created": 1
},
"errors": [
"Patient AC-PAT-ERR: Payer 'Totally Made Up Insurance' not found in payer directory"
]
}{
"success": true,
"message": "Payload already processed (idempotency key matched)",
"webhook_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}{
"success": false,
"message": "Invalid payload. Expected \"patients\" array with at least one patient."
}{
"success": false,
"message": "Integration partner does not have a default tenant configured. Contact support."
}{
"success": false,
"message": "Invalid API key"
}{
"success": false,
"message": "Demo limit exceeded. You have 45 of 50 patients used and this request would add 10 more. Contact us to upgrade.",
"webhook_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}{
"success": false,
"message": "Rate limit exceeded. Maximum 60 requests per minute."
}{
"success": false,
"message": "Rate limit exceeded. Maximum 10,000 requests per day."
}