from junction import Gender, Junction, PatientAddressWithValidation, PatientDetailsWithValidation
from junction.environment import JunctionEnvironment
client = Junction(
api_key="YOUR_API_KEY",
environment=JunctionEnvironment.SANDBOX,
)
data = client.lab_tests.create_order(
user_id="63661a2b-2bb3-4125-bb1a-b590f64f057f",
lab_test_id="5b41f610-ebc5-4803-8f0c-a61c3bdc7faf",
patient_details=PatientDetailsWithValidation(
first_name="John",
last_name="Doe",
dob="2020-01-01",
gender=Gender.MALE,
phone_number="+1123456789",
email="email@email.com",
),
patient_address=PatientAddressWithValidation(
receiver_name="John Doe",
first_line="123 Main St.",
second_line="Apt. 208",
city="San Francisco",
state="CA",
zip="91189",
country="US",
phone_number="+1123456789",
access_notes="Gate code #1234, use side entrance",
),
)
import { JunctionClient, JunctionEnvironment } from "@junction-api/sdk";
const client = new JunctionClient({
apiKey: "YOUR_API_KEY",
environment: JunctionEnvironment.Sandbox,
});
const data = await client.labTests.createOrder({
userId: "63661a2b-2bb3-4125-bb1a-b590f64f057f",
labTestId: "5b41f610-ebc5-4803-8f0c-a61c3bdc7faf",
patientDetails: {
firstName: "John",
lastName: "Doe",
dob: "2020-01-01",
gender: "male",
phoneNumber: "+1123456789",
email: "email@email.com",
},
patientAddress: {
receiverName: "John Doe",
firstLine: "123 Main St.",
secondLine: "Apt. 208",
city: "San Francisco",
state: "CA",
zip: "91189",
country: "US",
phoneNumber: "+1123456789",
accessNotes: "Gate code #1234, use side entrance",
},
});
import com.junction.api.Junction;
import com.junction.api.core.Environment;
import com.junction.api.resources.labtests.requests.CreateOrderRequestCompatible;
import com.junction.api.types.Gender;
import com.junction.api.types.PatientAddressWithValidation;
import com.junction.api.types.PatientDetailsWithValidation;
Junction client = Junction.builder()
.apiKey("YOUR_API_KEY")
.environment(Environment.SANDBOX)
.build();
var data = client.labTests().createOrder(
CreateOrderRequestCompatible.builder()
.userId("63661a2b-2bb3-4125-bb1a-b590f64f057f")
.patientDetails(
PatientDetailsWithValidation.builder()
.firstName("John")
.lastName("Doe")
.dob("2020-01-01")
.gender(Gender.MALE)
.phoneNumber("+1123456789")
.email("email@email.com")
.build()
)
.patientAddress(
PatientAddressWithValidation.builder()
.firstLine("123 Main St.")
.city("San Francisco")
.state("CA")
.zip("91189")
.country("US")
.build()
)
.labTestId("5b41f610-ebc5-4803-8f0c-a61c3bdc7faf")
.build()
);
import (
"context"
junction "github.com/junction-api/junction-go"
"github.com/junction-api/junction-go/client"
"github.com/junction-api/junction-go/option"
)
c := client.NewClient(
option.WithApiKey("YOUR_API_KEY"),
option.WithBaseURL(junction.Environments.Sandbox),
)
response, err := c.LabTests.CreateOrder(context.TODO(), &junction.CreateOrderRequestCompatible{
UserId: "63661a2b-2bb3-4125-bb1a-b590f64f057f",
LabTestId: junction.String("5b41f610-ebc5-4803-8f0c-a61c3bdc7faf"),
PatientDetails: &junction.PatientDetailsWithValidation{
FirstName: "John",
LastName: "Doe",
Dob: "2020-01-01",
Gender: junction.GenderMale,
PhoneNumber: "+1123456789",
Email: "email@email.com",
},
PatientAddress: &junction.PatientAddressWithValidation{
ReceiverName: junction.String("John Doe"),
FirstLine: "123 Main St.",
SecondLine: junction.String("Apt. 208"),
City: "San Francisco",
State: "CA",
Zip: "91189",
Country: "US",
PhoneNumber: junction.String("+1123456789"),
AccessNotes: junction.String("Gate code #1234, use side entrance"),
},
})
if err != nil {
return err
}
fmt.Printf("Received data %s\n", response)
{
"order": {
"id": "ea7eae96-2c25-404f-b043-bfc08584610d",
"team_id": "c26a9cc7-cdff-4f23-a5f6-74d40088c16a",
"user_id": "63661a2b-2bb3-4125-bb1a-b590f64f057f",
"patient_details": {
"dob": "2020-01-01",
"gender": "male"
},
"patient_address": {
"receiver_name": "John Doe",
"first_line": "123 Main St.",
"second_line": "Apt. 208",
"city": "San Francisco",
"state": "CA",
"zip": "91189",
"country": "United States",
"phone_number": "+1123456789",
"access_notes": "Gate code #1234, use side entrance"
},
"priority": false,
"health_insurance_id": "33ec11aa-d8bf-4f46-950d-c9171be3c22f",
"details": {
"type": "testkit",
"data": {
"id": "a655f0e4-6405-4a1d-80b7-66f06c2108a7",
"shipment": {
"id": "d55210cc-3d9f-4115-8262-5013f700c7be",
"outbound_tracking_number": "<outbound_tracking_number>",
"outbound_tracking_url": "<outbound_tracking_url>",
"inbound_tracking_number": "<inbound_tracking_number>",
"inbound_tracking_url": "<inbound_tracking_url>",
"outbound_courier": "usps",
"inbound_courier": "usps",
"notes": "<notes>",
"created_at": "2020-01-01T00:00:00.000Z",
"updated_at": "2020-01-01T00:00:00.000Z"
},
"created_at": "2020-01-01T00:00:00Z",
"updated_at": "2020-01-01T00:00:00Z"
}
},
"lab_test": {
"name": "Lipids Panel",
"description": "Cholesterol test",
"method": "testkit"
},
"sample_id": "123456789",
"notes": "This is a note",
"created_at": "2020-01-01T00:00:00Z",
"updated_at": "2020-01-01T00:00:00Z",
"status": "collecting_sample",
"events": [
{
"id": 1,
"created_at": "2022-01-01T00:00:00Z",
"status": "received.testkit.ordered"
},
{
"id": 2,
"created_at": "2022-01-02T00:00:00Z",
"status": "received.testkit.requisition_created"
},
{
"id": 3,
"created_at": "2022-01-03T00:00:00Z",
"status": "collecting_sample.testkit.transit_customer"
}
]
},
"status": "string",
"message": "string"
}
Orders
Create order
Create or submit order via the Junction API. Requires authentication with your team API key.
POST
/
v3
/
order
from junction import Gender, Junction, PatientAddressWithValidation, PatientDetailsWithValidation
from junction.environment import JunctionEnvironment
client = Junction(
api_key="YOUR_API_KEY",
environment=JunctionEnvironment.SANDBOX,
)
data = client.lab_tests.create_order(
user_id="63661a2b-2bb3-4125-bb1a-b590f64f057f",
lab_test_id="5b41f610-ebc5-4803-8f0c-a61c3bdc7faf",
patient_details=PatientDetailsWithValidation(
first_name="John",
last_name="Doe",
dob="2020-01-01",
gender=Gender.MALE,
phone_number="+1123456789",
email="email@email.com",
),
patient_address=PatientAddressWithValidation(
receiver_name="John Doe",
first_line="123 Main St.",
second_line="Apt. 208",
city="San Francisco",
state="CA",
zip="91189",
country="US",
phone_number="+1123456789",
access_notes="Gate code #1234, use side entrance",
),
)
import { JunctionClient, JunctionEnvironment } from "@junction-api/sdk";
const client = new JunctionClient({
apiKey: "YOUR_API_KEY",
environment: JunctionEnvironment.Sandbox,
});
const data = await client.labTests.createOrder({
userId: "63661a2b-2bb3-4125-bb1a-b590f64f057f",
labTestId: "5b41f610-ebc5-4803-8f0c-a61c3bdc7faf",
patientDetails: {
firstName: "John",
lastName: "Doe",
dob: "2020-01-01",
gender: "male",
phoneNumber: "+1123456789",
email: "email@email.com",
},
patientAddress: {
receiverName: "John Doe",
firstLine: "123 Main St.",
secondLine: "Apt. 208",
city: "San Francisco",
state: "CA",
zip: "91189",
country: "US",
phoneNumber: "+1123456789",
accessNotes: "Gate code #1234, use side entrance",
},
});
import com.junction.api.Junction;
import com.junction.api.core.Environment;
import com.junction.api.resources.labtests.requests.CreateOrderRequestCompatible;
import com.junction.api.types.Gender;
import com.junction.api.types.PatientAddressWithValidation;
import com.junction.api.types.PatientDetailsWithValidation;
Junction client = Junction.builder()
.apiKey("YOUR_API_KEY")
.environment(Environment.SANDBOX)
.build();
var data = client.labTests().createOrder(
CreateOrderRequestCompatible.builder()
.userId("63661a2b-2bb3-4125-bb1a-b590f64f057f")
.patientDetails(
PatientDetailsWithValidation.builder()
.firstName("John")
.lastName("Doe")
.dob("2020-01-01")
.gender(Gender.MALE)
.phoneNumber("+1123456789")
.email("email@email.com")
.build()
)
.patientAddress(
PatientAddressWithValidation.builder()
.firstLine("123 Main St.")
.city("San Francisco")
.state("CA")
.zip("91189")
.country("US")
.build()
)
.labTestId("5b41f610-ebc5-4803-8f0c-a61c3bdc7faf")
.build()
);
import (
"context"
junction "github.com/junction-api/junction-go"
"github.com/junction-api/junction-go/client"
"github.com/junction-api/junction-go/option"
)
c := client.NewClient(
option.WithApiKey("YOUR_API_KEY"),
option.WithBaseURL(junction.Environments.Sandbox),
)
response, err := c.LabTests.CreateOrder(context.TODO(), &junction.CreateOrderRequestCompatible{
UserId: "63661a2b-2bb3-4125-bb1a-b590f64f057f",
LabTestId: junction.String("5b41f610-ebc5-4803-8f0c-a61c3bdc7faf"),
PatientDetails: &junction.PatientDetailsWithValidation{
FirstName: "John",
LastName: "Doe",
Dob: "2020-01-01",
Gender: junction.GenderMale,
PhoneNumber: "+1123456789",
Email: "email@email.com",
},
PatientAddress: &junction.PatientAddressWithValidation{
ReceiverName: junction.String("John Doe"),
FirstLine: "123 Main St.",
SecondLine: junction.String("Apt. 208"),
City: "San Francisco",
State: "CA",
Zip: "91189",
Country: "US",
PhoneNumber: junction.String("+1123456789"),
AccessNotes: junction.String("Gate code #1234, use side entrance"),
},
})
if err != nil {
return err
}
fmt.Printf("Received data %s\n", response)
{
"order": {
"id": "ea7eae96-2c25-404f-b043-bfc08584610d",
"team_id": "c26a9cc7-cdff-4f23-a5f6-74d40088c16a",
"user_id": "63661a2b-2bb3-4125-bb1a-b590f64f057f",
"patient_details": {
"dob": "2020-01-01",
"gender": "male"
},
"patient_address": {
"receiver_name": "John Doe",
"first_line": "123 Main St.",
"second_line": "Apt. 208",
"city": "San Francisco",
"state": "CA",
"zip": "91189",
"country": "United States",
"phone_number": "+1123456789",
"access_notes": "Gate code #1234, use side entrance"
},
"priority": false,
"health_insurance_id": "33ec11aa-d8bf-4f46-950d-c9171be3c22f",
"details": {
"type": "testkit",
"data": {
"id": "a655f0e4-6405-4a1d-80b7-66f06c2108a7",
"shipment": {
"id": "d55210cc-3d9f-4115-8262-5013f700c7be",
"outbound_tracking_number": "<outbound_tracking_number>",
"outbound_tracking_url": "<outbound_tracking_url>",
"inbound_tracking_number": "<inbound_tracking_number>",
"inbound_tracking_url": "<inbound_tracking_url>",
"outbound_courier": "usps",
"inbound_courier": "usps",
"notes": "<notes>",
"created_at": "2020-01-01T00:00:00.000Z",
"updated_at": "2020-01-01T00:00:00.000Z"
},
"created_at": "2020-01-01T00:00:00Z",
"updated_at": "2020-01-01T00:00:00Z"
}
},
"lab_test": {
"name": "Lipids Panel",
"description": "Cholesterol test",
"method": "testkit"
},
"sample_id": "123456789",
"notes": "This is a note",
"created_at": "2020-01-01T00:00:00Z",
"updated_at": "2020-01-01T00:00:00Z",
"status": "collecting_sample",
"events": [
{
"id": 1,
"created_at": "2022-01-01T00:00:00Z",
"status": "received.testkit.ordered"
},
{
"id": 2,
"created_at": "2022-01-02T00:00:00Z",
"status": "received.testkit.requisition_created"
},
{
"id": 3,
"created_at": "2022-01-03T00:00:00Z",
"status": "collecting_sample.testkit.transit_customer"
}
]
},
"status": "string",
"message": "string"
}
Patient name fields (
first_name, last_name) must follow specific validation rules due to lab restrictions. See Patient Name Validation for complete details.from junction import Gender, Junction, PatientAddressWithValidation, PatientDetailsWithValidation
from junction.environment import JunctionEnvironment
client = Junction(
api_key="YOUR_API_KEY",
environment=JunctionEnvironment.SANDBOX,
)
data = client.lab_tests.create_order(
user_id="63661a2b-2bb3-4125-bb1a-b590f64f057f",
lab_test_id="5b41f610-ebc5-4803-8f0c-a61c3bdc7faf",
patient_details=PatientDetailsWithValidation(
first_name="John",
last_name="Doe",
dob="2020-01-01",
gender=Gender.MALE,
phone_number="+1123456789",
email="email@email.com",
),
patient_address=PatientAddressWithValidation(
receiver_name="John Doe",
first_line="123 Main St.",
second_line="Apt. 208",
city="San Francisco",
state="CA",
zip="91189",
country="US",
phone_number="+1123456789",
access_notes="Gate code #1234, use side entrance",
),
)
import { JunctionClient, JunctionEnvironment } from "@junction-api/sdk";
const client = new JunctionClient({
apiKey: "YOUR_API_KEY",
environment: JunctionEnvironment.Sandbox,
});
const data = await client.labTests.createOrder({
userId: "63661a2b-2bb3-4125-bb1a-b590f64f057f",
labTestId: "5b41f610-ebc5-4803-8f0c-a61c3bdc7faf",
patientDetails: {
firstName: "John",
lastName: "Doe",
dob: "2020-01-01",
gender: "male",
phoneNumber: "+1123456789",
email: "email@email.com",
},
patientAddress: {
receiverName: "John Doe",
firstLine: "123 Main St.",
secondLine: "Apt. 208",
city: "San Francisco",
state: "CA",
zip: "91189",
country: "US",
phoneNumber: "+1123456789",
accessNotes: "Gate code #1234, use side entrance",
},
});
import com.junction.api.Junction;
import com.junction.api.core.Environment;
import com.junction.api.resources.labtests.requests.CreateOrderRequestCompatible;
import com.junction.api.types.Gender;
import com.junction.api.types.PatientAddressWithValidation;
import com.junction.api.types.PatientDetailsWithValidation;
Junction client = Junction.builder()
.apiKey("YOUR_API_KEY")
.environment(Environment.SANDBOX)
.build();
var data = client.labTests().createOrder(
CreateOrderRequestCompatible.builder()
.userId("63661a2b-2bb3-4125-bb1a-b590f64f057f")
.patientDetails(
PatientDetailsWithValidation.builder()
.firstName("John")
.lastName("Doe")
.dob("2020-01-01")
.gender(Gender.MALE)
.phoneNumber("+1123456789")
.email("email@email.com")
.build()
)
.patientAddress(
PatientAddressWithValidation.builder()
.firstLine("123 Main St.")
.city("San Francisco")
.state("CA")
.zip("91189")
.country("US")
.build()
)
.labTestId("5b41f610-ebc5-4803-8f0c-a61c3bdc7faf")
.build()
);
import (
"context"
junction "github.com/junction-api/junction-go"
"github.com/junction-api/junction-go/client"
"github.com/junction-api/junction-go/option"
)
c := client.NewClient(
option.WithApiKey("YOUR_API_KEY"),
option.WithBaseURL(junction.Environments.Sandbox),
)
response, err := c.LabTests.CreateOrder(context.TODO(), &junction.CreateOrderRequestCompatible{
UserId: "63661a2b-2bb3-4125-bb1a-b590f64f057f",
LabTestId: junction.String("5b41f610-ebc5-4803-8f0c-a61c3bdc7faf"),
PatientDetails: &junction.PatientDetailsWithValidation{
FirstName: "John",
LastName: "Doe",
Dob: "2020-01-01",
Gender: junction.GenderMale,
PhoneNumber: "+1123456789",
Email: "email@email.com",
},
PatientAddress: &junction.PatientAddressWithValidation{
ReceiverName: junction.String("John Doe"),
FirstLine: "123 Main St.",
SecondLine: junction.String("Apt. 208"),
City: "San Francisco",
State: "CA",
Zip: "91189",
Country: "US",
PhoneNumber: junction.String("+1123456789"),
AccessNotes: junction.String("Gate code #1234, use side entrance"),
},
})
if err != nil {
return err
}
fmt.Printf("Received data %s\n", response)
{
"order": {
"id": "ea7eae96-2c25-404f-b043-bfc08584610d",
"team_id": "c26a9cc7-cdff-4f23-a5f6-74d40088c16a",
"user_id": "63661a2b-2bb3-4125-bb1a-b590f64f057f",
"patient_details": {
"dob": "2020-01-01",
"gender": "male"
},
"patient_address": {
"receiver_name": "John Doe",
"first_line": "123 Main St.",
"second_line": "Apt. 208",
"city": "San Francisco",
"state": "CA",
"zip": "91189",
"country": "United States",
"phone_number": "+1123456789",
"access_notes": "Gate code #1234, use side entrance"
},
"priority": false,
"health_insurance_id": "33ec11aa-d8bf-4f46-950d-c9171be3c22f",
"details": {
"type": "testkit",
"data": {
"id": "a655f0e4-6405-4a1d-80b7-66f06c2108a7",
"shipment": {
"id": "d55210cc-3d9f-4115-8262-5013f700c7be",
"outbound_tracking_number": "<outbound_tracking_number>",
"outbound_tracking_url": "<outbound_tracking_url>",
"inbound_tracking_number": "<inbound_tracking_number>",
"inbound_tracking_url": "<inbound_tracking_url>",
"outbound_courier": "usps",
"inbound_courier": "usps",
"notes": "<notes>",
"created_at": "2020-01-01T00:00:00.000Z",
"updated_at": "2020-01-01T00:00:00.000Z"
},
"created_at": "2020-01-01T00:00:00Z",
"updated_at": "2020-01-01T00:00:00Z"
}
},
"lab_test": {
"name": "Lipids Panel",
"description": "Cholesterol test",
"method": "testkit"
},
"sample_id": "123456789",
"notes": "This is a note",
"created_at": "2020-01-01T00:00:00Z",
"updated_at": "2020-01-01T00:00:00Z",
"status": "collecting_sample",
"events": [
{
"id": 1,
"created_at": "2022-01-01T00:00:00Z",
"status": "received.testkit.ordered"
},
{
"id": 2,
"created_at": "2022-01-02T00:00:00Z",
"status": "received.testkit.requisition_created"
},
{
"id": 3,
"created_at": "2022-01-03T00:00:00Z",
"status": "collecting_sample.testkit.transit_customer"
}
]
},
"status": "string",
"message": "string"
}
Authorizations
Vital Team API Key
Body
application/json
Schema for the create Order endpoint.
Patient details with validation for first_name, last_name, email, and dob.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
ℹ️ This enum is non-exhaustive.
Available options:
testkit, walk_in_test, at_home_phlebotomy, on_site_collection Show child attributes
Show child attributes
Show child attributes
Show child attributes
Defines whether order is priority or not. For some labs, this refers to a STAT order.
ℹ️ This enum is non-exhaustive.
Available options:
client_bill, commercial_insurance, patient_bill_passthrough, patient_bill Show child attributes
Show child attributes
Schedule an Order to be processed in a future date.
Show child attributes
Show child attributes
Response
Successful Response
Show child attributes
Show child attributes
Example:
{ "activate_by": "2020-01-01", "created_at": "2020-01-01T00:00:00Z", "details": { "data": { "created_at": "2020-01-01T00:00:00Z", "id": "a655f0e4-6405-4a1d-80b7-66f06c2108a7", "shipment": { "created_at": "2020-01-01T00:00:00.000Z", "id": "d55210cc-3d9f-4115-8262-5013f700c7be", "inbound_courier": "usps", "inbound_tracking_number": "<inbound_tracking_number>", "inbound_tracking_url": "<inbound_tracking_url>", "notes": "<notes>", "outbound_courier": "usps", "outbound_tracking_number": "<outbound_tracking_number>", "outbound_tracking_url": "<outbound_tracking_url>", "updated_at": "2020-01-01T00:00:00.000Z" }, "updated_at": "2020-01-01T00:00:00Z" }, "type": "testkit" }, "events": [ { "created_at": "2022-01-01T00:00:00Z", "id": 1, "status": "received.testkit.ordered" }, { "created_at": "2022-01-02T00:00:00Z", "id": 2, "status": "received.testkit.requisition_created" }, { "created_at": "2022-01-03T00:00:00Z", "id": 3, "status": "collecting_sample.testkit.transit_customer" } ], "has_abn": false, "health_insurace_id": "806ad62a-efed-4640-b6f3-f457fe0ee26c", "id": "5107a460-6ed0-458f-9fc7-98e438732795", "lab_test": { "description": "Cholesterol test", "method": "testkit", "name": "Lipids Panel" }, "last_event": { "created_at": "2022-01-03T00:00:00Z", "id": 3, "status": "collecting_sample.testkit.transit_customer" }, "notes": "This is a note", "order_transaction": { "id": "a655f0e4-6405-4a1d-80b7-66f06c2108a7", "orders": [ { "created_at": "2020-01-01T00:00:00Z", "id": "d55210cc-3d9f-4115-8262-5013f700c7be", "low_level_status": "transit_customer", "low_level_status_created_at": "2020-01-05T00:00:00Z", "origin": "initial", "updated_at": "2020-01-05T00:00:00Z" }, { "created_at": "2020-01-05T01:00:00Z", "id": "e66321dd-4e0g-5226-9373-6124g811d8cf", "low_level_status": "requisition_created", "low_level_status_created_at": "2020-01-05T01:00:00Z", "origin": "redraw", "updated_at": "2020-01-05T01:00:00Z" } ], "status": "active" }, "origin": "initial", "patient_address": { "city": "San Francisco", "country": "United States", "first_line": "123 Main St.", "phone_number": "+11234567890", "receiver_name": "John Doe", "second_line": "Apt. 208", "state": "CA", "zip": "91189" }, "patient_details": { "dob": "2020-01-01", "gender": "male" }, "requisition_form_url": "https://www.example.com", "sample_id": "123456789", "status": "collecting_sample", "team_id": "379b4af0-a9cf-4b86-945a-f91cae1c3193", "updated_at": "2020-01-01T00:00:00Z", "user_id": "7b98a8d6-8c49-4049-936c-f65d140eb928" }
Was this page helpful?
⌘I