QIMA Logo

Lab Testing Introduction

Latest Update Time: 2026-06-23 00:00:00

Lab Testing (LT) APIs allow you to programmatically search orders, create bookings, retrieve order details, fetch test results with report download links, and upload attachments. All LT endpoints require authentication and share a common set of request headers.

This page documents the shared setup used by every Lab Testing guide. Each API-specific guide links back here for authentication, headers, and environment details.

Base URL

All Lab Testing APIs are served from the QIMA Public API host for your environment:

https://ppapi.qima.com

LT endpoints use the /v1.2/lt/ path prefix. For production integrations, replace the host with the QIMA API host provided for your environment.

Required Headers

Call the Auth API first (POST /auth/v2/token) before any Lab Testing request. See the Getting Started Guide or Get Token API for authentication setup.

You also need a QIMA customer account with permission for the target LT operation, and an Ai-Api-Access-Token for the target environment provided by QIMA. Each API guide lists additional operation-specific requirements.

Header / ParameterLocationSourceDescription
Ai-Api-Access-TokenRequest header (all LT APIs)Provided by QIMARequest source identifier. Each client may have a different value per environment.
Ai-User-IdRequest header (all LT APIs)Auth API response userIdIdentifies the authenticated QIMA user.
AuthorizationRequest header (all LT APIs)Auth API access tokenFormat: Bearer <access-token>. Use the token from the same Auth API session as the other headers.
RefererRequest header (all LT APIs)Fixed valuehttps://preprodmy.qima.com/
clientIdQuery parameter (order search only)Auth API response companyIdRequired when calling Search Orders. Most other LT APIs do not use clientId; the authenticated user context is passed through the headers above.

Common Authentication Errors

These errors apply to all Lab Testing APIs:

StatusMeaningRecommended Action
401 UnauthorizedToken or user authentication failed.Confirm the Authorization, Ai-User-Id (userId), and Ai-Api-Access-Token headers are from the same Auth API session and environment.
403 ForbiddenThe user does not have access to the requested resource.Verify account permissions and, for order search, that clientId matches the Auth API response companyId.

Each API guide includes additional operation-specific error codes.

Available APIs

APIMethodEndpointGuideAPI Reference
Search ordersGET/v1.2/lt/ordersOrder Search GuideAPI Reference
Create orderPOST/v1.2/lt/ordersOrder Create GuideAPI Reference
Get order detailsGET/v1.2/lt/orders/{orderId}Order Detail GuideAPI Reference
Get order resultsGET/v1.2/lt/order-results/{orderId}Order Results GuideAPI Reference
Upload attachmentsPOST/v1.2/lt/orders/{orderId}/attachmentsOrder Attachments GuideAPI Reference
Update orderPUT/v1.2/lt/orders/{orderId}Order Update GuideAPI Reference

Integration Workflows

The diagrams below show recommended API sequences for common integration scenarios. Follow the linked guides for request examples, field notes, and error handling.

1. Authenticate (Required for All Flows)

All Lab Testing workflows begin with authentication. Store userId, companyId, and the access token from the response before calling any LT endpoint.

POST /auth/v2/token

Extract userId, companyId, access token

Set Ai-User-Id, Authorization headers

2. View Test Results and Download Reports

Use this flow when you need to find an order and retrieve its test results, final report files, and attachment download links.

Typical steps:

  1. Authenticate via the Auth API.
  2. Call Search Orders with clientId (from companyId) to locate the target order and obtain orderId.
  3. Call Get Order Results with that orderId.
  4. Download files from finalReport.reportFile and attachments[].url before the signed URLs expire.

1. POST /auth/v2/token

2. GET /v1.2/lt/orders
clientId, page, size

Read orderId from
content.data[].generalInformation.orderId

3. GET /v1.2/lt/order-results/{orderId}

Read overallResult, testDetail

Download from finalReport.reportFile

Download from attachments[].url

StepGuide
Search ordersOrder Search Guide
Get results & reportsOrder Results Guide

3. Create a Lab Testing Order

Use this flow when you want to submit a new LT booking through the API.

Typical steps:

  1. Authenticate via the Auth API.
  2. Call Create Order with booking details in the request body.
  3. Store the returned orderId and qimaRefNo from the response.
  4. Optionally call Search Orders or Get Order Details to verify the order was created.

1. POST /auth/v2/token

2. POST /v1.2/lt/orders

Store orderId and qimaRefNo
from content.generalInformation

Optional verification

GET /v1.2/lt/orders
Search by qimaRefNo or bookingRefNo

GET /v1.2/lt/orders/{orderId}
Get full order details

StepGuide
Create orderOrder Create Guide
Verify via searchOrder Search Guide
Verify via detailOrder Detail Guide

Custom fields: If your booking payload includes customFields, the QIMA development or business team must configure those fields in the target environment before they can be used. See the Order Create Guide.

4. Upload Attachments to an Order

Use this flow when you need to attach supporting documents to an existing LT order.

Typical steps:

  1. Authenticate via the Auth API.
  2. Obtain the target orderId by calling Search Orders or Get Order Details.
  3. Call Upload Attachments with the orderId and files as multipart/form-data.
  4. Generate a new UUID for the Idempotency-Key header on each upload request to avoid duplicate uploads.

1. POST /auth/v2/token

Find target order

GET /v1.2/lt/orders
Search by clientId and filters

GET /v1.2/lt/orders/{orderId}
If orderId already known

Read orderId from search results

2. POST /v1.2/lt/orders/{orderId}/attachments
multipart/form-data + Idempotency-Key

Review upload result per file

StepGuide
Find orderOrder Search Guide or Order Detail Guide
Upload attachmentsOrder Attachments Guide

5. Retrieve Full Order Details

Use this flow when you need complete order information — product details, tests, sample collection, recipients, and existing attachments — without test result report files.

1. POST /auth/v2/token

How do you identify the order?

GET /v1.2/lt/orders
Search first if orderId unknown

Read orderId from results

orderId already known

2. GET /v1.2/lt/orders/{orderId}

Review product, tests,
sampleCollection, attachments

StepGuide
Search ordersOrder Search Guide
Get order detailsOrder Detail Guide

6. Update an Existing Order

Use this flow when you need to modify booking details, product information, recipients, or custom fields on an existing order.

Typical steps:

  1. Authenticate via the Auth API.
  2. Obtain the target orderId by calling Search Orders or Get Order Details.
  3. Call Update Order with the fields to change in the request body.
  4. Optionally call Get Order Details again to verify the update.

1. POST /auth/v2/token

Find target order

GET /v1.2/lt/orders
Search by clientId and filters

GET /v1.2/lt/orders/{orderId}
If orderId already known

Read orderId from search results

2. PUT /v1.2/lt/orders/{orderId}

Review updated order in response

Verify changes?

GET /v1.2/lt/orders/{orderId}

StepGuide
Find orderOrder Search Guide or Order Detail Guide
Update orderOrder Update Guide

Choosing the Right API

Your goalRecommended APIs
List or filter LT ordersSearch Orders
Submit a new LT bookingCreate Order
Update an existing LT orderUpdate Order
View full order informationGet Order Details
Get pass/fail results and report download linksGet Order Results
Upload documents to an existing orderUpload Attachments