Create pre-booking
curl --request POST \
--url https://v2.flabs.in/client/billing/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"labID": "your_flabs_lab_id",
"patient_details": {
"first_name": "name",
"last_name": "surname",
"gender": "male",
"age": 24,
"age_type": "year"
},
"integrator_id": "your_unique_integrator_id",
"unmapped_tests": [
"unmapped test name"
],
"mapped_tests": [
{
"flabs_id": "FLABSTESTID"
},
{
"id": "test_id"
}
],
"mapped_packages": [
{
"id": "package_id"
}
],
"unmapped_packages": [
"unmapped package name"
],
"unmapped_packages_with_tests": [
{
"package_name": "package name",
"tests": [
"test name 1",
"test name 2"
]
}
],
"lead_source": "<lead source>"
}
'import requests
url = "https://v2.flabs.in/client/billing/create"
payload = {
"labID": "your_flabs_lab_id",
"patient_details": {
"first_name": "name",
"last_name": "surname",
"gender": "male",
"age": 24,
"age_type": "year"
},
"integrator_id": "your_unique_integrator_id",
"unmapped_tests": ["unmapped test name"],
"mapped_tests": [{ "flabs_id": "FLABSTESTID" }, { "id": "test_id" }],
"mapped_packages": [{ "id": "package_id" }],
"unmapped_packages": ["unmapped package name"],
"unmapped_packages_with_tests": [
{
"package_name": "package name",
"tests": ["test name 1", "test name 2"]
}
],
"lead_source": "<lead source>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
labID: 'your_flabs_lab_id',
patient_details: {
first_name: 'name',
last_name: 'surname',
gender: 'male',
age: 24,
age_type: 'year'
},
integrator_id: 'your_unique_integrator_id',
unmapped_tests: ['unmapped test name'],
mapped_tests: [{flabs_id: 'FLABSTESTID'}, {id: 'test_id'}],
mapped_packages: [{id: 'package_id'}],
unmapped_packages: ['unmapped package name'],
unmapped_packages_with_tests: [{package_name: 'package name', tests: ['test name 1', 'test name 2']}],
lead_source: '<lead source>'
})
};
fetch('https://v2.flabs.in/client/billing/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://v2.flabs.in/client/billing/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'labID' => 'your_flabs_lab_id',
'patient_details' => [
'first_name' => 'name',
'last_name' => 'surname',
'gender' => 'male',
'age' => 24,
'age_type' => 'year'
],
'integrator_id' => 'your_unique_integrator_id',
'unmapped_tests' => [
'unmapped test name'
],
'mapped_tests' => [
[
'flabs_id' => 'FLABSTESTID'
],
[
'id' => 'test_id'
]
],
'mapped_packages' => [
[
'id' => 'package_id'
]
],
'unmapped_packages' => [
'unmapped package name'
],
'unmapped_packages_with_tests' => [
[
'package_name' => 'package name',
'tests' => [
'test name 1',
'test name 2'
]
]
],
'lead_source' => '<lead source>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://v2.flabs.in/client/billing/create"
payload := strings.NewReader("{\n \"labID\": \"your_flabs_lab_id\",\n \"patient_details\": {\n \"first_name\": \"name\",\n \"last_name\": \"surname\",\n \"gender\": \"male\",\n \"age\": 24,\n \"age_type\": \"year\"\n },\n \"integrator_id\": \"your_unique_integrator_id\",\n \"unmapped_tests\": [\n \"unmapped test name\"\n ],\n \"mapped_tests\": [\n {\n \"flabs_id\": \"FLABSTESTID\"\n },\n {\n \"id\": \"test_id\"\n }\n ],\n \"mapped_packages\": [\n {\n \"id\": \"package_id\"\n }\n ],\n \"unmapped_packages\": [\n \"unmapped package name\"\n ],\n \"unmapped_packages_with_tests\": [\n {\n \"package_name\": \"package name\",\n \"tests\": [\n \"test name 1\",\n \"test name 2\"\n ]\n }\n ],\n \"lead_source\": \"<lead source>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://v2.flabs.in/client/billing/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"labID\": \"your_flabs_lab_id\",\n \"patient_details\": {\n \"first_name\": \"name\",\n \"last_name\": \"surname\",\n \"gender\": \"male\",\n \"age\": 24,\n \"age_type\": \"year\"\n },\n \"integrator_id\": \"your_unique_integrator_id\",\n \"unmapped_tests\": [\n \"unmapped test name\"\n ],\n \"mapped_tests\": [\n {\n \"flabs_id\": \"FLABSTESTID\"\n },\n {\n \"id\": \"test_id\"\n }\n ],\n \"mapped_packages\": [\n {\n \"id\": \"package_id\"\n }\n ],\n \"unmapped_packages\": [\n \"unmapped package name\"\n ],\n \"unmapped_packages_with_tests\": [\n {\n \"package_name\": \"package name\",\n \"tests\": [\n \"test name 1\",\n \"test name 2\"\n ]\n }\n ],\n \"lead_source\": \"<lead source>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://v2.flabs.in/client/billing/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"labID\": \"your_flabs_lab_id\",\n \"patient_details\": {\n \"first_name\": \"name\",\n \"last_name\": \"surname\",\n \"gender\": \"male\",\n \"age\": 24,\n \"age_type\": \"year\"\n },\n \"integrator_id\": \"your_unique_integrator_id\",\n \"unmapped_tests\": [\n \"unmapped test name\"\n ],\n \"mapped_tests\": [\n {\n \"flabs_id\": \"FLABSTESTID\"\n },\n {\n \"id\": \"test_id\"\n }\n ],\n \"mapped_packages\": [\n {\n \"id\": \"package_id\"\n }\n ],\n \"unmapped_packages\": [\n \"unmapped package name\"\n ],\n \"unmapped_packages_with_tests\": [\n {\n \"package_name\": \"package name\",\n \"tests\": [\n \"test name 1\",\n \"test name 2\"\n ]\n }\n ],\n \"lead_source\": \"<lead source>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Booking created successfully",
"integrator_id": "your_unique_integrator_id",
"preBookingID": "pre_booking_id"
}{
"success": false,
"status": 400,
"message": "Bad Request",
"error": {
"details": "Barcode already exists or invalid request data"
}
}{
"success": false,
"status": 500,
"message": "Internal Server Error",
"error": {
"details": "An unexpected error occurred"
}
}Billing
Create Pre-booking
Create a pre-booking in the Flabs system with patient details and test/package information. This initiates the billing workflow.
POST
/
client
/
billing
/
create
Create pre-booking
curl --request POST \
--url https://v2.flabs.in/client/billing/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"labID": "your_flabs_lab_id",
"patient_details": {
"first_name": "name",
"last_name": "surname",
"gender": "male",
"age": 24,
"age_type": "year"
},
"integrator_id": "your_unique_integrator_id",
"unmapped_tests": [
"unmapped test name"
],
"mapped_tests": [
{
"flabs_id": "FLABSTESTID"
},
{
"id": "test_id"
}
],
"mapped_packages": [
{
"id": "package_id"
}
],
"unmapped_packages": [
"unmapped package name"
],
"unmapped_packages_with_tests": [
{
"package_name": "package name",
"tests": [
"test name 1",
"test name 2"
]
}
],
"lead_source": "<lead source>"
}
'import requests
url = "https://v2.flabs.in/client/billing/create"
payload = {
"labID": "your_flabs_lab_id",
"patient_details": {
"first_name": "name",
"last_name": "surname",
"gender": "male",
"age": 24,
"age_type": "year"
},
"integrator_id": "your_unique_integrator_id",
"unmapped_tests": ["unmapped test name"],
"mapped_tests": [{ "flabs_id": "FLABSTESTID" }, { "id": "test_id" }],
"mapped_packages": [{ "id": "package_id" }],
"unmapped_packages": ["unmapped package name"],
"unmapped_packages_with_tests": [
{
"package_name": "package name",
"tests": ["test name 1", "test name 2"]
}
],
"lead_source": "<lead source>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
labID: 'your_flabs_lab_id',
patient_details: {
first_name: 'name',
last_name: 'surname',
gender: 'male',
age: 24,
age_type: 'year'
},
integrator_id: 'your_unique_integrator_id',
unmapped_tests: ['unmapped test name'],
mapped_tests: [{flabs_id: 'FLABSTESTID'}, {id: 'test_id'}],
mapped_packages: [{id: 'package_id'}],
unmapped_packages: ['unmapped package name'],
unmapped_packages_with_tests: [{package_name: 'package name', tests: ['test name 1', 'test name 2']}],
lead_source: '<lead source>'
})
};
fetch('https://v2.flabs.in/client/billing/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://v2.flabs.in/client/billing/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'labID' => 'your_flabs_lab_id',
'patient_details' => [
'first_name' => 'name',
'last_name' => 'surname',
'gender' => 'male',
'age' => 24,
'age_type' => 'year'
],
'integrator_id' => 'your_unique_integrator_id',
'unmapped_tests' => [
'unmapped test name'
],
'mapped_tests' => [
[
'flabs_id' => 'FLABSTESTID'
],
[
'id' => 'test_id'
]
],
'mapped_packages' => [
[
'id' => 'package_id'
]
],
'unmapped_packages' => [
'unmapped package name'
],
'unmapped_packages_with_tests' => [
[
'package_name' => 'package name',
'tests' => [
'test name 1',
'test name 2'
]
]
],
'lead_source' => '<lead source>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://v2.flabs.in/client/billing/create"
payload := strings.NewReader("{\n \"labID\": \"your_flabs_lab_id\",\n \"patient_details\": {\n \"first_name\": \"name\",\n \"last_name\": \"surname\",\n \"gender\": \"male\",\n \"age\": 24,\n \"age_type\": \"year\"\n },\n \"integrator_id\": \"your_unique_integrator_id\",\n \"unmapped_tests\": [\n \"unmapped test name\"\n ],\n \"mapped_tests\": [\n {\n \"flabs_id\": \"FLABSTESTID\"\n },\n {\n \"id\": \"test_id\"\n }\n ],\n \"mapped_packages\": [\n {\n \"id\": \"package_id\"\n }\n ],\n \"unmapped_packages\": [\n \"unmapped package name\"\n ],\n \"unmapped_packages_with_tests\": [\n {\n \"package_name\": \"package name\",\n \"tests\": [\n \"test name 1\",\n \"test name 2\"\n ]\n }\n ],\n \"lead_source\": \"<lead source>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://v2.flabs.in/client/billing/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"labID\": \"your_flabs_lab_id\",\n \"patient_details\": {\n \"first_name\": \"name\",\n \"last_name\": \"surname\",\n \"gender\": \"male\",\n \"age\": 24,\n \"age_type\": \"year\"\n },\n \"integrator_id\": \"your_unique_integrator_id\",\n \"unmapped_tests\": [\n \"unmapped test name\"\n ],\n \"mapped_tests\": [\n {\n \"flabs_id\": \"FLABSTESTID\"\n },\n {\n \"id\": \"test_id\"\n }\n ],\n \"mapped_packages\": [\n {\n \"id\": \"package_id\"\n }\n ],\n \"unmapped_packages\": [\n \"unmapped package name\"\n ],\n \"unmapped_packages_with_tests\": [\n {\n \"package_name\": \"package name\",\n \"tests\": [\n \"test name 1\",\n \"test name 2\"\n ]\n }\n ],\n \"lead_source\": \"<lead source>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://v2.flabs.in/client/billing/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"labID\": \"your_flabs_lab_id\",\n \"patient_details\": {\n \"first_name\": \"name\",\n \"last_name\": \"surname\",\n \"gender\": \"male\",\n \"age\": 24,\n \"age_type\": \"year\"\n },\n \"integrator_id\": \"your_unique_integrator_id\",\n \"unmapped_tests\": [\n \"unmapped test name\"\n ],\n \"mapped_tests\": [\n {\n \"flabs_id\": \"FLABSTESTID\"\n },\n {\n \"id\": \"test_id\"\n }\n ],\n \"mapped_packages\": [\n {\n \"id\": \"package_id\"\n }\n ],\n \"unmapped_packages\": [\n \"unmapped package name\"\n ],\n \"unmapped_packages_with_tests\": [\n {\n \"package_name\": \"package name\",\n \"tests\": [\n \"test name 1\",\n \"test name 2\"\n ]\n }\n ],\n \"lead_source\": \"<lead source>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Booking created successfully",
"integrator_id": "your_unique_integrator_id",
"preBookingID": "pre_booking_id"
}{
"success": false,
"status": 400,
"message": "Bad Request",
"error": {
"details": "Barcode already exists or invalid request data"
}
}{
"success": false,
"status": 500,
"message": "Internal Server Error",
"error": {
"details": "An unexpected error occurred"
}
}Overview
Create a pre-booking in the Flabs system to initiate the laboratory workflow. This endpoint accepts patient details and test/package information to start the billing process.Authentication
Requires a valid Bearer token from the authentication API.Request Parameters
Required Fields
| Field | Type | Description |
|---|---|---|
patient_details | object | Patient information (required) |
patient_details.first_name | string | Patient’s first name |
patient_details.gender | string | Patient’s gender (male, female, other) |
patient_details.age | integer | Patient’s age |
patient_details.age_type | string | Age unit (year, month, day) |
integrator_id | string | Your unique identifier for this booking |
lead_source | string | Source of the booking (contact Flabs for available sources) |
Test/Package Requirements
At least one of the following is required:| Field | Type | Description |
|---|---|---|
mapped_tests | array | Tests mapped with Flabs (use flabs_id or id) |
unmapped_tests | array | Tests not mapped with Flabs |
mapped_packages | array | Packages mapped with Flabs (use id only) |
unmapped_packages | array | Packages not mapped with Flabs |
unmapped_packages_with_tests | array | Packages with associated tests not mapped with Flabs |
Optional Fields
| Field | Type | Description |
|---|---|---|
barCode | string | Unique barcode identifier |
patient_details.last_name | string | Patient’s last name |
doctor | string | Referring doctor ID (contact Flabs for the ID) |
hospital | string | Referring hospital ID (contact Flabs for the ID) |
rate_list_type | string | Rate list to apply for pricing (contact Flabs for valid values) |
Important Notes
- Patient details are mandatory with all required fields - At least one test or package array must be provided - Barcodes must be unique across the system
- Contact Flabs team for available lead sources - Contact Flabs team for
doctor/hospitalIDs and validrate_list_typevalues
- Use
flabs_idoridfor mapped tests - Onlyidis available for mapped packages (noflabs_id) - ThepreBookingIDin the response is used to track the booking through the workflow
Body
application/json
Was this page helpful?