Partner API
Introduction
Integrate gut microbiome testing into your platform with Biomesight. The Partner API lets you offer gut microbiome testing directly inside your product. Place orders, register collection kits, retrieve analysis results, and receive real-time status updates — all through a simple REST API secured with OAuth 2.0.
The API is designed for:
- Health-tech platforms adding microbiome insights to their offering
- Wellness and nutrition apps that want to personalise recommendations with gut data
- Telehealth providers integrating lab testing into virtual consultations
- Corporate wellness programmes running gut-health screening for employees
Getting Started
Authentication
All API requests require a Bearer token. Obtain one by sending your Client ID and Client Secret using HTTP Basic authentication:
Request
| Header / Field | Value |
|---|---|
Authorization |
Basic {base64(client_id:client_secret)} |
Content-Type |
application/x-www-form-urlencoded |
grant_type |
client_credentials |
curl -X POST https://app.biomesight.com/api/v1/auth/token \
-u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
-d "grant_type=client_credentials"
import requests
resp = requests.post(
"https://app.biomesight.com/api/v1/auth/token",
auth=("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET"),
data={"grant_type": "client_credentials"},
)
token = resp.json()["access_token"]
Response 200 OK
{
"access_token": "eyJhbGciOi...",
"token_type": "Bearer",
"scope": "read write",
"expires_in": 3600
}
Include the token in subsequent requests:
Authorization: Bearer eyJhbGciOi...
Create Order
Submit an order on behalf of a customer. Biomesight will ship a collection kit to the provided address.
Request Headers
| Header | Value |
|---|---|
Authorization | Bearer {access_token} |
Content-Type | application/json |
Request Body
| Field | Type | Description |
|---|---|---|
order_id |
string required | Your unique order identifier |
purchase_date |
string required | ISO 8601 UTC timestamp, e.g. 2025-06-15T10:30:00 |
user |
object required | Customer details (see below) |
user.id |
string required | Your customer identifier |
user.first_name |
string required | Customer first name |
user.last_name |
string required | Customer last name |
user.email |
string required | Valid email address |
user.phone |
string optional | Phone number |
shipping_speed |
string optional | Defaults to "standard" |
destination_address |
object required | Shipping address (see below) |
destination_address.name |
string optional | Recipient name (defaults to customer name) |
destination_address.address_line1 |
string required | Street address |
destination_address.address_line2 |
string optional | Apartment, suite, etc. |
destination_address.city |
string required | City |
destination_address.state |
string optional | State or province |
destination_address.postcode_zip |
string required | Postcode / ZIP code |
destination_address.country_code |
string required | Country code (e.g. "US", "GB", "DE") |
items |
array required | List of ordered items |
items[].product_sku |
string required | Product SKU (provided during onboarding) |
items[].product_name |
string optional | Human-readable product name |
items[].quantity |
integer optional | Defaults to 1 |
Example Request
curl -X POST https://app.biomesight.com/api/v1/order \
-H "Authorization: Bearer eyJhbGciOi..." \
-H "Content-Type: application/json" \
-d '{
"order_id": "ORD-20250615-001",
"purchase_date": "2025-06-15T10:30:00",
"user": {
"id": "CUST-12345",
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith@example.com"
},
"destination_address": {
"address_line1": "42 Wellness Avenue",
"city": "London",
"postcode_zip": "SW1A 1AA",
"country_code": "GB"
},
"items": [
{ "product_sku": "YOUR_SKU", "quantity": 1 }
]
}'
import requests
resp = requests.post(
"https://app.biomesight.com/api/v1/order",
headers={
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
},
json={
"order_id": "ORD-20250615-001",
"purchase_date": "2025-06-15T10:30:00",
"user": {
"id": "CUST-12345",
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith@example.com",
},
"destination_address": {
"address_line1": "42 Wellness Avenue",
"city": "London",
"postcode_zip": "SW1A 1AA",
"country_code": "GB",
},
"items": [
{"product_sku": "YOUR_SKU", "quantity": 1}
],
},
)
print(resp.json())
Response 201 Created
{
"status": "created",
"sale_id": 4821,
"external_order_id": "ORD-20250615-001"
}
Error Cases
| Status | Cause |
|---|---|
400 | Missing or invalid required fields (email, address, items, etc.) |
409 | Duplicate order — an order with the same order_id already exists |
422 | Data format error (e.g. invalid date, unrecognised country code) |
Register Kit
After your customer collects their sample, register the kit to associate the customer with the kit ID.
Request Headers
| Header | Value |
|---|---|
Authorization | Bearer {access_token} |
Content-Type | application/json |
Request Body
| Field | Type | Description |
|---|---|---|
order_id |
string required | The order_id used when creating the order |
kit_id |
string required | Kit code printed on the collection tube |
sample_date |
string required | Date the sample was collected (YYYY-MM-DD) |
sample_type |
string optional | Defaults to "Gut" |
bristol_scale |
integer optional | Bristol stool scale (1–7) |
bm_frequency |
string optional | Bowel-movement frequency. One of:
"3 or more times per day",
"After every meal",
"Twice daily",
"Once daily",
"Every 2 to 3 days",
"Every 4 to 5 days",
"About once a week"
|
Example Request
curl -X POST https://app.biomesight.com/api/v1/register_kit \
-H "Authorization: Bearer eyJhbGciOi..." \
-H "Content-Type: application/json" \
-d '{
"order_id": "ORD-20250615-001",
"kit_id": "BS1-ABC12",
"sample_date": "2025-07-01",
"bristol_scale": 4
}'
import requests
resp = requests.post(
"https://app.biomesight.com/api/v1/register_kit",
headers={
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
},
json={
"order_id": "ORD-20250615-001",
"kit_id": "BS1-ABC12",
"sample_date": "2025-07-01",
"bristol_scale": 4,
},
)
print(resp.json())
Response 200 OK
{
"status": "Success"
}
Error Cases
| Status | Cause |
|---|---|
400 | Missing required fields, order not found, kit not found, or kit already registered |
Get Results
Retrieve microbiome analysis results for a registered kit. Results are available once lab processing is complete.
Request Headers
| Header | Value |
|---|---|
Authorization | Bearer {access_token} |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
format |
string optional | "json" (default), "pdf", or "csv" |
Example Request
curl https://app.biomesight.com/api/v1/results/BS1-ABC12?format=json \
-H "Authorization: Bearer eyJhbGciOi..."
import requests
resp = requests.get(
"https://app.biomesight.com/api/v1/results/BS1-ABC12",
headers={"Authorization": f"Bearer {token}"},
params={"format": "json"},
)
results = resp.json()
JSON Response 200 OK
Returns a results object containing health scores and personalised recommendations.
{
"scores": {
"gut_health": 89.25,
"Diversity": 88.0,
"Probiotic": 90.07,
"Commensal": 98.15,
"Pathobiont": 83.33
},
"recommendations": {
"food": {
"enjoy": ["cranberries", "green tea", "pomegranate", ...],
"avoid": ["acacia tree", "guar bean", ...]
},
"prebiotics": {
"enjoy": ["Acacia fiber", "lactulose", ...],
"reduce": ["PHGG", "psyllium", ...]
},
"probiotics": {
"reduce": ["Abiotrophia defectiva"]
}
},
"general": {
"kit_id": "BS1-ABC12",
"sample_id": 380,
"export_date": "2026-01-09 11:49:49",
"pipeline_id": 1
}
}
Response Fields
| Field | Description |
|---|---|
scores.gut_health |
Overall gut health score (0–100) |
scores.Diversity |
Microbiome diversity percentile (0–100) |
scores.Probiotic |
Beneficial bacteria score (0–100) |
scores.Commensal |
Commensal bacteria score (0–100) |
scores.Pathobiont |
Pathogenic bacteria score (0–100) |
recommendations |
Personalised recommendations grouped by category (food, prebiotics, probiotics), each containing enjoy, avoid, or reduce lists |
general |
Metadata including kit ID, sample ID, export timestamp, and pipeline ID |
PDF Response 200 OK
Returns a base64-encoded PDF report. See a sample report for the full layout. White-label partners can have the report branded as “Powered by Biomesight” with their own logo and colour scheme.
{
"kit_id": "BS1-ABC12",
"pdf": "JVBERi0xLjQKMS..."
}
CSV Response 200 OK
Returns a base64-encoded CSV file containing the full taxonomy breakdown for the sample. This includes abundances at every taxonomic rank (phylum, class, order, family, genus, species), giving you the raw data to power your own analysis and visualisations.
{
"kit_id": "BS1-ABC12",
"csv": "dGF4b25vbXksYW..."
}
Error Cases
| Status | Cause |
|---|---|
202 | Results are not ready yet — lab processing is still in progress |
203 | PDF report not ready (JSON results may already be available) |
403 | Kit does not belong to your account |
404 | Kit not found |
Get Kit Status
Look up the current status of a kit/sample as it moves through the lab pipeline.
Request Headers
| Header | Value |
|---|---|
Authorization | Bearer {access_token} |
Example Request
curl https://app.biomesight.com/api/v1/status/kit/BS1-ABC12 \
-H "Authorization: Bearer eyJhbGciOi..."
import requests
resp = requests.get(
"https://app.biomesight.com/api/v1/status/kit/BS1-ABC12",
headers={"Authorization": f"Bearer {token}"},
)
print(resp.json())
Response 200 OK
{
"kit_id": "BS1-ABC12",
"status": "Sample Received",
"description": "Lab has received and logged the sample",
"date": "2025-07-10T14:22:00Z"
}
The status values match those listed in Kit / Sample Status Updates below.
Error Cases
| Status | Cause |
|---|---|
403 | Kit does not belong to your account |
404 | Kit not found |
Get Order Status
Look up the current fulfilment status of an order.
Request Headers
| Header | Value |
|---|---|
Authorization | Bearer {access_token} |
Example Request
curl https://app.biomesight.com/api/v1/status/order/ORD-20250615-001 \
-H "Authorization: Bearer eyJhbGciOi..."
import requests
resp = requests.get(
"https://app.biomesight.com/api/v1/status/order/ORD-20250615-001",
headers={"Authorization": f"Bearer {token}"},
)
print(resp.json())
Response 200 OK
{
"order_id": "ORD-20250615-001",
"status": "Delivered",
"description": "Kit has been delivered",
"date": "2025-06-20T09:15:00Z"
}
The status values match those listed in Order Status Updates below.
Error Cases
| Status | Cause |
|---|---|
403 | Order does not belong to your account |
404 | Order not found |
Status Webhooks
Biomesight pushes status updates to your endpoint as orders and samples progress
through the fulfilment and lab pipeline. You provide a webhook URL during onboarding and
we send authenticated POST requests to it whenever a status changes.
Webhook Payload
{
"order_id": "ORD-20250615-001", // for order updates
"kit_id": "BS1-ABC12", // for kit/sample updates
"status": "Sample Received",
"description": "Lab received sample",
"date": "2025-07-10T14:22:00Z"
}
Webhook requests include an Authorization: Bearer header using OAuth credentials
you provide to us, so you can verify the sender.
Kit / Sample Status Updates
These statuses are pushed as a sample moves through the lab pipeline:
| Status | Description |
|---|---|
| Shipping to Lab | Kit dispatched to the laboratory |
| Sample Delivered | Sample delivered to lab but not yet acknowledged |
| Sample Received | Lab has received and logged the sample |
| Lab Processing | Sequencing and analysis has started |
| Lab Processing Repeating | Sample is being processed a second time (can occur up to 2 times) |
| Results Processed | Analysis complete — results are available via the API |
| Replacement Kit | A replacement kit has been issued |
| Sample Not Viable | Sample could not be processed; a replacement may be needed |
| Enquiry Initiated | A manual enquiry has been opened for this sample |
| Dried Out | Sample dried out in transit; a new sample is needed |
| Sample Cancelled | Sample processing was cancelled (normally at customer request) |
| QA Failed | Lab processing completed but did not pass quality criteria |
Order Status Updates
These statuses are pushed as an order moves through fulfilment:
| Status | Description |
|---|---|
| Booked with Amazon | Order submitted to Amazon FBA for fulfilment |
| Dispatched | Kit has been dispatched from the warehouse |
| Shipped | Kit is in transit to the customer |
| Delivered | Kit has been delivered |
| Cancelled | Order has been cancelled |
| Error | An error occurred during fulfilment |
| Lost | Kit was lost in transit |
| Enquiry in Progress | A fulfilment enquiry is in progress |
Pending status is the default when an order is created and
is never sent as a webhook. Amazon FBA integration is not yet fully implemented —
currently only Booked with Amazon is sent automatically. The remaining
fulfilment statuses (Dispatched, Shipped, Delivered, etc.)
will be pushed automatically when Amazon integration is live, or when manually updated by the
Biomesight team.
Error Handling
All error responses follow a consistent JSON format:
{
"error": "A description of what went wrong"
}
Common HTTP Status Codes
| Code | Meaning |
|---|---|
200 | Success |
201 | Resource created (e.g. new order) |
202 | Accepted but not ready (e.g. results still processing) |
400 | Bad request — missing or invalid parameters |
401 | Unauthorised — missing or expired token |
403 | Forbidden — insufficient permissions or IP not whitelisted |
404 | Resource not found |
409 | Conflict — duplicate resource (e.g. duplicate order ID) |
422 | Unprocessable entity — data format error |
500 | Server error — contact support if this persists |
Ready to Integrate?
Get in touch and we will set you up with API credentials and a sandbox environment — support@biomesight.com