API v1 reference: read and write

Routes that read from and write to a clinic on Moonshot EHR. Public routes need no key and only read the clinic's services, providers, membership plans and open times: the same information the clinic's booking and membership pages already show. Plus a secret API key for the clinic's own integration, the route that checks one, lead routes that create a lead and read its progress with it, and chart routes that read patient records and add to them, for a system covered by the clinic's business associate agreement.

What a key can write

With a secret API key the clinic's owner created, a server covered by the clinic's business associate agreement can write to the clinic's charts:

Nothing written through the API is signed, sent to the patient, prescribed, booked or charged. Permissions, limits and rules: Writing.

Basics

GET /api/v1/catalog

The clinic (name, slug, phone, booking_mode), its appointment_types (id, name, duration_minutes, visit_mode, bookable_online), providers (id, display_name, title, appointment_type_ids), memberships.available and membership_plans (product_code, name, price_cents, interval).

GET /api/v1/availability

Query: appointment_type_id (required), date (required, YYYY-MM-DD in the clinic's time zone), provider_id (optional).

{
  "data": {
    "date": "2026-11-16",
    "duration": 30,
    "slots": [
      { "time": "09:00", "end_time": "09:30", "provider_id": "8a2b4c6d-1e3f-4a5b-8c7d-9e0f1a2b3c4d", "provider_name": "Dana Reyes", "provider_title": "NP" }
    ]
  },
  "next_cursor": null
}

GET /api/v1/availability/summary

Query: appointment_type_id (required), from and to (required, up to 62 days apart; clamped to start today), provider_id (optional). Open-time counts per day.

{ "data": { "summary": { "2026-11-16": 6, "2026-11-17": 0 } }, "next_cursor": null }

Secret API keys

For the clinic's own integration, called from a server. The clinic's owner creates a key in the EHR (Settings, Developers, API keys), chooses its permissions and how long it lasts (12 months by default, never longer), and copies it once: it is never shown again. A live clinic's key starts mck_live_, a test clinic's mck_test_.

GET /api/v1/key

Checks the key you sent: the clinic it belongs to, its prefix (as the clinic's Settings list shows it), its permissions and when it expires. Any valid key may call it; nothing else is returned.

curl -s https://api.moonshotehr.com/api/v1/key -H 'Authorization: Bearer <key>'
{
  "data": {
    "clinic": "northside",
    "key_prefix": "mck_live_3f9a2c1e",
    "scopes": ["leads:write"],
    "expires_at": "2027-10-05T14:00:00.000Z"
  },
  "next_cursor": null
}

POST /api/v1/leads

Creates a lead on the clinic's Leads board, the same way the clinic's website form does. Needs leads:write. Body (JSON): email (required), first_name, last_name or name, phone, source, service_interest, notes, attribution (an object of UTM and click-id keys). Full field rules: Send leads.

curl -s https://api.moonshotehr.com/api/v1/leads -H 'Authorization: Bearer <key>' \
  -H 'Content-Type: application/json' -H 'Idempotency-Key: form-submission-81723' \
  -d '{ "email": "dana@example.com", "first_name": "Dana", "attribution": { "utm_source": "google" } }'
{ "data": { "id": "8d1c2b3a-4e5f-4a6b-9c7d-0e1f2a3b4c5d", "status": "new", "created_at": "2026-11-16T15:04:05.000Z", "duplicate": false, "note_saved": true }, "next_cursor": null }

PATCH /api/v1/leads/{id}

Corrects first_name, last_name, email, phone or attribution keys (the keys sent replace those keys; others are kept). Needs leads:write. Status, owner, notes and everything else the clinic's staff own are refused with 400 naming the field. Only leads this API created can be corrected; any other id is 404. Idempotency-Key is ignored here.

{ "data": { "id": "8d1c2b3a-4e5f-4a6b-9c7d-0e1f2a3b4c5d", "updated_at": "2026-11-17T09:30:00.000Z" }, "next_cursor": null }

GET /api/v1/leads/{id}/status

Three yes-or-no answers about the person behind the lead, defined as in the clinic's own conversion report: booked (an appointment booked after the lead came in), onboarding_completed (forms completed, none outstanding), member (a membership started after the lead came in). Needs leads:read. Only for leads this API created (a duplicate of a lead that came in another way answers without status); any other id is 404. Also attribution, the attribution keys stored on the lead. When the clinic owner has turned on payment sharing (off by default; only for an agency under a business associate agreement with the clinic), a payments summary: paid_total_cents kept after refunds since the lead came in, without card surcharges or sales tax (so it can be lower than the Collected figure in the clinic's own reports), payment_count, first_paid_at, last_paid_at (the clinic's local dates, YYYY-MM-DD), currency; card chargebacks are not taken off. When it is off, payments is absent, not zero. No names, contact details, line items or clinical data, but amounts and dates can still reveal which plan or service a patient bought.

{ "data": { "id": "8d1c2b3a-4e5f-4a6b-9c7d-0e1f2a3b4c5d", "booked": true, "onboarding_completed": false, "member": false, "updated_at": "2026-11-20T16:30:00.000Z", "attribution": { "utm_source": "google", "utm_campaign": "fall" }, "payments": { "paid_total_cents": 39000, "payment_count": 2, "first_paid_at": "2026-11-19", "last_paid_at": "2026-11-20", "currency": "USD" } }, "next_cursor": null }

The lead routes answer 403 phi_access_disabled until the clinic's business associate agreement with Moonshot EHR is in place, and never return an email address or phone number.

GET /api/v1/reports/leads

The clinic's lead and conversion totals for a period: the same numbers and definitions as the Funnel report the clinic's owner sees in the EHR. Needs reports:read. Counts only: no names, contact details, ids, campaign text, staff names or per-lead rows.

{"data": {"as_of": "2026-11-30T15:04:05.000Z", "range": {"from": "2026-10-01", "to": "2026-10-31", "days": 31, "preset": "last_month", "timezone": "America/Chicago"}, "group_by": "source", "definitions": ["leads: every lead created in the period ...", "..."], "totals": {"leads": 46, "new_prospect_leads": 40, "existing_patient_leads": 6, "new_patient_leads": 14, "steps": [{"key": "booked", "label": "Consultation booked", "count": 18, "rate_from_previous": 45, "rate_from_cohort": 45}, {"key": "attended", "label": "Attended", "count": 12, "rate_from_previous": 66.7, "rate_from_cohort": 30}, {"key": "member", "label": "Became a member", "count": 7, "rate_from_previous": 58.3, "rate_from_cohort": 17.5}, {"key": "paid", "label": "First payment", "count": 11, "rate_from_previous": 27.5, "rate_from_cohort": 27.5}], "converted_patients": 10, "collected_cents": 412500, "collected_per_lead_cents": 10313, "collected_per_converted_patient_cents": 41250}, "rows": [{"key": "google", "label": "Google", "leads": 38, "new_prospect_leads": 36, "existing_patient_leads": 2, "new_patient_leads": 13, "steps": [{"key": "booked", "label": "Consultation booked", "count": 17, "rate_from_previous": 47.2, "rate_from_cohort": 47.2}, {"key": "attended", "label": "Attended", "count": 11, "rate_from_previous": 64.7, "rate_from_cohort": 30.6}, {"key": "member", "label": "Became a member", "count": 7, "rate_from_previous": 63.6, "rate_from_cohort": 19.4}, {"key": "paid", "label": "First payment", "count": 10, "rate_from_previous": 27.8, "rate_from_cohort": 27.8}], "converted_patients": 9, "collected_cents": 383000, "collected_per_lead_cents": 10639, "collected_per_converted_patient_cents": 42556}], "currency": "USD"}, "next_cursor": null}

Like the lead routes, the report answers 403 phi_access_disabled until the clinic's business associate agreement with Moonshot EHR is in place.

GET /api/v1/patients

These routes read; none of them changes anything. The routes that add to a chart are under Writing. Server to server, with a key that has the permission named on each route. Only the clinic's owner can create such a key, and only after confirming that the receiving system is covered by the clinic's business associate agreement and that the data will not be forwarded to advertising platforms; a key made before these routes existed does not gain them. Until the clinic's business associate agreement with Moonshot EHR is in place they answer 403 phi_access_disabled.

The clinic's patients, oldest change first, one page at a time. A deleted patient and a chart the clinic has restricted are never listed. Needs charts:read. Read-only.

Parameters: limit (optional, 1 to 100, default 50; above 100 is 400 invalid_request), cursor (optional, the previous page's next_cursor), updated_since (optional, YYYY-MM-DD or an ISO 8601 date and time with a time zone: only rows created or changed since then). Any other parameter is 400 invalid_request.

{"data": [{"id": "3f6b2a9e-1c4d-4e8a-9b7f-2d5c8e1a4b60", "first_name": "Avery", "last_name": "Sample", "date_of_birth": "1984-03-12", "sex": "female", "email": "avery.sample@example.com", "phone": "+15555550123", "status": "active", "created_at": "2026-02-04T15:20:00.000Z", "updated_at": "2026-11-20T15:04:05.123Z"}], "next_cursor": "eyJ0IjoiMjAyNi0xMS0yMFQxNTowNDowNS4xMjM0NTZaIiwiaSI6IjNmNmIyYTllLTFjNGQtNGU4YS05YjdmLTJkNWM4ZTFhNGI2MCJ9"}

GET /api/v1/patients/{id}

One patient's demographics. Needs charts:read. Read-only.

No query parameters; any is 400 invalid_request.

{"data": {"id": "3f6b2a9e-1c4d-4e8a-9b7f-2d5c8e1a4b60", "first_name": "Avery", "last_name": "Sample", "date_of_birth": "1984-03-12", "sex": "female", "email": "avery.sample@example.com", "phone": "+15555550123", "status": "active", "created_at": "2026-02-04T15:20:00.000Z", "updated_at": "2026-11-20T15:04:05.123Z"}, "next_cursor": null}

GET /api/v1/patients/{id}/notes

Signed and amended chart notes, and notes the clinic brought over from its previous EHR, without their text; drafts and notes still being written are never returned. status tells them apart: signed, amended or imported_from_prior_ehr. An imported note has no Moonshot signature (signed_at is null); source_ehr_name, original_signed_at and original_signed_by give the signature the previous EHR recorded, when it had one. Fetch one note for its text. Needs charts:read. Read-only.

Parameters: limit (optional, 1 to 100, default 50; above 100 is 400 invalid_request), cursor (optional, the previous page's next_cursor), updated_since (optional, YYYY-MM-DD or an ISO 8601 date and time with a time zone: only rows created or changed since then). Any other parameter is 400 invalid_request.

{"data": [{"id": "0c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f", "visit_date": "2026-11-18", "visit_type": "follow_up", "status": "signed", "is_administrative": false, "provider_name": "Dr. Riley Example", "signed_by_name": "Dr. Riley Example", "signed_at": "2026-11-18T17:42:10.000Z", "source_ehr_name": null, "original_signed_at": null, "original_signed_by": null, "cpt_codes": ["99214"], "icd_codes": ["E55.9"], "created_at": "2026-11-18T16:05:00.000Z", "updated_at": "2026-11-18T17:42:10.000Z"}], "next_cursor": "eyJ0IjoiMjAyNi0xMS0yMFQxNTowNDowNS4xMjM0NTZaIiwiaSI6IjNmNmIyYTllLTFjNGQtNGU4YS05YjdmLTJkNWM4ZTFhNGI2MCJ9"}

GET /api/v1/patients/{id}/notes/{note_id}

One signed, amended or imported note with its text by section and its addenda, as the chart shows it; an imported note's text is under sections.imported_note.content. A draft, or a note of a different patient, answers 404. Needs charts:read. Read-only.

No query parameters; any is 400 invalid_request.

{"data": {"id": "0c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f", "visit_date": "2026-11-18", "visit_type": "follow_up", "status": "signed", "is_administrative": false, "provider_name": "Dr. Riley Example", "signed_by_name": "Dr. Riley Example", "signed_at": "2026-11-18T17:42:10.000Z", "source_ehr_name": null, "original_signed_at": null, "original_signed_by": null, "cpt_codes": ["99214"], "icd_codes": ["E55.9"], "created_at": "2026-11-18T16:05:00.000Z", "updated_at": "2026-11-18T17:42:10.000Z", "appointment_id": null, "sections": {"assessment": "Vitamin D low at 18 ng/mL.", "plan": "Start D3 2000 IU daily; recheck in 12 weeks."}, "addenda": []}, "next_cursor": null}

GET /api/v1/patients/{id}/medications

Current and past medications and supplements. patient_reported: true marks an entry the patient typed on an intake form that the clinic has not confirmed yet. Needs charts:read. Read-only.

Parameters: limit (optional, 1 to 100, default 50; above 100 is 400 invalid_request), cursor (optional, the previous page's next_cursor), updated_since (optional, YYYY-MM-DD or an ISO 8601 date and time with a time zone: only rows created or changed since then). Any other parameter is 400 invalid_request.

{"data": [{"id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d", "name": "Cholecalciferol", "dosage": "2000 IU", "frequency": "once daily", "route": "oral", "status": "active", "kind": "medication", "start_date": "2026-11-18", "end_date": null, "rxnorm_cui": "316965", "prescriber_name": "Dr. Riley Example", "patient_reported": false, "created_at": "2026-11-18T17:40:00.000Z", "updated_at": "2026-11-18T17:40:00.000Z"}], "next_cursor": "eyJ0IjoiMjAyNi0xMS0yMFQxNTowNDowNS4xMjM0NTZaIiwiaSI6IjNmNmIyYTllLTFjNGQtNGU4YS05YjdmLTJkNWM4ZTFhNGI2MCJ9"}

GET /api/v1/patients/{id}/allergies

Allergies, active and inactive. patient_reported as on medications. Needs charts:read. Read-only.

Parameters: limit (optional, 1 to 100, default 50; above 100 is 400 invalid_request), cursor (optional, the previous page's next_cursor), updated_since (optional, YYYY-MM-DD or an ISO 8601 date and time with a time zone: only rows created or changed since then). Any other parameter is 400 invalid_request.

{"data": [{"id": "6b7c8d9e-0f1a-4b2c-9d3e-4f5a6b7c8d9e", "allergen": "Penicillin", "allergy_type": "drug", "severity": "moderate", "reaction": "Hives", "onset_date": null, "status": "active", "patient_reported": true, "notes": null, "created_at": "2026-02-04T15:30:00.000Z", "updated_at": "2026-02-04T15:30:00.000Z"}], "next_cursor": "eyJ0IjoiMjAyNi0xMS0yMFQxNTowNDowNS4xMjM0NTZaIiwiaSI6IjNmNmIyYTllLTFjNGQtNGU4YS05YjdmLTJkNWM4ZTFhNGI2MCJ9"}

GET /api/v1/patients/{id}/problems

The problem list, active and resolved, as the chart shows it. Not paginated and no updated_since: the list carries no per-entry change time. Needs charts:read. Read-only.

No query parameters; any is 400 invalid_request.

{"data": [{"id": "7c8d9e0f-1a2b-4c3d-8e4f-5a6b7c8d9e0f", "name": "Vitamin D deficiency", "icd10_code": "E55.9", "snomed_code": null, "status": "active", "severity": null, "onset_date": "2026-11-18", "resolved_date": null, "source": "chart", "review_status": null}], "next_cursor": null}

GET /api/v1/patients/{id}/labs

Lab orders, pending ones included, each with its results: value, unit, reference range, flag and dates. A deleted order, an order still in draft and a result the lab withdrew are never returned; result_status says whether a result is final or preliminary. updated_since matches an order whose own row changed. Needs charts:read. Read-only.

Parameters: limit (optional, 1 to 100, default 50; above 100 is 400 invalid_request), cursor (optional, the previous page's next_cursor), updated_since (optional, YYYY-MM-DD or an ISO 8601 date and time with a time zone: only rows created or changed since then). Any other parameter is 400 invalid_request.

{"data": [{"id": "8d9e0f1a-2b3c-4d4e-9f5a-6b7c8d9e0f1a", "order_date": "2026-11-10", "collection_date": "2026-11-11", "status": "released", "released_at": "2026-11-13T14:00:00.000Z", "lab_reference_id": "EX123456", "created_at": "2026-11-10T16:00:00.000Z", "updated_at": "2026-11-13T14:00:00.000Z", "results": [{"id": "9e0f1a2b-3c4d-4e5f-8a6b-7c8d9e0f1a2b", "test_name": "Vitamin D, 25-Hydroxy", "panel": "Vitamin D, 25-Hydroxy", "specimen": null, "value": "18", "value_numeric": 18, "unit": "ng/mL", "reference_range": "30-100", "flag": "low", "result_status": "final", "category": "vitamins", "updated_at": "2026-11-13T14:00:00.000Z"}]}], "next_cursor": "eyJ0IjoiMjAyNi0xMS0yMFQxNTowNDowNS4xMjM0NTZaIiwiaSI6IjNmNmIyYTllLTFjNGQtNGU4YS05YjdmLTJkNWM4ZTFhNGI2MCJ9"}

GET /api/v1/patients/{id}/vitals

Vitals as recorded. Body-composition scans are not included. Needs charts:read. Read-only.

Parameters: limit (optional, 1 to 100, default 50; above 100 is 400 invalid_request), cursor (optional, the previous page's next_cursor), updated_since (optional, YYYY-MM-DD or an ISO 8601 date and time with a time zone: only rows created or changed since then). Any other parameter is 400 invalid_request.

{"data": [{"id": "a0f1a2b3-4c5d-4e6f-9a7b-8c9d0e1f2a3b", "recorded_at": "2026-11-18T16:10:00.000Z", "height_inches": 66, "weight_lbs": 152.4, "blood_pressure_systolic": 118, "blood_pressure_diastolic": 76, "heart_rate": 64, "temperature_f": 98.2, "oxygen_saturation": 99, "lean_mass_lbs": null, "fat_mass_lbs": null, "waist_inches": null, "hip_inches": null, "chest_inches": null, "body_fat_percent": null, "lmp_date": null, "notes": null, "created_at": "2026-11-18T16:10:00.000Z", "updated_at": "2026-11-18T16:10:00.000Z"}], "next_cursor": "eyJ0IjoiMjAyNi0xMS0yMFQxNTowNDowNS4xMjM0NTZaIiwiaSI6IjNmNmIyYTllLTFjNGQtNGU4YS05YjdmLTJkNWM4ZTFhNGI2MCJ9"}

GET /api/v1/patients/{id}/appointments

Past and upcoming appointments, including cancelled and no-show ones; a booking still waiting for its payment is not returned. Needs appointments:read. Read-only.

Parameters: limit (optional, 1 to 100, default 50; above 100 is 400 invalid_request), cursor (optional, the previous page's next_cursor), updated_since (optional, YYYY-MM-DD or an ISO 8601 date and time with a time zone: only rows created or changed since then). Any other parameter is 400 invalid_request.

{"data": [{"id": "b1a2b3c4-5d6e-4f7a-8b8c-9d0e1f2a3b4c", "start_at": "2026-12-09T15:00:00.000Z", "end_at": "2026-12-09T15:30:00.000Z", "status": "scheduled", "appointment_type_id": "c2b3c4d5-6e7f-4a8b-9c9d-0e1f2a3b4c5d", "appointment_type": "Follow-up visit", "provider_id": "d3c4d5e6-7f8a-4b9c-8d0e-1f2a3b4c5d6e", "provider_name": "Dr. Riley Example", "created_at": "2026-11-18T17:45:00.000Z", "updated_at": "2026-11-18T17:45:00.000Z"}], "next_cursor": "eyJ0IjoiMjAyNi0xMS0yMFQxNTowNDowNS4xMjM0NTZaIiwiaSI6IjNmNmIyYTllLTFjNGQtNGU4YS05YjdmLTJkNWM4ZTFhNGI2MCJ9"}

GET /api/v1/patients/{id}/messages

Secure messages between the patient and the clinic in the patient portal, oldest first. Text messages (SMS) are not returned. No updated_since: a message has no change time once sent. Needs messages:read. Read-only.

Parameters: limit (optional, 1 to 100, default 50; above 100 is 400 invalid_request), cursor (optional, the previous page's next_cursor). Any other parameter is 400 invalid_request.

{"data": [{"id": "e4d5e6f7-8a9b-4c0d-9e1f-2a3b4c5d6e7f", "thread_id": "e4d5e6f7-8a9b-4c0d-9e1f-2a3b4c5d6e7f", "direction": "inbound", "sender_type": "patient", "automatic_reply": false, "subject": "Question about my vitamin D", "body": "Should I take it with food?", "read_at": "2026-11-19T14:02:00.000Z", "created_at": "2026-11-19T13:55:00.000Z"}], "next_cursor": "eyJ0IjoiMjAyNi0xMS0yMFQxNTowNDowNS4xMjM0NTZaIiwiaSI6IjNmNmIyYTllLTFjNGQtNGU4YS05YjdmLTJkNWM4ZTFhNGI2MCJ9"}

GET /api/v1/patients/{id}/documents

The patient's documents: id, name, type and dates only. The files cannot be downloaded through this API; an upload that never finished is not listed. Needs charts:read. Read-only.

Parameters: limit (optional, 1 to 100, default 50; above 100 is 400 invalid_request), cursor (optional, the previous page's next_cursor), updated_since (optional, YYYY-MM-DD or an ISO 8601 date and time with a time zone: only rows created or changed since then). Any other parameter is 400 invalid_request.

{"data": [{"id": "f5e6f7a8-9b0c-4d1e-8f2a-3b4c5d6e7f8a", "name": "outside-lab-results.pdf", "type": "lab_results", "uploaded_at": "2026-11-05T18:20:00.000Z", "updated_at": "2026-11-05T18:20:00.000Z"}], "next_cursor": "eyJ0IjoiMjAyNi0xMS0yMFQxNTowNDowNS4xMjM0NTZaIiwiaSI6IjNmNmIyYTllLTFjNGQtNGU4YS05YjdmLTJkNWM4ZTFhNGI2MCJ9"}

Writing

A new patient chart is made at once, and its header says it was created through the API, with the key's name. The other writes arrive for the clinic's staff to accept: a draft note waits for a clinician to review and sign it, a file waits in the chart for someone to review it, and a task waits in the clinic's unassigned pool. Nothing written here is signed, sent to the patient, prescribed, booked or charged. A person does each of those in the EHR.

POST /api/v1/patients

Creates a patient chart at once, with the same checks as a chart the clinic's staff add, including the fields the clinic requires. The chart's header says "Created via API" with the key's name. Needs patients:write. Fields: first_name, last_name and date_of_birth (YYYY-MM-DD) (required), middle_name, preferred_name, sex (male, female or other), email, phone, address_street, address_line2, address_city, address_state, address_zip, referral_source (up to 50 characters; some clinics require it), referral_detail.

curl -s https://api.moonshotehr.com/api/v1/patients -H 'Authorization: Bearer <key>' \
  -H 'Content-Type: application/json' -H 'Idempotency-Key: intake-20261204-0417' \
  -d '{ "first_name": "Jordan", "last_name": "Sample", "date_of_birth": "1979-08-21", "sex": "male", "email": "jordan.sample@example.com", "phone": "+15555550188" }'
{"data": {"id": "7b2e4c1a-9d3f-4e6b-8a5c-1f0e2d3c4b5a", "first_name": "Jordan", "last_name": "Sample", "date_of_birth": "1979-08-21", "sex": "male", "email": "jordan.sample@example.com", "phone": "+15555550188", "status": "prospect", "created_at": "2026-12-04T15:04:05.000Z", "updated_at": "2026-12-04T15:04:05.000Z"}, "next_cursor": null}

POST /api/v1/patients/{id}/documents

Adds a file to the patient's chart, waiting for review: it is not shared with the patient, and an open review task for it lands in the clinic's unassigned task pool. Needs documents:write. Fields: file_name (required), content_type (required: PDF, an image, Word, Excel, text or CSV), content_base64 (required, the file as standard base64, at most 5 MB once decoded), document_type (optional: other, the default, lab_result, imaging, referral, consent, outside_records, intake_form, insurance_card, body_composition or letter), label (optional, up to 200 characters).

curl -s https://api.moonshotehr.com/api/v1/patients/3f6b2a9e-1c4d-4e8a-9b7f-2d5c8e1a4b60/documents \
  -H 'Authorization: Bearer <key>' -H 'Content-Type: application/json' -H 'Idempotency-Key: fax-88213' \
  -d '{ "file_name": "cardiology-consult.pdf", "content_type": "application/pdf", "document_type": "outside_records", "content_base64": "JVBERi0xLjcK..." }'
{"data": {"id": "c4d5e6f7-0a1b-4c2d-8e3f-4a5b6c7d8e9f", "patient_id": "3f6b2a9e-1c4d-4e8a-9b7f-2d5c8e1a4b60", "file_name": "cardiology-consult.pdf", "label": null, "content_type": "application/pdf", "document_type": "outside_records", "size_bytes": 182344, "review_status": "pending_review", "shared_with_patient": false, "created_at": "2026-12-04T15:06:11.000Z"}, "next_cursor": null}

POST /api/v1/patients/{id}/tasks

Creates a staff task on the patient's chart, unassigned: it lands in the clinic's task pool for someone to pick up, and nobody is notified. Needs tasks:write. Fields: title (required, up to 200 characters), description (optional, up to 4,000), due_date (optional, YYYY-MM-DD).

curl -s https://api.moonshotehr.com/api/v1/patients/3f6b2a9e-1c4d-4e8a-9b7f-2d5c8e1a4b60/tasks \
  -H 'Authorization: Bearer <key>' -H 'Content-Type: application/json' -H 'Idempotency-Key: followup-55102' \
  -d '{ "title": "Call to schedule the 12-week vitamin D recheck", "due_date": "2026-12-11" }'
{"data": {"id": "d9e0f1a2-3b4c-4d5e-9f6a-7b8c9d0e1f2a", "patient_id": "3f6b2a9e-1c4d-4e8a-9b7f-2d5c8e1a4b60", "title": "Call to schedule the 12-week vitamin D recheck", "description": null, "due_date": "2026-12-11", "status": "new", "assigned_to": null, "created_at": "2026-12-04T15:08:40.000Z"}, "next_cursor": null}

POST /api/v1/patients/{id}/notes

Creates an unsigned draft note on the patient's chart, with no provider. A clinician opens it in the EHR, edits it and signs it as themselves; no route here signs a note, and the draft is never shared with the patient. Needs notes:write. Fields: text (required, up to 20,000 characters), visit_date (optional, YYYY-MM-DD, the clinic's today by default), visit_type (optional, a label of at most 4 words and 40 characters using letters, digits, spaces and - / & ( ) ', such as Remote monitoring; anything else is 400 invalid_request).

curl -s https://api.moonshotehr.com/api/v1/patients/3f6b2a9e-1c4d-4e8a-9b7f-2d5c8e1a4b60/notes \
  -H 'Authorization: Bearer <key>' -H 'Content-Type: application/json' -H 'Idempotency-Key: remote-monitoring-2026-12-04' \
  -d '{ "text": "Home blood pressure, 7-day average 128/82 (14 readings). No readings above 150/95.", "visit_type": "Remote monitoring" }'
{"data": {"id": "e1f2a3b4-5c6d-4e7f-8a9b-0c1d2e3f4a5b", "patient_id": "3f6b2a9e-1c4d-4e8a-9b7f-2d5c8e1a4b60", "status": "draft", "visit_date": "2026-12-04", "visit_type": "Remote monitoring", "text": "Home blood pressure, 7-day average 128/82 (14 readings). No readings above 150/95.", "created_at": "2026-12-04T15:10:02.000Z"}, "next_cursor": null}

The draft is not returned by the chart reads (they return signed notes only) until a clinician signs it.

Limits

Per visitor IP address, per minute, counted separately for each route and separately from the clinic's own booking page: catalog 30, availability 60, summary 20. Keyed routes count per API key instead, per minute: key check 60, create lead 60, update lead 60, lead status 120, lead report 10, patient list 60, patient 120, notes 120, one note 120, medications 120, allergies 120, problems 120, labs 120, vitals 120, appointments 120, messages 120, documents 120, create patient 30, add file 10, create task 30, create draft note 30. A key's own lower limit, when the clinic set one, applies to the writes; a higher one does not raise them. Exactly that many calls succeed; the next gets 429 rate_limited with Retry-After (seconds).

Error codes

CodeStatusMeaning
invalid_request400A missing, unknown or malformed parameter (for example a chart limit above 100), or a service that cannot be booked online.
unauthorized401Keyed route: the API key is missing, malformed, unknown, expired or revoked.
online_booking_off403The clinic takes appointment requests, not online booking.
insufficient_scope403Keyed route: the API key does not have the permission this route needs.
tenant_mismatch403Keyed route: X-Tenant-Slug names a different clinic than the API key.
phi_access_disabled403Lead routes, the lead report and the chart reads and writes: the clinic's business associate agreement with Moonshot EHR is not in place yet.
tenant_not_found404No clinic matches X-Tenant-Slug.
not_found404No v1 route at this path, no lead with this id at the key's clinic, or (chart routes) no patient or signed note with this id that the key may read: another clinic's patient, a deleted patient and a restricted chart answer the same way.
method_not_allowed405Wrong method; see the Allow header.
idempotency_conflict409Create lead and the chart writes: the Idempotency-Key was used with a different body, or its first request is still running.
duplicate_patient409Create patient: this person already has a chart at the clinic. No chart was created.
payload_too_large413The request body is larger than 64 KB (the file upload: larger than a 5 MB file as base64).
rate_limited429Over the limit; wait Retry-After seconds.
not_implemented501A planned route that is not available yet.
report_timeout503Lead report: the period took too long to count; ask for a shorter one after Retry-After seconds.
internal_error500Our side; retry shortly and quote X-Request-Id.

From the browser

Only from site addresses the clinic listed with us (see Embed and availability). Errors, including 429, are readable by those sites, and X-Request-Id and Retry-After are exposed to their JavaScript.

const res = await fetch(
  'https://api.moonshotehr.com/api/v1/availability?appointment_type_id=<id>&date=2026-11-16',
  { headers: { 'X-Tenant-Slug': '<clinic>' } },
);
const body = await res.json();
if (!res.ok) throw new Error(body.error.code + ': ' + body.error.message);
for (const slot of body.data.slots) console.log(slot.time, slot.provider_name);

From a server:

curl -s https://api.moonshotehr.com/api/v1/catalog -H 'X-Tenant-Slug: <clinic>'

Coming in v1

Available now: the public routes (catalog, availability and availability summary), the secret key, the route that checks it, the lead routes (create, correct, read progress), the lead report, the chart reads (patients, notes, medications, allergies, problems, labs, vitals, appointments, portal messages and the document list), and the chart writes (a patient, a file for review, an unassigned task, an unsigned draft note). Planned next, on that same key (server to server only): handing a visitor off to the hosted booking, join or intake page, and reading event delivery history. Those routes are not available yet.