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

# Update a Test

> Partially update lab tests via the Junction API. Requires authentication with your team API key.

<RequestExample>
  ```python Python theme={null}
  from junction import Junction
  from junction.environment import JunctionEnvironment

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

  data = client.lab_tests.update_lab_test(
      "<lab_test_id>",
      name="<name>",
      active=True,
  )
  ```

  ```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.updateLabTest({
      labTestId: "<lab_test_id>",
      name: "<name>",
      active: true,
  });
  ```

  ```java Java theme={null}
  import com.junction.api.Junction;
  import com.junction.api.core.Environment;
  import com.junction.api.resources.labtests.requests.UpdateLabTestRequest;

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

  var data = client.labTests().updateLabTest(
      "<lab_test_id>",
      UpdateLabTestRequest.builder()
          .name("<name>")
          .active(true)
          .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.UpdateLabTest(context.TODO(), &junction.UpdateLabTestRequest{
      LabTestId: "<lab_test_id>",
      Name:      junction.String("<name>"),
      Active:    junction.Bool(true),
  })
  if err != nil {
      return err
  }
  fmt.Printf("Received data %s\n", response)
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "5af405fc-fafb-49e8-b0bf-fe9d91df6a7d",
    "slug": "a94e3005-new-test",
    "name": "New test",
    "sample_type": "serum",
    "method": "at_home_phlebotomy",
    "price": 0.0,
    "is_active": true,
    "status": "active",
    "fasting": false,
    "lab": {
      "id": 26,
      "slug": "quest",
      "name": "Quest",
      "first_line_address": "100 Tri State International #100",
      "city": "Lincolnshire",
      "zipcode": "60069",
      "collection_methods": ["at_home_phlebotomy", "walk_in_test"],
      "sample_types": ["serum", "saliva", "urine"]
    },
    "markers": [
      {
        "id": 6859,
        "name": "17-Hydroxyprogesterone",
        "slug": "17-hydroxyprogesterone",
        "description": "17-Hydroxyprogesterone",
        "lab_id": 26,
        "provider_id": "17180",
        "type": "biomarker",
        "unit": null,
        "price": "N/A",
        "aoe": null,
        "a_la_carte_enabled": true
      },
      {
        "id": 8213,
        "name": "17-Hydroxypregnenolone",
        "slug": "17-hydroxypregnenolone",
        "description": "17-Hydroxypregnenolone",
        "lab_id": 26,
        "provider_id": "8352",
        "type": "biomarker",
        "unit": null,
        "price": "N/A",
        "aoe": null,
        "a_la_carte_enabled": true
      }
    ],
    "is_delegated": false,
    "auto_generated": false
  }
  ```
</ResponseExample>


## OpenAPI

````yaml PATCH /v3/lab_tests/{lab_test_id}
openapi: 3.1.0
info:
  title: Junction API
  description: https://docs.junction.com/
  version: 0.4.495
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/{lab_test_id}:
    patch:
      tags:
        - lab_tests
      summary: Update Lab Test For Team
      operationId: update_lab_test_for_team_v3_lab_tests__lab_test_id__patch
      parameters:
        - name: lab_test_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Lab Test Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateLabTestRequest'
      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:
    UpdateLabTestRequest:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        active:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Active
      type: object
      title: UpdateLabTestRequest
    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
    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.
    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.
    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

````