> ## 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.

# Create a Test

> Create or submit lab tests via the Junction API. Requires authentication with your team API key.

<RequestExample>
  ```python Python 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="<name>",
      method=LabTestCollectionMethod.TESTKIT,
      description="<description>",
      provider_ids=["000110"],
  )
  ```

  ```typescript TypeScript theme={null}
  import { JunctionClient, JunctionEnvironment } from "@junction-api/sdk";

  const client = new JunctionClient({
      apiKey: "YOUR_API_KEY",
      environment: JunctionEnvironment.Sandbox,
  });

  const data = await client.labTests.create({
      name: "<name>",
      method: "testkit",
      description: "<description>",
      providerIds: ["000110"],
  });
  ```

  ```java Java theme={null}
  import com.junction.api.Junction;
  import com.junction.api.core.Environment;
  import com.junction.api.resources.labtests.requests.CreateLabTestRequest;
  import com.junction.api.types.LabTestCollectionMethod;
  import java.util.List;

  Junction client = Junction.builder()
      .apiKey("YOUR_API_KEY")
      .environment(Environment.SANDBOX)
      .build();

  var data = client.labTests().create(
      CreateLabTestRequest.builder()
          .name("<name>")
          .method(LabTestCollectionMethod.TESTKIT)
          .description("<description>")
          .providerIds(List.of("000110"))
          .build()
  );
  ```

  ```go Go theme={null}
  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.Create(context.TODO(), &junction.CreateLabTestRequest{
      Name:        "<name>",
      Method:      junction.LabTestCollectionMethodTestkit,
      Description: "<description>",
      ProviderIds: []string{"000110"},
  })
  if err != nil {
      return err
  }
  fmt.Printf("Received data %s\n", response)
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "2e82a1d4-e2e6-421c-9c54-2210d667ce48",
    "slug": "a94e3005-labcorp-panel",
    "name": "Labcorp panel",
    "sample_type": "serum",
    "method": "at_home_phlebotomy",
    "price": 0.0,
    "is_active": true,
    "status": "active",
    "fasting": false,
    "lab": {
      "id": 27,
      "slug": "labcorp",
      "name": "Labcorp",
      "first_line_address": "labcorp address",
      "city": "Lincolnshire",
      "zipcode": "60069",
      "collection_methods": ["at_home_phlebotomy", "walk_in_test"],
      "sample_types": ["serum", "saliva", "urine"]
    },
    "markers": [
      {
        "id": 195,
        "name": "Abnormal Bleeding Profile",
        "slug": "abnormal-bleeding-profile",
        "description": "Abnormal Bleeding Profile",
        "lab_id": 27,
        "provider_id": "116004",
        "type": "biomarker",
        "unit": null,
        "price": "N/A",
        "aoe": null,
        "a_la_carte_enabled": true
      }
    ],
    "is_delegated": false,
    "auto_generated": false
  }
  ```
</ResponseExample>


## OpenAPI

````yaml POST /v3/lab_tests
openapi: 3.1.0
info:
  title: Junction API
  description: https://docs.junction.com/
  version: 0.4.483
servers:
  - url: https://api.us.junction.com
    x-fern-server-name: Production
  - url: https://api.eu.junction.com
    x-fern-server-name: ProductionEU
  - url: https://api.sandbox.us.junction.com
    x-fern-server-name: Sandbox
  - url: https://api.sandbox.eu.junction.com
    x-fern-server-name: SandboxEU
security:
  - apiKeyAuth: []
