Labs API

Endpoint

GET https://www.britelink.io/api/v1/labs

This endpoint retrieves a list of laboratory tests based on search criteria, including test names or category/subcategory names. It supports pagination and conditional inclusion of detailed fields.

To ensure secure access to the endpoint, authentication is required. Use the following HTTP header for your requests:

Authorization Header

HeaderValue
AuthorizationBearer YOUR_API_KEY

Replace YOUR_API_KEY with your actual API key provided upon registration or through your API management dashboard.

Example Request using cURL

Here is a sample cURL command to access the fetchLabs endpoint, including how to include the authorization header:

curl -X GET "https://britelink.io/api/v1/labs" \
     -H "Authorization: Bearer YOUR_API_KEY" \

Example Request using JavaScript

Below is an example JavaScript snippet using the Fetch API to make a request to the labs endpoint. It demonstrates how to include the authorization header:

const apiKey = "YOUR_API_KEY"; // Replace with your actual API key
const apiUrl = "https://britelink.io/api/v1/labs";

fetch(apiUrl, {
  method: "GET",
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
})
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

Request Parameters

ParameterTypeDescriptionRequired
nstringA comma-separated list of names to search for, matching either test names or category names.No
rbooleanIf true, includes all related fields in the test model. If false, returns basic test info.No
cursorstringA cursor for pagination, indicating the starting point for the next batch of results.No

Responses

  • HTTP 200: Successful response with a list of risk factors.
  • HTTP 404: No risk factors found for the given filters.
  • HTTP 500: Server error due to internal issues.

Response Format

The response is a JSON object containing an array of tests, each with basic or detailed information based on the r parameter, and a cursor for fetching the next page of results.

Basic Information Response

{
  "tests": [
    {
      "id": "1",
      "name": "Complete Blood Count",
      "normalRange": "4,500 to 10,000 cells per microliter",
      "units": "cells per microliter",
      "categoryName": "Hematology",
      "subCategoryName": "General Hematology"
    }
    // Additional test entries...
  ],
  "nextCursor": "cursorString"
}

Detailed Information Response (When r=true)

{
  "tests": [
    {
      "id": "1",
      "name": "Complete Blood Count",
      "normalRange": "4,500 to 10,000 cells per microliter",
      "units": "cells per microliter",
      "categoryName": "Hematology",
      "subCategoryName": "General Hematology",
      "description": "A test to evaluate your overall health...",
      "methodology": "Automated cell counter",
      "duration": "24 hours",
      "testResults": [
        /* Array of test result objects */
      ]
    }
    // Additional test entries...
  ],
  "nextCursor": "cursorString"
}

Use Cases

Clinical Decision Support Systems

Clinical decision support systems (CDSS) can use this endpoint to fetch relevant tests for specific conditions or symptoms entered by healthcare professionals. For example, entering "anemia" could return tests like "Complete Blood Count" under the "Hematology" category.

Electronic Health Records (EHR) Systems

EHR systems can integrate this endpoint to provide doctors with quick access to test information during patient consultations, helping them order the most appropriate tests based on the patient's symptoms or medical history.

Laboratory Information Systems (LIS)

LIS can utilize this API to help lab technicians verify test orders, understand test specifications, or find related tests for comparative analysis. This is especially useful in cases where specific tests require understanding of normal ranges, units, or methodologies.

Health Information Websites

Websites providing health information can use this endpoint to display detailed information about various laboratory tests, including their normal ranges, methodologies, and what they are typically used for, enhancing the content provided to their users.

Notes

  • Ensure URL encoding of the n parameter when searching for names with spaces or special characters.
  • The nextCursor should be used as is for pagination without any modifications or decoding.
  • The detailed response structure may vary based on the actual database schema and the implementation details of the db module.