{"openapi":"3.1.0","info":{"title":"LastMileRCM Partner API","version":"1.1.0","description":"The LastMileRCM partner API lets a case management system, an EHR or another partner application send patients and claims for billing, read back what happened to them, and be told when something changes.\n\n## Authentication\n\nEvery request carries your API key in the `x-api-key` header. Keys start with `lmr_` and are at least 32 characters long. A key belongs to one account: everything you send or read is scoped to that account, and nothing in a request can select another one. If you gave us a list of addresses, requests from any other address are refused. While an organization's access is suspended, every request with its key answers 403 with code TENANT_SUSPENDED.\n\n## Rate limits\n\nEach key has a per-minute and a per-day limit. Unless other limits were agreed they are 60 requests per minute and 10000 per day; the daily count resets at midnight UTC. Past a limit the answer is 429 with code RATE_LIMIT_MINUTE or RATE_LIMIT_DAILY. Each endpoint says whether it is rate limited (also given as `x-rate-limited`).\n\n## Errors\n\nThere are two error shapes. The data feed, the claim status endpoint and every API key failure answer `{ success: false, code, message }`; switch on `code`. The other endpoints answer their own errors with `{ error }`, sometimes with a `code`; on those endpoints an API key failure carries the message in both `message` and `error`. Each endpoint lists the statuses and codes it can return.\n\n## Idempotency\n\nThe data feed takes an idempotency key per batch, and matches every record to what is already stored, so sending a batch twice does not duplicate anything. Encounters are deduplicated on your `reference`. Details are on each endpoint.\n\n## Events we send you\n\nInstead of polling you can register a URL per event type and we will send the event there as it happens. Event types: claim.status_changed, claim.remittance_received, eligibility.completed, enrollment.status_changed. Registration is done with us during onboarding.\n\nEach event is a JSON body `{ event_id, event_type, tenant_external_id, data, emitted_at }` sent with POST. It is signed: the `X-LastMile-Signature` header is `sha256=` followed by the hex HMAC-SHA256 of the raw body, keyed with the signing secret we gave you. Check it before trusting the body. By arrangement an event can instead be sent with PUT, be authenticated with an OAuth 2.0 client credentials bearer token in place of the signature, or use a payload shape agreed with you.\n\nAnswer with any 2xx status to acknowledge. A 5xx answer, or no answer, is tried again, up to 5 attempts in all, waiting 30 seconds, 2 minutes, 10 minutes, 30 minutes between them. A 4xx answer is final and the event is not sent again. `event_id` is the same on every attempt.\n\n## Demo accounts\n\nA demo account behaves like a live one, with two differences: payers are simulated, and there is a cap on the number of patients and claims.","contact":{"name":"LastMileRCM Support","email":"aaron@thehealthcolab.com"}},"servers":[{"url":"https://lastmilercm.com","description":"Production"}],"tags":[{"name":"Data feed"},{"name":"Claims"},{"name":"Encounters"},{"name":"Eligibility"},{"name":"Reference data"},{"name":"Embedded sign-in"},{"name":"Events we send you"}],"paths":{"/api/webhooks/cms/inbound":{"post":{"operationId":"sendPatientsAndClaims","tags":["Data feed"],"summary":"Send patients, providers, coverage and claims","description":"Send one batch of patient records. Each record may carry a billing provider, an insurance coverage and one claim. Records are matched to what is already on your account, so the same batch can be sent again safely.\n\n**Matching.** A patient is matched on `external_id`, a coverage on patient, payer and `coverage_type`, a claim on `partner_claim_ref` (or `patient_control_number`), a provider on NPI.\n\n**Re-sends.** A known patient or coverage is compared with what is stored, value by value, after decrypting the stored values. Only the values that really differ are written. A record with no difference is reported as `existing` and nothing is written for it; a record with a difference is reported as `updated`. A date in another accepted format, or extra spaces around a value, is not a difference. A claim can be changed by a re-send while it is draft, validated or rejected.\n\n**Outcome.** A processed batch always answers 200. `code` is OK when every record was saved, COMPLETED_WITH_ERRORS when some records had errors, and FAILED (with `success` false) when no record was saved. `items` has the detail for each record.\n\n**Item error codes.** PATIENT_MISSING_FIELDS, INVALID_DOB, INVALID_DATE, PATIENT_CREATE_FAILED, PATIENT_UPDATE_FAILED, PATIENT_DEDUP_FAILED, NPI_INVALID_FORMAT, NPI_NOT_FOUND, PROVIDER_CREATE_FAILED, PAYER_NOT_FOUND, PAYER_AMBIGUOUS, COVERAGE_CREATE_FAILED, COVERAGE_UPDATE_FAILED, CLAIM_MISSING_FIELDS, SERVICE_LINE_INVALID, CLAIM_MISSING_PROVIDER, CLAIM_MISSING_COVERAGE, CLAIM_DUPLICATE, CLAIM_REF_REQUIRED, CLAIM_LOCKED, CLAIM_CREATE_FAILED, CLAIM_UPDATE_FAILED, CLAIM_ALREADY_SUBMITTED, CLAIM_INVALID_FREQUENCY, CLAIM_ORIGINAL_NOT_FOUND, CLAIM_NOT_CORRECTABLE, CLAIM_VOID_FAILED.\n\n**Limits.** The body may be at most 4 MB. Demo accounts have a cap on patients and claims (LIMIT_PATIENTS, LIMIT_CLAIMS).\n\n**Idempotency.** Send a unique `metadata.idempotency_key` per batch. The same key with the same body: a finished batch answers 200 IDEMPOTENCY_COMPLETED with `result_status` and the claims it touched, without running again; a batch still running answers 202 IDEMPOTENCY_PENDING; a batch that failed or stopped part way runs again. The same key with a different body answers 409 IDEMPOTENCY_KEY_REUSED. Without a key every send is processed.\n\nRate limited: counts against your per-minute and per-day limits.","security":[{"ApiKeyAuth":[]}],"x-rate-limited":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboundRequest"},"example":{"patients":[{"external_id":"PAT-001","first_name":"Jane","last_name":"Doe","date_of_birth":"1985-03-15","gender":"F","phone":"603-555-0100","address":{"line1":"123 Main St","city":"Manchester","state":"NH","postal_code":"03101"},"provider":{"npi":"1234567890"},"coverage":{"payer_name":"Example Health Plan","member_id":"XYZ123456789","coverage_type":"primary"},"claim":{"partner_claim_ref":"MC-2026-000123","service_date":"2026-09-14","place_of_service":"11","diagnoses":[{"code":"F32.1","type":"principal"}],"service_lines":[{"procedure_code":"90837","units":1,"charge_amount":150}]}}],"metadata":{"source_system":"Example CMS","idempotency_key":"batch-20260914-001"}}}}},"responses":{"200":{"description":"Batch processed, or a finished batch replayed. Codes: OK, COMPLETED_WITH_ERRORS, FAILED, IDEMPOTENCY_COMPLETED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboundResponse"},"example":{"success":true,"code":"OK","message":"Processed: 1 unchanged patient(s), 1 new claim(s)","webhook_id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","processed":{"patients":{"created":0,"updated":0,"existing":1,"failed":0},"claims":{"created":1,"updated":0,"existing":0,"voided":0,"skipped":0,"failed":0},"providers":{"created":0,"existing":1,"failed":0},"payers":{"resolved":1,"not_found":0},"coverages":{"created":0,"updated":0,"existing":1,"failed":0},"enrollments":{"created":0,"existing":0}},"items":[{"index":0,"identifier":"PAT-001","status":"success","patient":{"id":"f1a2b3c4-d5e6-7890-abcd-1234567890ab","action":"existing"},"provider":{"id":"0a1b2c3d-4e5f-6789-abcd-ef0123456789","npi":"1234567890","action":"existing"},"payer":{"id":"9f8e7d6c-5b4a-3210-fedc-ba9876543210","name":"Example Health Plan","action":"resolved"},"coverage":{"id":"11112222-3333-4444-5555-666677778888","action":"existing"},"claim":{"id":"99990000-aaaa-bbbb-cccc-ddddeeeeffff","pcn":"MC-2026-000123","action":"created"}}]}}}},"202":{"description":"The batch with this idempotency key is still being processed. Code: IDEMPOTENCY_PENDING.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboundResponse"}}}},"400":{"description":"The body is not usable, or your API key is not linked to an account yet. Codes: PAYLOAD_INVALID, PAYLOAD_MISSING_PATIENTS, TENANT_NOT_CONFIGURED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["PAYLOAD_INVALID","PAYLOAD_MISSING_PATIENTS","TENANT_NOT_CONFIGURED"]},"message":{"type":"string"}}}}}},"401":{"description":"The API key is missing, malformed, unknown or switched off. Codes: AUTH_MISSING_KEY, AUTH_INVALID_FORMAT, AUTH_INVALID_KEY, AUTH_INACTIVE.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["AUTH_MISSING_KEY","AUTH_INVALID_FORMAT","AUTH_INVALID_KEY","AUTH_INACTIVE"]},"message":{"type":"string"}}}}}},"403":{"description":"This organization's access is suspended, the address is not on your allow list, or a demo account cap would be passed. Codes: TENANT_SUSPENDED, IP_NOT_ALLOWED, LIMIT_PATIENTS, LIMIT_CLAIMS.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["TENANT_SUSPENDED","IP_NOT_ALLOWED","LIMIT_PATIENTS","LIMIT_CLAIMS"]},"message":{"type":"string"}}}}}},"405":{"description":"Only POST is accepted. Answered before the API key is checked. Codes: METHOD_NOT_ALLOWED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["METHOD_NOT_ALLOWED"]},"message":{"type":"string"}}}}}},"409":{"description":"The idempotency key was already used for a different body. Codes: IDEMPOTENCY_KEY_REUSED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["IDEMPOTENCY_KEY_REUSED"]},"message":{"type":"string"}}}}}},"429":{"description":"A rate limit was reached. The daily count resets at midnight UTC. Codes: RATE_LIMIT_MINUTE, RATE_LIMIT_DAILY.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["RATE_LIMIT_MINUTE","RATE_LIMIT_DAILY"]},"message":{"type":"string"}}}}}},"500":{"description":"The batch could not be stored or processed. Send it again with the same idempotency key. Codes: STORAGE_FAILED, INTERNAL_ERROR.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["STORAGE_FAILED","INTERNAL_ERROR"]},"message":{"type":"string"}}}}}}}}},"/api/v1/claims":{"get":{"operationId":"listClaims","tags":["Claims"],"summary":"Read claim status","description":"Lists claims on your account, newest change first, with their status and your own keys. No patient names, birth dates or member IDs are returned.\n\nA claim waiting on prior authorization is a `draft` with a hold in `holds`. The values pending_auth and prior_auth_submitted are accepted as filters and return those held drafts, but are never returned as a status.\n\nRate limited: counts against your per-minute and per-day limits.","security":[{"ApiKeyAuth":[]}],"x-rate-limited":true,"parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["draft","pending_auth","prior_auth_submitted","validated","submitted","acknowledged","rejected","pending","paid","denied","appealed","appeal_draft","appeal_sent","resubmitted","writeoff","cancelled"]},"description":"Only claims in this status."},{"name":"updated_since","in":"query","schema":{"type":"string","format":"date-time"},"description":"Only claims changed at or after this ISO-8601 time. Use it to poll for changes."},{"name":"patient_control_number","in":"query","schema":{"type":"string"},"description":"Exact claim number."},{"name":"external_patient_id","in":"query","schema":{"type":"string"},"description":"Your ID for the patient."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Page size. A value outside the range is brought into it."},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0},"description":"Number of claims to skip."}],"responses":{"200":{"description":"One page of claims.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimsListResponse"}}}},"400":{"description":"A filter value is not usable, or your API key is not linked to an account yet. Codes: INVALID_STATUS, INVALID_UPDATED_SINCE, TENANT_NOT_CONFIGURED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["INVALID_STATUS","INVALID_UPDATED_SINCE","TENANT_NOT_CONFIGURED"]},"message":{"type":"string"}}}}}},"401":{"description":"The API key is missing, malformed, unknown or switched off. Codes: AUTH_MISSING_KEY, AUTH_INVALID_FORMAT, AUTH_INVALID_KEY, AUTH_INACTIVE.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["AUTH_MISSING_KEY","AUTH_INVALID_FORMAT","AUTH_INVALID_KEY","AUTH_INACTIVE"]},"message":{"type":"string"}}}}}},"403":{"description":"This organization's access is suspended, or the request came from an address that is not on your allow list. A suspended organization is refused before the rate limit is counted. Codes: TENANT_SUSPENDED, IP_NOT_ALLOWED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["TENANT_SUSPENDED","IP_NOT_ALLOWED"]},"message":{"type":"string"}}}}}},"405":{"description":"Only GET is accepted. Answered before the API key is checked. Codes: METHOD_NOT_ALLOWED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["METHOD_NOT_ALLOWED"]},"message":{"type":"string"}}}}}},"429":{"description":"A rate limit was reached. The daily count resets at midnight UTC. Codes: RATE_LIMIT_MINUTE, RATE_LIMIT_DAILY.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["RATE_LIMIT_MINUTE","RATE_LIMIT_DAILY"]},"message":{"type":"string"}}}}}},"500":{"description":"The claims could not be read. Try again. Codes: QUERY_FAILED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["QUERY_FAILED"]},"message":{"type":"string"}}}}}}}}},"/api/v1/encounters":{"get":{"operationId":"countEncounters","tags":["Encounters"],"summary":"Count a patient's encounters in a month","description":"Counts the encounters we hold for one patient in one calendar month: those billed on a claim plus those sent through this endpoint. Rate limited: counts against your per-minute and per-day limits.","security":[{"ApiKeyAuth":[]}],"x-rate-limited":true,"parameters":[{"name":"external_patient_id","in":"query","required":true,"schema":{"type":"string"},"description":"Your ID for the patient."},{"name":"month","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"description":"YYYY-MM."}],"responses":{"200":{"description":"The counts.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EncountersCountResponse"}}}},"400":{"description":"A parameter is missing or malformed ({ error }), or your API key is not linked to an account yet (code TENANT_NOT_CONFIGURED).","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/SimpleError"},{"$ref":"#/components/schemas/CodedError"}]}}}},"401":{"description":"The API key is missing, malformed, unknown or switched off. Codes: AUTH_MISSING_KEY, AUTH_INVALID_FORMAT, AUTH_INVALID_KEY, AUTH_INACTIVE.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["AUTH_MISSING_KEY","AUTH_INVALID_FORMAT","AUTH_INVALID_KEY","AUTH_INACTIVE"]},"message":{"type":"string"}}}}}},"403":{"description":"This organization's access is suspended, or the request came from an address that is not on your allow list. A suspended organization is refused before the rate limit is counted. Codes: TENANT_SUSPENDED, IP_NOT_ALLOWED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["TENANT_SUSPENDED","IP_NOT_ALLOWED"]},"message":{"type":"string"}}}}}},"404":{"description":"No patient with that ID on your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"429":{"description":"A rate limit was reached. The daily count resets at midnight UTC. Codes: RATE_LIMIT_MINUTE, RATE_LIMIT_DAILY.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["RATE_LIMIT_MINUTE","RATE_LIMIT_DAILY"]},"message":{"type":"string"}}}}}}}},"post":{"operationId":"sendEncounters","tags":["Encounters"],"summary":"Send encounters that are not billed","description":"Stores encounters that will not be billed on a claim, so that a contract's monthly minimum can be counted. The patient must already be known from the data feed.\n\n**Idempotency.** Give each encounter a `reference`. An encounter whose reference was already stored is reported as `duplicate` and nothing is written. Without a reference every send stores a new encounter.\n\nThe request answers 200 whenever the batch was read; each entry in `results` says what happened to one encounter.\n\nRate limited: counts against your per-minute and per-day limits.","security":[{"ApiKeyAuth":[]}],"x-rate-limited":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EncountersRequest"},"example":{"items":[{"external_patient_id":"PAT-001","encounter_date":"2026-09-14","encounter_type":"phone","reference":"ENC-000123"}]}}}},"responses":{"200":{"description":"The batch was read.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EncountersPostResponse"}}}},"400":{"description":"items is missing, empty or longer than 500 ({ error }), or your API key is not linked to an account yet (code TENANT_NOT_CONFIGURED).","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/SimpleError"},{"$ref":"#/components/schemas/CodedError"}]}}}},"401":{"description":"The API key is missing, malformed, unknown or switched off. Codes: AUTH_MISSING_KEY, AUTH_INVALID_FORMAT, AUTH_INVALID_KEY, AUTH_INACTIVE.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["AUTH_MISSING_KEY","AUTH_INVALID_FORMAT","AUTH_INVALID_KEY","AUTH_INACTIVE"]},"message":{"type":"string"}}}}}},"403":{"description":"This organization's access is suspended, or the request came from an address that is not on your allow list. A suspended organization is refused before the rate limit is counted. Codes: TENANT_SUSPENDED, IP_NOT_ALLOWED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["TENANT_SUSPENDED","IP_NOT_ALLOWED"]},"message":{"type":"string"}}}}}},"405":{"description":"Only GET and POST are accepted. Answered after the API key is checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"429":{"description":"A rate limit was reached. The daily count resets at midnight UTC. Codes: RATE_LIMIT_MINUTE, RATE_LIMIT_DAILY.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["RATE_LIMIT_MINUTE","RATE_LIMIT_DAILY"]},"message":{"type":"string"}}}}}}}}},"/api/integration/claims-cancel":{"post":{"operationId":"cancelDraftClaims","tags":["Claims"],"summary":"Cancel draft claims","description":"Cancels claims that are still drafts, for example when the authorization they were created for ended early. A claim past draft is never touched: it is returned under `skipped` with its status.\n\nEach cancelled claim sends a `claim.status_changed` event with status cancelled. Sending the same list again is safe: claims already cancelled come back under `skipped`.\n\nRate limited: counts against your per-minute and per-day limits.","security":[{"ApiKeyAuth":[]}],"x-rate-limited":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimsCancelRequest"},"example":{"patient_control_numbers":["MC-2026-000123"],"reason":"Authorization ended early"}}}},"responses":{"200":{"description":"What happened to each claim number.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimsCancelResponse"}}}},"400":{"description":"patient_control_numbers is missing, empty or longer than 100 ({ error }), or your API key is not linked to an account yet (code TENANT_NOT_CONFIGURED).","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/SimpleError"},{"$ref":"#/components/schemas/CodedError"}]}}}},"401":{"description":"The API key is missing, malformed, unknown or switched off. Codes: AUTH_MISSING_KEY, AUTH_INVALID_FORMAT, AUTH_INVALID_KEY, AUTH_INACTIVE.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["AUTH_MISSING_KEY","AUTH_INVALID_FORMAT","AUTH_INVALID_KEY","AUTH_INACTIVE"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"403":{"description":"This organization's access is suspended, or the request came from an address that is not on your allow list. A suspended organization is refused before the rate limit is counted. Codes: TENANT_SUSPENDED, IP_NOT_ALLOWED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["TENANT_SUSPENDED","IP_NOT_ALLOWED"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"405":{"description":"Only POST is accepted. Answered before the API key is checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"429":{"description":"A rate limit was reached. The daily count resets at midnight UTC. Codes: RATE_LIMIT_MINUTE, RATE_LIMIT_DAILY.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["RATE_LIMIT_MINUTE","RATE_LIMIT_DAILY"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"500":{"description":"The claims could not be read, or the account has no active user to record the cancellation under.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}}}}},"/api/integration/contract-rates":{"get":{"operationId":"getContractRates","tags":["Reference data"],"summary":"Read the contract rates for a payer","description":"Returns the fee schedule of your most recent active contract with one payer. The payer name is matched exactly, as on the data feed. Not rate limited, and not counted against your limits.","security":[{"ApiKeyAuth":[]}],"x-rate-limited":false,"parameters":[{"name":"payer_name","in":"query","required":true,"schema":{"type":"string"},"description":"Payer name."},{"name":"procedure_codes","in":"query","schema":{"type":"string"},"description":"Comma-separated procedure codes. Left out: every code on the contract."}],"responses":{"200":{"description":"The contract and its rates.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractRatesResponse"}}}},"400":{"description":"payer_name is missing ({ error }), or your API key is not linked to an account yet (code TENANT_NOT_CONFIGURED).","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/SimpleError"},{"$ref":"#/components/schemas/CodedError"}]}}}},"401":{"description":"The API key is missing, malformed, unknown or switched off. Codes: AUTH_MISSING_KEY, AUTH_INVALID_FORMAT, AUTH_INVALID_KEY, AUTH_INACTIVE.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["AUTH_MISSING_KEY","AUTH_INVALID_FORMAT","AUTH_INVALID_KEY","AUTH_INACTIVE"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"403":{"description":"This organization's access is suspended, or the request came from an address that is not on your allow list. A suspended organization is refused before the rate limit is counted. Codes: TENANT_SUSPENDED, IP_NOT_ALLOWED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["TENANT_SUSPENDED","IP_NOT_ALLOWED"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"404":{"description":"The payer could not be matched (code PAYER_NOT_FOUND or PAYER_AMBIGUOUS, with candidates), or there is no active contract with it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"405":{"description":"Only GET is accepted. Answered before the API key is checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"500":{"description":"The rates could not be read. Try again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}}}}},"/api/integration/default-provider":{"get":{"operationId":"getDefaultProvider","tags":["Reference data"],"summary":"Read the default billing provider","description":"Returns the NPI and tax ID of the first active provider on your account, to use as the billing provider on the data feed. Not rate limited, and not counted against your limits.","security":[{"ApiKeyAuth":[]}],"x-rate-limited":false,"responses":{"200":{"description":"The provider.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DefaultProviderResponse"}}}},"400":{"description":"Your API key is not linked to an account yet. Codes: TENANT_NOT_CONFIGURED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["TENANT_NOT_CONFIGURED"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"401":{"description":"The API key is missing, malformed, unknown or switched off. Codes: AUTH_MISSING_KEY, AUTH_INVALID_FORMAT, AUTH_INVALID_KEY, AUTH_INACTIVE.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["AUTH_MISSING_KEY","AUTH_INVALID_FORMAT","AUTH_INVALID_KEY","AUTH_INACTIVE"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"403":{"description":"This organization's access is suspended, or the request came from an address that is not on your allow list. A suspended organization is refused before the rate limit is counted. Codes: TENANT_SUSPENDED, IP_NOT_ALLOWED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["TENANT_SUSPENDED","IP_NOT_ALLOWED"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"404":{"description":"The account has no active provider.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"405":{"description":"Only GET is accepted. Answered before the API key is checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}}}}},"/api/payers/configured":{"get":{"operationId":"listConfiguredPayers","tags":["Reference data"],"summary":"List the payers you have a contract with","description":"Returns each payer your account has an active contract with today, once, sorted by name. Suited to an insurance picker. The answer may be cached by the caller for 60 seconds. Not rate limited, and not counted against your limits.","security":[{"ApiKeyAuth":[]}],"x-rate-limited":false,"responses":{"200":{"description":"The payers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfiguredPayersResponse"}}}},"400":{"description":"Your API key is not linked to an account yet. Codes: TENANT_NOT_CONFIGURED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["TENANT_NOT_CONFIGURED"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"401":{"description":"The API key is missing, malformed, unknown or switched off. Codes: AUTH_MISSING_KEY, AUTH_INVALID_FORMAT, AUTH_INVALID_KEY, AUTH_INACTIVE.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["AUTH_MISSING_KEY","AUTH_INVALID_FORMAT","AUTH_INVALID_KEY","AUTH_INACTIVE"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"403":{"description":"This organization's access is suspended, or the request came from an address that is not on your allow list. A suspended organization is refused before the rate limit is counted. Codes: TENANT_SUSPENDED, IP_NOT_ALLOWED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["TENANT_SUSPENDED","IP_NOT_ALLOWED"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"405":{"description":"Only GET is accepted. Answered before the API key is checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"500":{"description":"The payers could not be read. Try again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}}}}},"/api/eligibility/check-external":{"post":{"operationId":"checkEligibility","tags":["Eligibility"],"summary":"Check a patient's eligibility with a payer","description":"Asks the payer whether a member has active coverage and returns the answer in the same call. The body is self-contained: the patient and coverage do not need to be sent on the data feed first. The check, and a patient and coverage record for it, are kept on your account. With `external_patient_id`, a known patient is reused.\n\nWhen the check finishes, an `eligibility.completed` event is sent to subscribers.\n\nOn a demo account the answer is simulated and `demo_mode` is true.\n\nNot idempotent: every call runs a new check.\n\nRate limited: counts against your per-minute and per-day limits.","security":[{"ApiKeyAuth":[]}],"x-rate-limited":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EligibilityCheckRequest"},"example":{"patient":{"first_name":"Jane","last_name":"Doe","date_of_birth":"1985-03-15"},"coverage":{"payer_name":"Example Health Plan","member_id":"XYZ123456789"},"provider_npi":"1234567890","external_patient_id":"PAT-001"}}}},"responses":{"200":{"description":"The check ran.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EligibilityCheckResponse"}}}},"400":{"description":"A required field is missing or unreadable, the provider is not on your account, or the payer could not be matched ({ error }, sometimes with code INVALID_DOB, INVALID_DATE, PAYER_NOT_FOUND, PAYER_AMBIGUOUS, ELIGIBILITY_PLAN_NOT_CHOSEN or ELIGIBILITY_PLAN_NOT_ALLOWED and candidates). Also: your API key is not linked to an account yet (code TENANT_NOT_CONFIGURED).","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/SimpleError"},{"$ref":"#/components/schemas/CodedError"}]}}}},"401":{"description":"The API key is missing, malformed, unknown or switched off. Codes: AUTH_MISSING_KEY, AUTH_INVALID_FORMAT, AUTH_INVALID_KEY, AUTH_INACTIVE.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["AUTH_MISSING_KEY","AUTH_INVALID_FORMAT","AUTH_INVALID_KEY","AUTH_INACTIVE"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"403":{"description":"This organization's access is suspended, or the request came from an address that is not on your allow list. A suspended organization is refused before the rate limit is counted. Codes: TENANT_SUSPENDED, IP_NOT_ALLOWED.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["TENANT_SUSPENDED","IP_NOT_ALLOWED"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"405":{"description":"Only POST is accepted. Answered before the API key is checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"429":{"description":"A rate limit was reached. The daily count resets at midnight UTC. Codes: RATE_LIMIT_MINUTE, RATE_LIMIT_DAILY.","content":{"application/json":{"schema":{"type":"object","required":["success","code","message"],"properties":{"success":{"type":"boolean","const":false},"code":{"type":"string","enum":["RATE_LIMIT_MINUTE","RATE_LIMIT_DAILY"]},"message":{"type":"string"},"error":{"type":"string","description":"Same text as message."}}}}}},"500":{"description":"The check could not be recorded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"502":{"description":"The payer network could not be reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"503":{"description":"Eligibility checks are not switched on for this environment.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"default":{"description":"The payer network refused the check. Its HTTP status is passed through with { error, details }.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}}}}},"/api/auth/token-exchange":{"post":{"operationId":"exchangeSignInToken","tags":["Embedded sign-in"],"summary":"Exchange your sign-in token for a session","description":"For partners that show LastMileRCM inside their own application. Send the signed token your identity provider issued for the user; when the issuer is one we have set up with you, the token is valid and the request comes from an allowed origin, the answer is a session for that user. This endpoint does not use the API key.","security":[],"x-rate-limited":false,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string","description":"Signed JWT from your identity provider."}}}}}},"responses":{"200":{"description":"A session for the user.","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string"},"refresh_token":{"type":"string"},"expires_in":{"type":"integer","description":"Seconds."},"expires_at":{"type":"integer","description":"Unix time, seconds."},"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"}}}}}}}},"400":{"description":"The token is missing, malformed, or lacks a claim we need.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"401":{"description":"The token has expired or failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"403":{"description":"The issuer is not set up, the origin is not allowed, or the user may not sign in. Two refusals carry a code: TENANT_SUSPENDED when this organization's access is suspended, and MEMBERSHIP_INACTIVE when the user was removed from the organization. A removed user gets access back only when an administrator adds them again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"405":{"description":"Only POST is accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}},"500":{"description":"The session could not be created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleError"}}}}}}}},"webhooks":{"claim.status_changed":{"post":{"operationId":"onClaimStatusChangedEvent","tags":["Events we send you"],"summary":"A claim moved to another status, or a prior authorization hold was placed on or cleared from a draft.","description":"Sent to the URL you registered for this event type. See \"Events we send you\" in the introduction for signing and retries.","parameters":[{"name":"X-LastMile-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"sha256=<hex>: HMAC-SHA256 of the raw request body, keyed with your signing secret."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimStatusChangedEvent"},"example":{"event_id":"3f2504e0-4f89-41d3-9a0c-0305e82c3301","event_type":"claim.status_changed","tenant_external_id":null,"data":{"patient_control_number":"MC-2026-000123","status":"paid"},"emitted_at":"2026-11-12T17:04:12.000Z"}}}},"responses":{"2XX":{"description":"Received. Any 2xx status acknowledges the event."},"4XX":{"description":"Refused. The event is not sent again."},"5XX":{"description":"Failed. The event is sent again later."}}}},"claim.remittance_received":{"post":{"operationId":"onClaimRemittanceReceivedEvent","tags":["Events we send you"],"summary":"A payment or remittance was posted to a claim.","description":"Sent to the URL you registered for this event type. See \"Events we send you\" in the introduction for signing and retries.","parameters":[{"name":"X-LastMile-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"sha256=<hex>: HMAC-SHA256 of the raw request body, keyed with your signing secret."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimRemittanceReceivedEvent"},"example":{"event_id":"3f2504e0-4f89-41d3-9a0c-0305e82c3301","event_type":"claim.remittance_received","tenant_external_id":null,"data":{"patient_control_number":"MC-2026-000123","total_paid_amount":132.5,"check_number":null,"eft_trace_number":"0123456789","payment_date":"2026-09-30"},"emitted_at":"2026-11-12T17:04:12.000Z"}}}},"responses":{"2XX":{"description":"Received. Any 2xx status acknowledges the event."},"4XX":{"description":"Refused. The event is not sent again."},"5XX":{"description":"Failed. The event is sent again later."}}}},"eligibility.completed":{"post":{"operationId":"onEligibilityCompletedEvent","tags":["Events we send you"],"summary":"An eligibility check finished.","description":"Sent to the URL you registered for this event type. See \"Events we send you\" in the introduction for signing and retries.","parameters":[{"name":"X-LastMile-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"sha256=<hex>: HMAC-SHA256 of the raw request body, keyed with your signing secret."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EligibilityCompletedEvent"},"example":{"event_id":"3f2504e0-4f89-41d3-9a0c-0305e82c3301","event_type":"eligibility.completed","tenant_external_id":null,"data":{"patient_id":"f1a2b3c4-d5e6-7890-abcd-1234567890ab","coverage_id":"11112222-3333-4444-5555-666677778888","status":"active","errors":[]},"emitted_at":"2026-11-12T17:04:12.000Z"}}}},"responses":{"2XX":{"description":"Received. Any 2xx status acknowledges the event."},"4XX":{"description":"Refused. The event is not sent again."},"5XX":{"description":"Failed. The event is sent again later."}}}},"enrollment.status_changed":{"post":{"operationId":"onEnrollmentStatusChangedEvent","tags":["Events we send you"],"summary":"A provider enrollment with a payer was created or moved to another status. Until an enrollment is live, claims for that provider and payer cannot be sent electronically.","description":"Sent to the URL you registered for this event type. See \"Events we send you\" in the introduction for signing and retries.","parameters":[{"name":"X-LastMile-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"sha256=<hex>: HMAC-SHA256 of the raw request body, keyed with your signing secret."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentStatusChangedEvent"},"example":{"event_id":"3f2504e0-4f89-41d3-9a0c-0305e82c3301","event_type":"enrollment.status_changed","tenant_external_id":null,"data":{"enrollment_id":"5c1d0c3e-2a4b-4f6d-8e9f-0a1b2c3d4e5f","provider_id":"0a1b2c3d-4e5f-6789-abcd-ef0123456789","provider_npi":"1234567890","payer_id":"9f8e7d6c-5b4a-3210-fedc-ba9876543210","payer_name":"Example Health Plan","payer_identifier":"12345","transactions":["claimPayment","professionalClaimSubmission"],"previous_status":"provisioning","status":"live","changed_at":"2026-11-12T17:04:11.000Z","reason":null},"emitted_at":"2026-11-12T17:04:12.000Z"}}}},"responses":{"2XX":{"description":"Received. Any 2xx status acknowledges the event."},"4XX":{"description":"Refused. The event is not sent again."},"5XX":{"description":"Failed. The event is sent again later."}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key issued during onboarding. Starts with lmr_, at least 32 characters."}},"schemas":{"InboundRequest":{"type":"object","properties":{"patients":{"type":"array","items":{"type":"object","properties":{"external_id":{"description":"Your ID for this person. The key a re-send is matched on: a patient already known by this ID is updated, not duplicated.","type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"date_of_birth":{"type":"string","description":"Date of birth. YYYY-MM-DD preferred; M/D/YYYY and CCYYMMDD are also accepted. Must be a real date, not in the future. Encrypted at rest."},"gender":{"description":"M, F, Male or Female, in any case. Anything else is not stored.","type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"address":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"state":{"description":"Two-letter state code.","type":"string"},"postal_code":{"description":"Stored as the first five digits.","type":"string"}}},"provider":{"type":"object","properties":{"npi":{"type":"string","description":"National Provider Identifier, exactly 10 digits. A provider not yet on your account is looked up in the national NPI registry and created from the registry record; an NPI the registry does not know is refused (NPI_NOT_FOUND)."},"tax_id":{"description":"EIN or SSN. Used only when the provider is created. Encrypted at rest.","type":"string"},"tax_id_type":{"description":"EIN or SSN.","type":"string"},"contact_email":{"description":"Contact for enrollment paperwork. Encrypted at rest.","type":"string"}},"required":["npi"],"description":"Billing provider for this patient."},"coverage":{"type":"object","properties":{"payer_name":{"description":"Payer name. Matched exactly against the payer directory, ignoring case, spaces and punctuation, or against a name mapping saved for your account. Never matched by best guess. Required unless payer_id is sent.","type":"string"},"payer_id":{"description":"Electronic payer ID. Takes priority over the name.","type":"string"},"member_id":{"type":"string","description":"Member or subscriber ID. Encrypted at rest. A coverage without a member_id is ignored."},"group_number":{"type":"string"},"plan_name":{"type":"string"},"coverage_type":{"description":"Defaults to primary.","type":"string","enum":["primary","secondary","tertiary"]},"effective_date":{"type":"string","description":"Coverage start. YYYY-MM-DD preferred; M/D/YYYY and CCYYMMDD are also accepted."},"termination_date":{"type":"string","description":"Coverage end. YYYY-MM-DD preferred; M/D/YYYY and CCYYMMDD are also accepted."},"eligibility_payer_id":{"description":"Electronic payer ID of the plan that answers eligibility requests, for payers that route eligibility through another plan. One we cannot match is ignored with a warning; the coverage is still saved.","type":"string"}},"required":["member_id"],"description":"Insurance coverage. Matched on patient, payer and coverage_type; a re-send updates only the fields whose value changed. When the payer named is one set up on your account as a carve-out of another plan, no coverage is created or changed: the claim goes on the one active coverage the patient already has with the plan it is carved out of. If the patient has none, or more than one, the claim is skipped (CLAIM_MISSING_COVERAGE) with the reason."},"claim":{"type":"object","properties":{"service_date":{"type":"string","description":"Date of service. YYYY-MM-DD preferred; M/D/YYYY and CCYYMMDD are also accepted."},"place_of_service":{"description":"CMS place of service code. Defaults to 11.","type":"string"},"prior_auth_number":{"type":"string"},"total_charge":{"description":"Total charge in US dollars. Defaults to the sum of the service line charges.","type":"number"},"partner_claim_ref":{"description":"Your own claim number: the key a re-send is matched on. Required on original claims unless patient_control_number is sent (CLAIM_REF_REQUIRED). A re-send with the same reference updates the claim it created while that claim is still draft, validated or rejected; later it is locked (CLAIM_LOCKED). Two services on one date need two references.","type":"string"},"patient_control_number":{"description":"Claim number to use, at most 20 characters. Also used as the reference when partner_claim_ref is not sent. When neither fits, we generate the number and return it as pcn.","type":"string"},"claim_frequency_code":{"description":"1 original (default), 7 replacement, 8 void. 7 and 8 need original_patient_control_number and a claim the payer has already received. A void is sent to the payer at once; a replacement is created as a draft.","type":"string","enum":["1","7","8"]},"original_patient_control_number":{"description":"For 7 and 8: the claim number, or your reference, of the claim being replaced or voided.","type":"string"},"reason":{"description":"Note kept with a void. At most 500 characters are kept.","type":"string"},"diagnoses":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","description":"ICD-10 code, with or without the decimal point."},"type":{"description":"\"secondary\" marks a secondary diagnosis. Anything else, or nothing, is principal.","type":"string"}},"required":["code"]},"description":"At least one. Order is kept."},"service_lines":{"type":"array","items":{"type":"object","properties":{"procedure_code":{"type":"string","description":"CPT or HCPCS code, exactly 5 letters or digits."},"description":{"type":"string"},"units":{"description":"Above 0. Defaults to 1.","type":"number"},"charge_amount":{"type":"number","description":"Charge in US dollars, 0 or more."},"modifier_1":{"type":"string"},"modifier_2":{"type":"string"},"modifier_3":{"type":"string"},"modifier_4":{"type":"string"}},"required":["procedure_code","charge_amount"]},"description":"At least one. A line that fails its checks stops the whole claim (SERVICE_LINE_INVALID)."},"simulation":{"type":"object","properties":{"acknowledgement":{"description":"Defaults to accepted.","type":"string","enum":["accepted","rejected"]},"remittance":{"description":"Defaults to paid.","type":"string","enum":["paid","underpaid_20","underpaid_50","overpaid_20","overpaid_50","denied"]}},"description":"Demo accounts only: how the simulated payer should answer this claim. Ignored on live accounts."}},"required":["service_date","diagnoses","service_lines"],"description":"One claim. Needs a provider and a coverage on the same patient record. Created as a draft, then checked."},"consent":{"description":"True: you attest this person agreed to the processing of their personal data.","type":"boolean"}},"required":["first_name","last_name","date_of_birth"]},"description":"At least one. Always an array, even for one patient."},"metadata":{"type":"object","properties":{"source_system":{"type":"string"},"source_id":{"description":"Your reference for this batch.","type":"string"},"idempotency_key":{"description":"Unique per batch. See Idempotency.","type":"string"},"consent_attested":{"description":"True: the consent attestation applies to every patient in the batch.","type":"boolean"},"organization_slug":{"description":"Site or organization the batch belongs to. Created on first use; every patient and provider in the batch is linked to it.","type":"string"}}}},"required":["patients"]},"InboundResponse":{"type":"object","properties":{"success":{"type":"boolean"},"code":{"type":"string"},"message":{"type":"string"},"webhook_id":{"description":"ID of this batch. Quote it when asking for help.","type":"string"},"processed":{"type":"object","properties":{"patients":{"type":"object","properties":{"created":{"type":"integer"},"updated":{"type":"integer","description":"Known patients where at least one value really changed."},"existing":{"type":"integer","description":"Known patients sent again with nothing changed."},"failed":{"type":"integer"}},"required":["created","updated","existing","failed"]},"claims":{"type":"object","properties":{"created":{"type":"integer"},"updated":{"type":"integer"},"existing":{"type":"integer","description":"Claims sent again with nothing changed."},"voided":{"type":"integer"},"skipped":{"type":"integer"},"failed":{"type":"integer"}},"required":["created","updated","existing","voided","skipped","failed"]},"providers":{"type":"object","properties":{"created":{"type":"integer"},"existing":{"type":"integer"},"failed":{"type":"integer"}},"required":["created","existing","failed"]},"payers":{"type":"object","properties":{"resolved":{"type":"integer"},"not_found":{"type":"integer"}},"required":["resolved","not_found"]},"coverages":{"type":"object","properties":{"created":{"type":"integer"},"updated":{"type":"integer","description":"Known coverages where at least one value really changed."},"existing":{"type":"integer","description":"Known coverages sent again with nothing changed."},"failed":{"type":"integer"}},"required":["created","updated","existing","failed"]},"enrollments":{"type":"object","properties":{"created":{"type":"integer"},"existing":{"type":"integer"}},"required":["created","existing"]}},"required":["patients","claims","providers","payers","coverages","enrollments"]},"items":{"description":"One entry per patient record, in the order sent.","type":"array","items":{"type":"object","properties":{"index":{"type":"integer","description":"Position in the patients array, from 0."},"identifier":{"type":"string","description":"external_id when sent, otherwise patient[N]."},"status":{"type":"string","enum":["success","partial","failed"],"description":"success: no errors. partial: the patient was saved and something else on the item failed. failed: nothing on the item was saved."},"patient":{"type":"object","properties":{"id":{"type":"string","description":"UUID."},"action":{"type":"string","enum":["created","existing","updated"],"description":"existing: already known and nothing you sent differs from what is stored. updated: at least one value really changed."}},"required":["id","action"]},"provider":{"type":"object","properties":{"id":{"type":"string","description":"UUID."},"npi":{"type":"string"},"action":{"type":"string","enum":["created","existing"]}},"required":["id","npi","action"]},"payer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","description":"UUID."},"name":{"type":"string"},"action":{"type":"string","const":"resolved"}},"required":["id","name","action"]},{"type":"object","properties":{"name":{"type":"string"},"action":{"type":"string","const":"not_found"},"candidates":{"description":"Up to five suggestions.","type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}}},"required":["name","action"]}]},"coverage":{"type":"object","properties":{"id":{"type":"string","description":"UUID."},"action":{"type":"string","enum":["created","existing","updated"]}},"required":["id","action"]},"claim":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","description":"UUID."},"pcn":{"type":"string","description":"Claim number (patient control number)."},"action":{"type":"string","enum":["created","updated","existing","conflict","voided"]}},"required":["id","pcn","action"]},{"type":"object","properties":{"action":{"type":"string","enum":["skipped","duplicate"]}},"required":["action"]}]},"enrollment":{"type":"object","properties":{"action":{"type":"string","enum":["created","existing"]}},"required":["action"]},"errors":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","description":"One of the item codes listed for this endpoint."},"message":{"type":"string"}},"required":["code","message"]}}},"required":["index","identifier","status"]}},"errors":{"description":"Every error message in one flat list. Present only when there are errors.","type":"array","items":{"type":"string"}},"result_status":{"description":"Replay of a finished batch only: how that batch ended.","type":"string"},"claims":{"description":"Replay of a finished batch only: the claims that batch touched, with their current status.","type":"array","items":{"type":"object","properties":{"claim_id":{"type":"string"},"patient_control_number":{"type":"string"},"status":{"type":"string"}},"required":["claim_id","patient_control_number","status"]}}},"required":["success","code","message"]},"ClaimsListResponse":{"type":"object","properties":{"success":{"type":"boolean","const":true},"code":{"type":"string","const":"OK"},"pagination":{"type":"object","properties":{"limit":{"type":"integer"},"offset":{"type":"integer"},"count":{"type":"integer"},"has_more":{"type":"boolean","description":"True: ask for the next page with offset + limit."}},"required":["limit","offset","count","has_more"]},"claims":{"type":"array","items":{"type":"object","properties":{"claim_id":{"type":"string"},"patient_control_number":{"type":"string"},"payer_claim_control_number":{"type":["string","null"]},"external_patient_id":{"type":["string","null"]},"consent_status":{"type":"string","description":"not_recorded, granted or revoked."},"payer_name":{"type":["string","null"]},"status":{"type":"string"},"holds":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","description":"prior_authorization."},"status":{"type":"string","description":"needed, requested or denied."},"label":{"type":"string"}},"required":["type","status","label"]},"description":"What is stopping a claim that has not been filed. A claim waiting on prior authorization is a draft with one hold."},"service_date_from":{"type":"string"},"service_date_to":{"type":"string"},"total_charge_amount":{"type":"number","description":"US dollars."},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["claim_id","patient_control_number","payer_claim_control_number","external_patient_id","consent_status","payer_name","status","holds","service_date_from","service_date_to","total_charge_amount","created_at","updated_at"]}}},"required":["success","code","pagination","claims"]},"EncountersRequest":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"external_patient_id":{"type":"string","description":"Your ID for the person. Must already be known from the data feed."},"encounter_date":{"type":"string","description":"Date of the encounter. YYYY-MM-DD preferred; M/D/YYYY and CCYYMMDD are also accepted."},"encounter_type":{"description":"For example in_person, phone, outreach. At most 60 characters are kept.","type":"string"},"code":{"description":"At most 20 characters are kept.","type":"string"},"reference":{"description":"Your own ID for this encounter. Sending the same reference again is reported as duplicate and stores nothing.","type":"string"}},"required":["external_patient_id","encounter_date"]},"description":"1 to 500 encounters."}},"required":["items"]},"EncountersPostResponse":{"type":"object","properties":{"success":{"type":"boolean","const":true},"summary":{"type":"object","properties":{"received":{"type":"integer"},"created":{"type":"integer"},"duplicates":{"type":"integer"},"failed":{"type":"integer"}},"required":["received","created","duplicates","failed"]},"results":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"status":{"type":"string","enum":["created","duplicate","failed"]},"error":{"type":"string"}},"required":["index","status"]}}},"required":["success","summary","results"]},"EncountersCountResponse":{"type":"object","properties":{"external_patient_id":{"type":"string"},"month":{"type":"string","description":"YYYY-MM."},"encounters":{"type":"integer","description":"Total for the month."},"from_claims":{"type":"integer","description":"Encounters that were billed on a claim."},"non_billable":{"type":"integer","description":"Encounters sent through this endpoint."}},"required":["external_patient_id","month","encounters","from_claims","non_billable"]},"ClaimsCancelRequest":{"type":"object","properties":{"patient_control_numbers":{"type":"array","items":{"type":"string"},"description":"1 to 100 claim numbers."},"reason":{"description":"Note kept with the cancellation. At most 500 characters are kept.","type":"string"}},"required":["patient_control_numbers"]},"ClaimsCancelResponse":{"type":"object","properties":{"cancelled":{"type":"array","items":{"type":"string"},"description":"Claim numbers that were drafts and are now cancelled."},"skipped":{"type":"array","items":{"type":"object","properties":{"patient_control_number":{"type":"string"},"status":{"type":"string"}},"required":["patient_control_number","status"]},"description":"Claims past draft. Left as they are, for a person to decide."},"not_found":{"type":"array","items":{"type":"string"}},"failed":{"description":"Present only when a cancellation could not be saved.","type":"array","items":{"type":"object","properties":{"patient_control_number":{"type":"string"},"error":{"type":"string"}},"required":["patient_control_number","error"]}}},"required":["cancelled","skipped","not_found"]},"ContractRatesResponse":{"type":"object","properties":{"contract_id":{"type":"string"},"contract_name":{"type":"string"},"payer_id":{"type":"string"},"payer_display_name":{"type":"string"},"rates":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"description":"Active fee schedule lines: procedure_code, modifier_1 to modifier_4, rate_type, rate_amount (US dollars), rate_calculation, units_per_rate, unit_type, is_active."},"admin_rates":{"type":"array","items":{},"description":"Fee schedule lines billed on their own procedure code as an administrative line. Not filtered by procedure_codes."}},"required":["contract_id","contract_name","payer_id","payer_display_name","rates","admin_rates"]},"DefaultProviderResponse":{"type":"object","properties":{"npi":{"type":"string"},"tax_id":{"type":"string"},"tax_id_type":{"type":"string"}},"required":["npi"]},"ConfiguredPayersResponse":{"type":"object","properties":{"payers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"display_name":{"type":"string"},"stedi_id":{"type":"string","description":"Directory identifier of the payer."},"primary_payer_id":{"description":"Electronic payer ID.","type":["string","null"]}},"required":["id","display_name","stedi_id","primary_payer_id"]},"description":"Payers your account has an active contract with today, sorted by name."}},"required":["payers"]},"EligibilityCheckRequest":{"type":"object","properties":{"patient":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"date_of_birth":{"type":"string","description":"Date of birth. YYYY-MM-DD preferred; M/D/YYYY and CCYYMMDD are also accepted."},"gender":{"description":"M, F, Male or Female, in any case.","type":"string"}},"required":["first_name","last_name","date_of_birth"]},"coverage":{"type":"object","properties":{"payer_name":{"type":"string","description":"Matched exactly, as on the data feed."},"member_id":{"type":"string"},"payer_id":{"description":"Electronic payer ID. Takes priority over the name.","type":"string"},"eligibility_payer_id":{"description":"Electronic payer ID of the plan that answers eligibility, for payers that route it through another plan.","type":"string"}},"required":["payer_name","member_id"]},"provider_npi":{"description":"10-digit NPI of a provider on your account. Defaults to the account default provider.","type":"string"},"service_type_codes":{"description":"Defaults to [\"30\"], health benefit plan coverage.","type":"array","items":{"type":"string"}},"date_of_service":{"type":"string","description":"Defaults to today. YYYY-MM-DD preferred; M/D/YYYY and CCYYMMDD are also accepted."},"external_patient_id":{"description":"Your ID for the person. A known ID reuses that patient; an unknown one creates the patient.","type":"string"}},"required":["patient","coverage"]},"EligibilityCheckResponse":{"type":"object","properties":{"success":{"type":"boolean","const":true},"eligibility_check_id":{"type":"string"},"eligibility_status":{"type":"string","enum":["active","inactive","unknown"]},"plan_status":{"description":"The plan status text from the payer.","type":"string"},"benefits":{"description":"Benefit lines from the payer response, as received."},"response":{"description":"The full payer response, as received."},"demo_mode":{"type":"boolean","description":"True: the answer was simulated, no payer was asked."}},"required":["success","eligibility_check_id","eligibility_status","response","demo_mode"]},"CodedError":{"type":"object","properties":{"success":{"type":"boolean","const":false},"code":{"type":"string"},"message":{"type":"string"},"error":{"description":"Same text as message. Sent only by the endpoints that answer their own errors with { error }.","type":"string"},"webhook_id":{"type":"string"}},"required":["success","code","message"]},"SimpleError":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"},"details":{"type":"string"},"candidates":{"description":"Suggested payers when a payer could not be matched.","type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}}},"required":["error"]},"ClaimStatusChangedEvent":{"type":"object","required":["event_id","event_type","tenant_external_id","data","emitted_at"],"properties":{"event_id":{"type":"string","description":"UUID. The same on every retry of this event: use it to ignore repeats."},"event_type":{"type":"string","const":"claim.status_changed"},"tenant_external_id":{"type":["string","null"],"description":"Your own ID for the account, when one was registered."},"data":{"type":"object","properties":{"patient_control_number":{"type":"string"},"status":{"type":"string"},"holds":{"description":"Sent when known. The event also fires when only the holds change.","type":"array","items":{"type":"object","properties":{"type":{"type":"string","description":"prior_authorization."},"status":{"type":"string","description":"needed, requested or denied."},"label":{"type":"string"}},"required":["type","status","label"]}}},"required":["patient_control_number","status"]},"emitted_at":{"type":"string","format":"date-time"}}},"ClaimRemittanceReceivedEvent":{"type":"object","required":["event_id","event_type","tenant_external_id","data","emitted_at"],"properties":{"event_id":{"type":"string","description":"UUID. The same on every retry of this event: use it to ignore repeats."},"event_type":{"type":"string","const":"claim.remittance_received"},"tenant_external_id":{"type":["string","null"],"description":"Your own ID for the account, when one was registered."},"data":{"type":"object","properties":{"patient_control_number":{"type":"string"},"total_paid_amount":{"type":"number","description":"US dollars."},"check_number":{"type":["string","null"]},"eft_trace_number":{"type":["string","null"]},"payment_date":{"type":["string","null"]}},"required":["patient_control_number","total_paid_amount","check_number","eft_trace_number","payment_date"]},"emitted_at":{"type":"string","format":"date-time"}}},"EligibilityCompletedEvent":{"type":"object","required":["event_id","event_type","tenant_external_id","data","emitted_at"],"properties":{"event_id":{"type":"string","description":"UUID. The same on every retry of this event: use it to ignore repeats."},"event_type":{"type":"string","const":"eligibility.completed"},"tenant_external_id":{"type":["string","null"],"description":"Your own ID for the account, when one was registered."},"data":{"type":"object","properties":{"patient_id":{"type":["string","null"]},"coverage_id":{"type":["string","null"]},"member_id":{"type":["string","null"]},"status":{"type":"string","description":"active, inactive or unknown."},"errors":{"type":"array","items":{"type":"object","properties":{"code":{"type":["string","number"]},"description":{"type":"string"},"followupAction":{"type":"string"},"possibleResolutions":{"type":"string"},"location":{"type":"string"}}},"description":"Rejection reasons from the payer, when it refused the request."}},"required":["patient_id","status","errors"]},"emitted_at":{"type":"string","format":"date-time"}}},"EnrollmentStatusChangedEvent":{"type":"object","required":["event_id","event_type","tenant_external_id","data","emitted_at"],"properties":{"event_id":{"type":"string","description":"UUID. The same on every retry of this event: use it to ignore repeats."},"event_type":{"type":"string","const":"enrollment.status_changed"},"tenant_external_id":{"type":["string","null"],"description":"Your own ID for the account, when one was registered."},"data":{"type":"object","properties":{"enrollment_id":{"type":"string"},"provider_id":{"type":"string"},"provider_npi":{"type":["string","null"]},"payer_id":{"type":"string"},"payer_name":{"type":["string","null"]},"payer_identifier":{"description":"Electronic payer ID, when the directory has one.","type":["string","null"]},"transactions":{"type":"array","items":{"type":"string"},"description":"What the enrollment covers, for example professionalClaimSubmission, claimPayment, eligibilityCheck, claimStatus."},"previous_status":{"anyOf":[{"type":"string","enum":["draft","in_review","provider_action_required","provisioning","live","rejected","canceled","terminated"]},{"type":"null"}],"description":"null when the enrollment was just created."},"status":{"type":"string","enum":["draft","in_review","provider_action_required","provisioning","live","rejected","canceled","terminated"],"description":"live: claims for this provider and payer can go out electronically."},"changed_at":{"type":"string","description":"ISO-8601 timestamp."},"reason":{"type":["string","null"]}},"required":["enrollment_id","provider_id","provider_npi","payer_id","payer_name","payer_identifier","transactions","previous_status","status","changed_at","reason"]},"emitted_at":{"type":"string","format":"date-time"}}}}}}