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

1 Contact us — reach out at support@biomesight.com to discuss your integration and receive API credentials.
2 Authenticate — use your Client ID and Client Secret to obtain an access token via the OAuth 2.0 Client Credentials flow.
3 Integrate — create orders, register kits, and retrieve results using the endpoints described below.
4 Go live — once you have tested in our sandbox environment, we will provision production credentials and you are ready to launch.

Authentication

All API requests require a Bearer token. Obtain one by sending your Client ID and Client Secret using HTTP Basic authentication:

POST /api/v1/auth/token

Request

Header / FieldValue
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.

POST /api/v1/order

Request Headers

HeaderValue
AuthorizationBearer {access_token}
Content-Typeapplication/json

Request Body

FieldTypeDescription
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

StatusCause
400Missing or invalid required fields (email, address, items, etc.)
409Duplicate order — an order with the same order_id already exists
422Data 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.

POST /api/v1/register_kit

Request Headers

HeaderValue
AuthorizationBearer {access_token}
Content-Typeapplication/json

Request Body

FieldTypeDescription
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

StatusCause
400Missing 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.

GET /api/v1/results/{kit_id}

Request Headers

HeaderValue
AuthorizationBearer {access_token}

Query Parameters

ParameterTypeDescription
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

FieldDescription
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
Note: The JSON response can be extended to include additional result data such as full taxonomy breakdowns, metabolite predictions, and more — matching the detail available in the PDF and CSV exports. Contact us to discuss your requirements.

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

StatusCause
202Results are not ready yet — lab processing is still in progress
203PDF report not ready (JSON results may already be available)
403Kit does not belong to your account
404Kit not found

Get Kit Status

Look up the current status of a kit/sample as it moves through the lab pipeline.

GET /api/v1/status/kit/{kit_id}

Request Headers

HeaderValue
AuthorizationBearer {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

StatusCause
403Kit does not belong to your account
404Kit not found

Get Order Status

Look up the current fulfilment status of an order.

GET /api/v1/status/order/{order_id}

Request Headers

HeaderValue
AuthorizationBearer {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

StatusCause
403Order does not belong to your account
404Order 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:

StatusDescription
Shipping to LabKit dispatched to the laboratory
Sample DeliveredSample delivered to lab but not yet acknowledged
Sample ReceivedLab has received and logged the sample
Lab ProcessingSequencing and analysis has started
Lab Processing RepeatingSample is being processed a second time (can occur up to 2 times)
Results ProcessedAnalysis complete — results are available via the API
Replacement KitA replacement kit has been issued
Sample Not ViableSample could not be processed; a replacement may be needed
Enquiry InitiatedA manual enquiry has been opened for this sample
Dried OutSample dried out in transit; a new sample is needed
Sample CancelledSample processing was cancelled (normally at customer request)
QA FailedLab processing completed but did not pass quality criteria

Order Status Updates

These statuses are pushed as an order moves through fulfilment:

StatusDescription
Booked with AmazonOrder submitted to Amazon FBA for fulfilment
DispatchedKit has been dispatched from the warehouse
ShippedKit is in transit to the customer
DeliveredKit has been delivered
CancelledOrder has been cancelled
ErrorAn error occurred during fulfilment
LostKit was lost in transit
Enquiry in ProgressA fulfilment enquiry is in progress
Note: The 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

CodeMeaning
200Success
201Resource created (e.g. new order)
202Accepted but not ready (e.g. results still processing)
400Bad request — missing or invalid parameters
401Unauthorised — missing or expired token
403Forbidden — insufficient permissions or IP not whitelisted
404Resource not found
409Conflict — duplicate resource (e.g. duplicate order ID)
422Unprocessable entity — data format error
500Server 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

DISCLAIMER This service has not been evaluated by the Food and Drug Administration or other healthcare authorities. Our platform and related products and services are not intended to diagnose, treat, cure or prevent any disease. Ranges apply to over 18s only.