Step by step
Build on the pathology API, from staging to production
The path a health company takes to put pathology ordering and results inside its own product: a staging organisation, API credentials, the first request, the first referral, webhooks that tell you when a result is ready, Medicare provider records, then the same setup in production.
- Cost:
- Staging is free; production needs an API plan, quoted to your volume
- Environments:
- Staging and production have separate accounts, organisations, billing and keys
- Medicare referrals:
- API version 1.1.0 or higher
- Results:
- Webhooks tell you something changed; you fetch results through the API
Updated 28 November 2026
Build your integration · 12 steps
For health companies and developers putting pathology ordering and results inside their own product. The full reference is in Getting Started in the docs.
Get started with stagingSteps
Create an account, verify, create an organisation
Where: app.staging.eirly.health/signup
The same first steps as in Try Eirly in staging. A verified profile (pick a practitioner type, Other if unsure) is required before an organisation can exist, and all API access is scoped to an organisation.
You will know it worked when: You're on the organisation's Dashboard.
Add the test card
Where: Settings, then Billing
A billing method must be on file before API access can be enabled. Staging accepts Stripe's test card and never charges it.
Test card number4242 4242 4242 4242
You will know it worked when: Billing shows a card ending 4242.
Enable the API
Where: Settings, then API Keys
Follow the steps to enable API access. You receive a client_id and a client_secret for staging. Keep the secret on your server and in your CI's secrets; it never goes in a browser or a repository.
You will know it worked when: A client_id and client_secret are shown once, and you've stored them.
Get a token
Where: Your terminal
Exchange the credentials for an access token with the client credentials flow. The token lasts an hour; a refresh token comes with it.
Token requestcurl -X POST https://auth.staging.eirly.health/oauth/token \ -u "$CLIENT_ID:$CLIENT_SECRET" \ -d grant_type=client_credentialsYou will know it worked when: The response carries access_token and expires_in 3600.
Make the first call
Where: Your terminal
List the tests, then find the five centres nearest Sydney. Every list endpoint pages the same way, with a cursor.
First callscurl https://api.staging.eirly.health/v1/tests -H "Authorization: Bearer $TOKEN" curl "https://api.staging.eirly.health/v1/collection-centres?lat=-33.8688&lng=151.2093&count=5" -H "Authorization: Bearer $TOKEN"You will know it worked when: JSON comes back, and the centres carry distanceKm.
Choose tests and create a referral
Where: POST /v1/referrals
List the tests, or order a pre-configured set by bundle and extend it with extra tests. Commercial and Medicare tests can go in the same request. POST /v1/referrals with the person and the tests: Eirly creates and issues the referral, and you retrieve the referral PDF. An order with both Medicare and commercial tests produces two referrals. Use made-up people in staging.
You will know it worked when: You can retrieve the referral PDF. A mixed order gives two referrals.
Show the nearest centre
Where: Collection-centre search
Collection-centre search returns centres by location, nearest first, with opening hours. The person walks in; most tests need no appointment.
You will know it worked when: Centres come back nearest first, with opening hours.
Subscribe to webhooks
Where: The REST API, webhook subscriptions
Create a webhook subscription over REST. A webhook tells your system a referral or a result is created or updated: you receive a small event, then fetch the current state from the REST API, which is the source of truth. Each biomarker has a consistent identity across labs and a canonical value beside the lab's own. The event list and retry behaviour are in the webhooks reference in the docs.
You will know it worked when: Your system receives an event, and the referral or result you fetch from the API matches it.
Create a Medicare provider record
Where: POST /v1/providers
Send the doctor's provider number, name, address and a PNG signature. The doctor needs no account with Eirly; that practitioner can order Medicare tests from this call on. Medicare referrals need API version 1.1.0 or higher.
You will know it worked when: The practitioner can order Medicare tests from this call on.
Check the provider will receive results
Where: GET /v1/providers/{providerNumber}
Every organisation is on copy routing unless our team has set it to direct routing. On copy routing, a provider record with every detail and a signature receives results: the request form asks the lab to copy us in, so there's no lab to notify. The provider response carries routingMethod and ready. Only call POST /v1/providers/{providerNumber}/routing when routingMethod is DIRECT; on copy routing it succeeds and does nothing.
You will know it worked when: The provider record shows ready true.
Connect the MCP
Where: Claude Code, Cursor, Windsurf, Codex, or any assistant that speaks MCP
The developer MCP is public and read-only: the API reference, schemas, docs and webhook events, read by your coding assistant while it writes your integration. Any tool that speaks MCP over HTTP can connect; the command below is Claude Code's, the others take the same address in their MCP settings.
Claude Codeclaude mcp add --transport http eirly-dev https://mcp.eirly.health/dev/v1You will know it worked when: Your assistant can list the endpoints tagged Collection centres.
Go to production
Where: app.eirly.health
Repeat the setup in production: new account, organisation, billing and keys. Nothing carries over from staging, so rebuild your bundles, members and settings there too. Keys from staging do not work there. Production needs a plan, quoted to your volume.
You will know it worked when: Your production keys are in your server's secrets, and your staging ones are kept for testing.
Follow this guide in your AI tool
The whole guide is also a Markdown file. Open it in the tool you already use and it will take you through the steps and check each one; or copy the Markdown and paste it anywhere.
What the tool is told
Please follow this guide with me, one step at a time, and check each step before moving on: https://eirly.health/support/articles/build-on-the-pathology-api.md It is Eirly Health's guide "Build on the pathology API, from staging to production". Nothing in staging reaches a lab, and I will use made-up people only.
Questions
Is there a free sandbox?
Yes. Staging is a full environment with its own keys, and it never charges a real card. Production needs a plan.
Do webhooks carry the result?
No. A webhook tells you something changed; you fetch the referral or result from the REST API. Webhooks and list endpoints cover orders created through the API.
Does the ordering doctor need an Eirly account?
Not through the API: a provider record holds their number, details and signature. On the platform, each ordering doctor is a member with their own signature.
Are there SDKs?
No. It is a REST API with OAuth 2.0 client credentials, cursor paging and JSON; the developer MCP server lets a coding assistant read the reference while it writes your client.
Can we white-label the referral?
Your branding can appear on referrals, included or as an add-on depending on your plan.
No key in the browser, ever
A client_id and client_secret in an HTML page, a bundle or a mobile app is public. Exchange them for a token on your server, or at build time, and ship only data.
Never commit a secret
Keep credentials in environment variables or your CI's encrypted secrets, add .env files to .gitignore, and scan commits before they leave your machine. If a secret reaches a repository, treat it as leaked: rotate it in Settings, then API Keys, and rewrite nothing.
One key per environment, one per job
Staging and production issue separate keys and neither works in the other. Give an integration its own organisation and key so you can revoke it without touching anything else.
Keep tokens out of logs
Access tokens last an hour and refresh tokens a month; log neither. Mask them in error reports and never put them in a URL.
Real clients only in production
Staging is for made-up people. A real name, Medicare number or result never belongs in a test environment, a fixture, a screenshot or a bug report.
Verify what arrives
Treat a webhook as a notification, then fetch the record from the API with your token before you act on it. Reject anything your server did not ask for.
Least privilege for people too
In the app, roles add up and no built-in role grants Medicare ordering; give each person the capabilities their job needs and rotate API keys when someone who held them leaves.
Found a security problem?
Email support@eirly.health with the detail and we will respond; please do not post it publicly first.
Still need help?
Email support@eirly.health with your organisation name, the environment and the request you made. Never send your client_secret, access tokens or real client details.
Next
- Getting started with staging
Account, organisation, test card and API keys.
- Pathology API
Referrals, results, webhooks, bundles and collection centres in one REST API.
- Lab results API
What a result looks like: normalised across labs, with canonical values.
- Medicare pathology ordering
Who can request Medicare pathology, and Medicare and commercial tests on one order.
- Developer MCP server
Let your coding assistant read the API reference while it writes your integration.
- Pathology booking API
Referral, nearest collection centre with opening hours, and the result, in one REST API.
- API pricing
Plans and what each includes.