paths:
  /v3/lab_tests:
    post:
      tags:
        - lab_tests
      summary: Create Lab Test For Team
      operationId: create_lab_test_for_team_v3_lab_tests_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLabTestRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientFacingLabTest'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateLabTestRequest:
      properties:
        marker_ids:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Marker Ids
        provider_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Provider Ids
        name:
          type: string
          title: Name
        method:
          $ref: '#/components/schemas/LabTestCollectionMethod'
          description: ℹ️ This enum is non-exhaustive.
        description:
          type: string
          title: Description
        fasting:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Fasting
          default: false
        lab_account_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Lab Account Id
        lab_slug:
          anyOf:
            - $ref: '#/components/schemas/Labs'
            - type: 'null'
          description: ℹ️ This enum is non-exhaustive.
      type: object
      required:
        - name
        - method
        - description
      title: CreateLabTestRequest
    ClientFacingLabTest:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: ''
        slug:
          type: string
          title: Slug
          description: ''
        name:
          type: string
          title: Name
          description: ''
        sample_type:
          $ref: '#/components/schemas/LabTestSampleType'
          description: ℹ️ This enum is non-exhaustive.
        method:
          $ref: '#/components/schemas/LabTestCollectionMethod'
          description: ℹ️ This enum is non-exhaustive.
        price:
          type: number
          title: Price
          description: ''
        is_active:
          type: boolean
          title: Is Active
          description: Deprecated. Use status instead.
        status:
          $ref: '#/components/schemas/LabTestStatus'
          description: ℹ️ This enum is non-exhaustive.
        fasting:
          type: boolean
          title: Fasting
          description: Defines whether a lab test requires fasting.
          default: false
        lab:
          anyOf:
            - $ref: '#/components/schemas/ClientFacingLab'
            - type: 'null'
          description: ''
        markers:
          anyOf:
            - items:
                $ref: '#/components/schemas/ClientFacingMarker'
              type: array
            - type: 'null'
          title: Markers
          description: ''
        is_delegated:
          type: boolean
          title: Is Delegated
          description: >-
            Deprecated and always false. Delegation is now at the lab account
            level. Used to denote whether a lab test requires using non-Vital
            physician networks.
          default: false
          deprecated: true
        auto_generated:
          type: boolean
          title: Auto Generated
          description: Whether the lab test was auto-generated by Vital
          default: false
        has_collection_instructions:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Has Collection Instructions
          description: Whether or not the lab test has collection instructions.
        common_tat_days:
          anyOf:
            - type: integer
            - type: 'null'
          title: Common Tat Days
          description: >-
            The common turnaround time in days for the lab test. This is the
            expected time for the lab to process the test and return results.
        worst_case_tat_days:
          anyOf:
            - type: integer
            - type: 'null'
          title: Worst Case Tat Days
          description: >-
            The worst-case turnaround time in days for the lab test. This is the
            maximum time the lab may take to process the test and return
            results.
      type: object
      required:
        - id
        - slug
        - name
        - sample_type
        - method
        - price
        - is_active
        - status
        - lab
        - markers
      title: ClientFacingLabTest
      example:
        lab_test:
          description: Cholesterol test
          fasting: false
          has_collection_instructions: false
          is_delegated: false
          lab:
            city: New York
            first_line_address: 123 Main St
            name: US Specialty Lab
            slug: USSL
            zipcode: '10001'
          markers:
            - description: >-
                Hemoglobin A1c is a form of hemoglobin that is measured identify
                your average blood sugar levels over the past 3 months.
              id: 1
              lab_id: 1
              name: Hemoglobin A1c
              price: '10.00'
              provider_id: '1234'
              slug: hemoglobin-a1c
              type: biomarker
              unit: '%'
          method: testkit
          name: Lipids Panel
          price: 10
          sample_type: dried blood spot
          status: active
    HTTPValidationError:
      properties:
        detail:
          title: Detail
      type: object
      title: HTTPValidationError
    LabTestCollectionMethod:
      type: string
      enum:
        - testkit
        - walk_in_test
        - at_home_phlebotomy
        - on_site_collection
      title: LabTestCollectionMethod
      description: The method used to perform a lab test. ℹ️ This enum is non-exhaustive.
    Labs:
      type: string
      enum:
        - ayumetrix
        - spiriplex
        - ussl
        - quest
        - sonora_quest
        - labcorp
        - bioreference
        - us_biotek
        - manual
        - sanocardio
        - ihd
        - nexus
        - my_uti
        - crl
      title: Labs
      description: ℹ️ This enum is non-exhaustive.
    LabTestSampleType:
      type: string
      enum:
        - dried_blood_spot
        - arm_collector
        - serum
        - saliva
        - urine
        - stool
      title: LabTestSampleType
      description: >-
        The type of sample used to perform a lab test. ℹ️ This enum is
        non-exhaustive.
    LabTestStatus:
      type: string
      enum:
        - active
        - pending_approval
        - inactive
      title: LabTestStatus
      description: ℹ️ This enum is non-exhaustive.
    ClientFacingLab:
      properties:
        id:
          type: integer
          title: Id
        slug:
          type: string
          title: Slug
        name:
          type: string
          title: Name
        first_line_address:
          type: string
          title: First Line Address
        city:
          type: string
          title: City
        zipcode:
          type: string
          title: Zipcode
        collection_methods:
          items:
            $ref: '#/components/schemas/LabTestCollectionMethod'
          type: array
          title: Collection Methods
        sample_types:
          items:
            $ref: '#/components/schemas/LabTestSampleType'
          type: array
          title: Sample Types
      type: object
      required:
        - id
        - slug
        - name
        - first_line_address
        - city
        - zipcode
        - collection_methods
        - sample_types
      title: ClientFacingLab
      example:
        city: San Francisco
        collection_methods:
          - testkit
        first_line_address: 123 Main St
        id: 1
        name: LabCorp
        sample_types:
          - saliva
        slug: labcorp
        zipcode: '91789'
    ClientFacingMarker:
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        slug:
          type: string
          title: Slug
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        lab_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Lab Id
        provider_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider Id
        type:
          anyOf:
            - $ref: '#/components/schemas/MarkerType'
            - type: 'null'
          description: ℹ️ This enum is non-exhaustive.
        unit:
          anyOf:
            - type: string
            - type: 'null'
          title: Unit
        price:
          anyOf:
            - type: string
            - type: 'null'
          title: Price
        aoe:
          anyOf:
            - $ref: '#/components/schemas/AoE'
            - type: 'null'
        a_la_carte_enabled:
          type: boolean
          title: A La Carte Enabled
          default: false
        common_tat_days:
          anyOf:
            - type: integer
            - type: 'null'
          title: Common Tat Days
        worst_case_tat_days:
          anyOf:
            - type: integer
            - type: 'null'
          title: Worst Case Tat Days
        is_orderable:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Orderable
          default: true
      type: object
      required:
        - id
        - name
        - slug
      title: ClientFacingMarker
      example:
        aoe:
          questions:
            - answers:
                - code: answer_code
                  id: 1
                  value: answer_value
              code: question_code
              id: 1
              value: question_value
        common_tat_days: 3
        description: >-
          Hemoglobin A1c is a form of hemoglobin that is measured identify your
          average blood sugar levels over the past 3 months.
        id: 1
        is_orderable: true
        lab_id: 1
        name: Hemoglobin A1c
        price: '10.00'
        provider_id: '1234'
        slug: hemoglobin-a1c
        type: biomarker
        unit: '%'
        worst_case_tat_days: 5
    MarkerType:
      type: string
      enum:
        - biomarker
        - panel
      title: MarkerType
      description: ℹ️ This enum is non-exhaustive.
    AoE:
      properties:
        questions:
          items:
            $ref: '#/components/schemas/Question'
          type: array
          title: Questions
      type: object
      required:
        - questions
      title: AoE
    Question:
      properties:
        id:
          type: integer
          format: int64
          title: Id
        required:
          type: boolean
          title: Required
        code:
          type: string
          title: Code
        value:
          type: string
          title: Value
        type:
          $ref: '#/components/schemas/QuestionType'
          description: ℹ️ This enum is non-exhaustive.
        sequence:
          type: integer
          title: Sequence
        answers:
          items:
            $ref: '#/components/schemas/Answer'
          type: array
          title: Answers
        constraint:
          anyOf:
            - type: string
            - type: 'null'
          title: Constraint
        default:
          anyOf:
            - type: string
            - type: 'null'
          title: Default
      type: object
      required:
        - id
        - required
        - code
        - value
        - type
        - sequence
        - answers
      title: Question
    QuestionType:
      type: string
      enum:
        - choice
        - text
        - numeric
        - multi_choice
      title: QuestionType
      description: ℹ️ This enum is non-exhaustive.
    Answer:
      properties:
        id:
          type: integer
          title: Id
        code:
          type: string
          title: Code
        value:
          type: string
          title: Value
      type: object
      required:
        - id
        - code
        - value
      title: Answer
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-vital-api-key
      description: Vital Team API Key

````