Pathology,
as an API.
Order blood tests for your patients, receive structured results and react to every step with signed webhooks. Built for the teams putting pathology inside their own product.
- Production
- api.eirly.health
- Staging
- api.staging.eirly.health
{
"eventName": "result.complete",
"eventUuid": "98603d91-9d1b-4607-8ecb-705b33c66ef0",
"version": "1.0",
"data": {
"uuid": "b69ff810-0823-41ee-8fd2-43ff01329fae"
}
}One order, end to end
Two calls from you. Every step in between, pushed to you.
POST /v1/referralsYou place the order for your patient.
referral.createdWe confirm the referral exists.
referral.issuedThe referral is ready for the patient to take to a pathology centre.
result.partial_resultsThe lab sends back the first results. This can fire more than once.
result.completeEvery result on the order is back.
GET /v1/results/{uuid}You fetch the structured result, ready for your product.
# Exchange your client credentials for an access token
curl -X POST https://auth.staging.eirly.health/oauth/token \
-u "$CLIENT_ID:$CLIENT_SECRET" \
-d grant_type=client_credentials
# Then call the API with it
curl https://api.staging.eirly.health/v1/tests \
-H "Authorization: Bearer $ACCESS_TOKEN"import crypto from 'node:crypto';
export function isFromEirly(rawBody: Buffer, signature?: string): boolean {
// A SHA-256 HMAC is 64 hex characters. Reject anything else here:
// timingSafeEqual throws on buffers of different lengths.
if (!signature || !/^[0-9a-f]{64}$/i.test(signature)) return false;
const expected = crypto
.createHmac('sha256', process.env.EIRLY_SECRET_KEY!)
.update(rawBody)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(expected, 'hex'),
Buffer.from(signature, 'hex'),
);
}
// signature = req.headers['x-bgt-hmac-sha256']const event = JSON.parse(rawBody.toString());
switch (event.eventName) {
case 'referral.issued':
await notifyPatient(event.data.uuid);
break;
case 'result.partial_results':
case 'result.complete':
// Fetch the full, structured result
await syncResult(event.data.uuid);
break;
}
// Acknowledge fast; do the work in the background
res.status(200).end();Place your first order
Create credentials in staging, get a token and call the API in under ten minutes.
Quickstart 02React to every step
Signed webhooks for referrals and results, so your product updates the moment we do.
Webhooks 03Keep up with changes
Product updates every month, and every API change field by field in the API changelog.
ChangelogChangelog
All changes →From the blog
All posts →- Introducing eirly.dev, a home for developers building on EirlyDocs, a dated changelog and engineering notes in one place, built as a static site you can read with JavaScript switched off.
- Webhook handlers that never miss a resultAcknowledge fast, process once, and know what to do when retries run out. A short guide to the delivery guarantees you can build on.
Build against staging today.
Staging is a complete, separate environment with its own accounts and keys. Use a Stripe test card; nothing you do there charges a real one.
Get your staging keys