The Healthstack Developer API is a REST interface for managing patient identity, medical records, consent, and Medicard from your own apps and automations. It's built for hospitals, clinics, pharmacies, telemedicine platforms, and other healthcare businesses integrating with Healthstack.
Developer API access requires an active Healthstack business account. Secret keys are generated in Settings → API Configuration. Use Test keys in sandbox (dummy data, no charges) and Live keys in production.
What you can build
Patients
Create and look up patients by phone number or Health ID, and run the consent flow that unlocks access to their data.
All endpoints are served over HTTPS and versioned under /api/v1:
https://api.healthstackhq.com/api/v1
Quick start
Most integrations follow the same core flow: create a patient, obtain their consent, then read or write their data.
1. Create a patient
Register the patient with their phone number, or fetch them if they already exist.
POST /patients/create
2. Request consent
Send a one-time verification code to the patient's phone or email.
POST /patients/seek-consent
3. Verify the OTP
Exchange the code the patient received for a short-lived consent token.
POST /patients/consent
4. Read or write data
Pass the consent token on protected endpoints to access the patient's records or Medicard.
x-consent-token: <consent_token>
See the full Consent Workflow guide for the end-to-end sequence, including when consent can be skipped.
Authentication
Every request is authenticated with a Bearer secret key in the Authorization header. Tokens start with sk_test_ (Test) or sk_live_ (Live). Patient-protected endpoints additionally require the consent token from the flow above.
Authorization: Bearer <your_api_token>
See the Authentication page for the full token reference.
Learn more
Key Concepts
Core identifiers and access patterns used across the API.
Authenticate API requests using an API access token. Pass the token in the Authorization header as a Bearer token. Tokens typically start with sk_test_ (Test) or sk_live_ (Live).
Generate tokens in Settings → API Configuration. Use Test keys in sandbox and Live keys in production. Rotate or revoke a key anytime from the same page.
Secret key
Include your secret key on every request:
Authorization: Bearer <your_api_token>
Consent token
Patient-protected endpoints also require a short-lived consent token after the patient verifies an OTP:
x-consent-token: <consent_token>
Token reference
Token
Purpose
Validity
Header
Secret Key
API authentication
Until rotated
Authorization: Bearer
ConsentToken
Patient data access
24 hours
x-consent-token
Errors
The API uses conventional HTTP response codes and returns JSON error bodies.
Error response
{
"status": false,
"message": "Description of what went wrong",
"error": "ERROR_CODE"
}
Common status codes
Code
Meaning
400
Bad request — invalid parameters
401
Unauthorized — missing or invalid secret key
403
Forbidden — missing consent or insufficient KYC tier
404
Resource not found
429
Rate limited
500
Server error
Key Concepts
Core identifiers and access patterns used across the Healthstack API.
Core identifiers
Phone
Phone number is used to identify patients across healthcare systems.
Health ID
Healthstack-generated unique patient identifier in format HID-XXXXXXXX.
Access model
Secure authentication
Bearer secret keys plus consent tokens for protected patient data.
Consent management
Strict consent-based access control ensuring patient data privacy.
Tier-based access
KYC tiers control which businesses can access which capabilities.
POST
Create Patient
POST /patients/create
Create a new patient or fetch existing patient by thier phone number. This step is required before
requesting consent.
This endpoint returns the following values status, message, and data containing health_id, name, phone, email, and created_at.
Response Parameters
Parameter
Type
Description
status
boolean
Indicates whether the request was successful
message
string
Descriptive message about the operation result
data.health_id
string
Unique patient identifier generated by HealthStack
data.name
string
Full name of the patient
data.phone
string
Phone Number
data.email
string
Patient's email address
data.created_at
string
Timestamp of patient record creation in ISO format
Did this page help you?
POST
Seek Consent
POST /patients/seek-consent
Send verification code to patient's email or phone for consent.
Headers
Authorization: Bearer <your_api_token>
Request Body
Request Body Parameters
{"health_id":HID-PSE8RUOK,}
The Seek Consent endpoint accepts a POST request, with health_id as the required parameter. A verification OTP is sent to the patient's registered phone number or email.
Request Body Parameters
Parameter
Type
Required
Description
health_id
string
Yes
Unique patient identifier in format HID-XXXXXXXX
Response
Response Body Parameters
{"success":true,"status":200,"message":"A verification OTP has been sent your user for consent",}
This endpoint returns the following values success, status, and message.
Response Parameters
Parameter
Type
Description
success
boolean
Indicates whether the request was successful
status
boolean
Indicates whether the consent was successfully granted
message
string
Descriptive message about the consent operation
Did this page help you?
POST
Verify Consent
POST /patients/consent
Verify OTP and receive consent token for patient data access.
Headers
Authorization: Bearer <your_api_token>
Request Body
Request Body Parameters
{"health_id":HID-NHG869UP,"otp":123456,}
The Verify Consent endpoint accepts a POST request, with health_id and otp as required parameters.
This endpoint returns the following values success, status, message, and data, an array of patient objects containing id, full_name, gender, dob, health_id, created_at, email, business_id, updated_at, and metadata.
Response Parameters
Parameter
Type
Description
success
boolean
Indicates whether the request was successful
status
integer
Indicates the status of the request
message
string
Descriptive message about the consent operation
data.id
string
Unique patient identifier in format HID-XXXXXXXX
data.full_name
string
Full name of the patient
data.gender
string
Gender of the patient
data.dob
string
Date of birth of the patient
data.health_id
string
Unique patient identifier in format HID-XXXXXXXX
data.created_at
string
Date and time the patient was created
data.email
string
Email of the patient
data.business_id
string
Business identifier in format BUS-XXXXXXXX
data.updated_at
string
Date and time the patient was updated
data.metadata
object
Metadata of the patient
data.metadata.key
string
Key of the metadata
Did this page help you?
GET
Get Patient
GET /patient/single/:health_id
This endpoint is used to get user's record by user health id.
Note:Consent token is required to get a
record for patients you did not create.
This endpoint returns the following values success, status, message, and data containing the patient's id, full_name, gender, dob, health_id, created_at, email, business_id, updated_at, vital, and metadata.
Response Parameters
Parameter
Type
Description
success
boolean
Indicates whether the request was successful
status
integer
Indicates the status of the request
message
string
Descriptive message about the consent operation
data.id
string
Unique record identifier in format
data.full_name
string
Full name of the patient
data.gender
string
Gender of the patient
data.dob
string
Date of birth of the patient
data.health_id
string
Unique patient identifier in format HID-XXXXXXXX
data.created_at
string
Date and time the patient was created
data.email
string
Email of the patient
data.business_id
string
Business identifier in format BUS-XXXXXXXX
data.updated_at
string
Date and time the patient was updated
data.vital
object
Vital of the patient
data.metadata
object
Metadata of the patient
data.metadata.key
string
Key of the metadata
Did this page help you?
PATCH
Update Patient
PATCH /edit/:health_id
This endpoint is used to edit user's record by user health id.
Note:Consent token is required to get a
record for patients you did not create.
The Create Record endpoint accepts a POST request as multipart/form-data, with recordType, patient, note, record_files, diagnosedBy, and diagnosed_at as parameters.
Request Body (form-data)
Parameter
Description
recordType
Prescription
patient
HID-6TZM9Z8K
note
Short note
record_files
Medical record to upload (png,jpg,jpeg)
diagnosedBy
Dr. Mike
diagnosed_at
2025-08-28T16:04:34.046+00:00
This endpoint returns the following values success, status, message, and data containing recordId, patient, and created_at.
The Get Record endpoint accepts a GET request, with record_id as the required path parameter.
Query Parameters
Parameter
Type
Required
Description
record_id
string
Yes
Record id
This endpoint returns the following values success, message, and data containing the record details.
Response Body Parameters
{"success":true,"message":"Records fetched successfully","data":{
"records": [],
...other record details
}
}
Did this page help you?
POST
Create Medicard
POST /medicard/create
The Medicard API is a set of endpoints within the Healthstack infrastructure that enables healthcare
businesses to issue, manage, and utilize digital health cards (Medicards) for patients.
A Medicard acts as a secure digital identity and billing tool, allowing patients to access their medical records
instantly and pay for healthcare services.
This endpoint returns the following values success, status, message, and data containing reference, amount, and card_number.
Response Parameters
Parameter
Type
Description
success
boolean
Indicates whether the Medicard was successfully reserved
status
integer
Indicates the status of the request
message
string
Descriptive message about the Medicard assignment
data
object
Data of the transaction
data.reference
string
Reference for the transaction
data.amount
number
Amount funded to the Medicard
data.card_number
string
Unique card number for the Medicard
Did this page help you?
Consent Workflow
Standard Flow:
Consent is always required to access a patient's
protected medical data unless a valid Medicard or emergency parameter is present (Tier 3 businesses
only).
1. Create/Fetch Patient
Use the patient's phone number to create a new patient profile or fetch an existing one.
POST /patients/create
2. Request Consent
Send a 6-digit verification code to the patient's phone or email linked to their HID.
POST /patients/seek-consent
3. Verify OTP
The patient enters the 6-digit verification code to generate a ConsentToken.
POST /patients/consent
4. Access Data
Use the ConsentToken to read or write the patient's medical records, prescriptions, or other
sensitive data.
Include x-consent-token header
KYC Tiers
Tier 1
Hospitals
Clinics
Pharmacies
Diagnostic Centers
Homecare Agencies
Tier 2
Telemedicine Platforms
Digital Health Apps
Health Insurance Platforms
Virtual Clinics
Medical SaaS Providers
Security & Compliance
Data Integrity Rules
Immutable Records: Medical records cannot be deleted or updated once
submitted
Timestamped: All records include creation timestamps
Source-Tagged: All records are tagged with the creating business
Audit Trail: Only HealthStack admin can audit submissions
Security Requirements
All communication must be over HTTPS
Consent tokens are temporary and patient-specific
Emergency access is logged and reviewed
All patient data access requires consent unless emergency access is granted
Error Handling
Error Code
Description
Solution
401
Unauthorized - Invalid or expired access token
Refresh your access token
403
Forbidden - Insufficient KYC tier or missing consent
Upgrade KYC tier or obtain consent token
404
Patient not found
Create patient first or check HealthID
422
Validation error
Check request body format and required fields
Contact Help
Reach out to the Healthstack team for help with integration, billing, or anything else. We do our best to respond within 1 business day.
Get in touch
If you have any questions regarding our Services or need help, please fill out the form here. We do our best to respond within 1 business day.