> ## Documentation Index
> Fetch the complete documentation index at: https://docs.junction.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating a Lab Test

> Create custom lab tests by selecting biomarker IDs and collection methods, then submit them for Junction approval before ordering.

Junction provides a way to create your own lab tests. A lab test is a collection or pre-set of orderable markers. These are made up of:

1. One or more marker IDs or Provider IDs.
2. The collection method: `testkit`, `walk_in_test`, `at_home_phlebotomy`, or `on_site_collection`.

Once a Lab Test is created and approved, you can use it when making an order.

<Warning>
  When you create a Lab Test, it is not immediately available. We need to
  validate and approve it on our side, before you can use it when making orders.
</Warning>

### Example

To begin, make a request to our [`GET /v3/lab_tests/markers`](/api-reference/lab-testing/biomarkers) endpoint, in order to choose the markers you want to test for.

```json Get all markers theme={null}
{
  "markers": [
    {
      "id": 1,
      "name": "17-OH Progesterone LCMS",
      "slug": "17-oh-progesterone-lcms",
      "description": "17-OH Progesterone LCMS",
      "lab_id": 1,
      "provider_id": "070085",
      "type": null,
      "unit": null,
      "price": "N/A"
    },
    {
      "id": 2,
      "name": "ABO Grouping",
      "slug": "abo-grouping",
      "description": "ABO Grouping",
      "lab_id": 1,
      "provider_id": "006056",
      "type": null,
      "unit": null,
      "price": "N/A"
    }
  ],
  "total": 2,
  "page": 1,
  "size": 2
}
```

With this information, you can create a lab test using [`POST /v3/lab_tests`](/api-reference/lab-testing/post-test).

As an example, let's say you wanted a test from `Labcorp`, with markers with provider IDs `006056` and `070085`:

```python Create a new test theme={null}
from junction import Junction, LabTestCollectionMethod
from junction.environment import JunctionEnvironment

client = Junction(
    api_key="YOUR_API_KEY",
    environment=JunctionEnvironment.SANDBOX,
)

data = client.lab_tests.create(
    name="Example test",
    description="Example test",
    method=LabTestCollectionMethod.AT_HOME_PHLEBOTOMY,
    provider_ids=["006056", "070085"],  # or use the marker ids e.g marker_ids=[1, 2]
)
```

<Note>
  It is possible to create a test with either the marker id or provider id. Provider ids are the recommended way, since these are shared across environments. Not all labs provide these, so in their absence, use the marker id.
</Note>

Once your lab test creation is successful you will receive the following response:

```json theme={null}
{
  "lab_test": {
    "name": "Example test",
    "description": "Example test",
    "sample_type": "serum",
    "method": "at_home_phlebotomy",
    "price": 10,
    "is_active": false,
    "lab": {
      "slug": "labcorp",
      "name": "LabCorp",
      "first_line_address": "123 Main St",
      "city": "San Francisco",
      "zipcode": "91789"
    },
    "markers": [
      {
        "name": "17-OH Progesterone LCMS",
        "slug": "17-oh-progesterone-lcms",
        "description": "17-OH Progesterone LCMS"
      },
      {
        "name": "ABO Grouping",
        "slug": "abo-grouping",
        "description": "ABO Grouping"
      }
    ]
  }
}
```

Note that `is_active` is set to `false`. You can verify its status by calling the [lab tests endpoint](/api-reference/lab-testing/tests).
