> ## 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 appointment availability

> Create or submit order phlebotomy appointment availability via the Junction API. Requires authentication with your team API key.

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
       --url '{{BASE_URL}}/v3/order/phlebotomy/appointment/availability' \
       --header 'accept: application/json' \
       --header 'x-vital-api-key: YOUR_API_KEY' \
       --data '
  {
      "first_line": "256 West Lincoln Street",
      "second_line": "14",
      "city": "Phoenix",
      "state": "AZ",
      "zip_code": "85004"
  }
  '
  ```

  ```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.get_phlebotomy_appointment_availability(
      first_line="123 Main St",
      city="San Francisco",
      state="CA",
      zip_code="94105",
  )
  ```

  ```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.getPhlebotomyAppointmentAvailability({
      body: {
          firstLine: "123 Main St",
          city: "San Francisco",
          state: "CA",
          zipCode: "94105",
      },
  });
  ```

  ```java Java theme={null}
  import com.junction.api.Junction;
  import com.junction.api.core.Environment;
  import com.junction.api.types.UsAddress;

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

  var data = client.labTests().getPhlebotomyAppointmentAvailability(
      UsAddress.builder()
          .firstLine("123 Main St")
          .city("San Francisco")
          .state("CA")
          .zipCode("94105")
          .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.GetPhlebotomyAppointmentAvailability(context.TODO(), &junction.GetPhlebotomyAppointmentAvailabilityLabTestsRequest{
      Body: &junction.UsAddress{
          FirstLine: "123 Main St",
          City:      "San Francisco",
          State:     "CA",
          ZipCode:   "94105",
      },
  })
  if err != nil {
      return err
  }
  fmt.Printf("Received data %s\n", response)
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
      "timezone":"America/Phoenix",
      "slots": [
          {
              "date":"2023-05-09",
              "slots": [
                  {
                      "booking_key": "foo123",
                      "start": "2023-05-09T17:00:00+00:00",
                      "end": "2023-05-09T19:00:00+00:00",
                      "expires_at": "2023-05-09T12:39:57.827000+00:00",
                      "price": 3500,
                      "is_priority": true,
                      "num_appointments_available": 5
                  },
                  ...
              ],
          },
          {
              "date":"2023-05-10",
              "slots": [
                  {
                      "booking_key": "bar456",
                      "start": "2023-05-10T12:00:00+00:00",
                      "end": "2023-05-10T14:00:00+00:00",
                      "expires_at": "2023-05-09T12:39:57.852000+00:00",
                      "price": 7900,
                      "is_priority": true,
                      "num_appointments_available": 5
                  },
                  ...
              ],
          },
      ]
  }
  ```
</ResponseExample>


## OpenAPI

````yaml POST /v3/order/phlebotomy/appointment/availability
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/order/phlebotomy/appointment/availability:
    post:
      tags:
        - order
      summary: Get Order Appointment Availability
      description: >-
        Return the available time slots to book an appointment with a
        phlebotomist

        for the given address and order.
      operationId: >-
        get_order_appointment_availability_v3_order_phlebotomy_appointment_availability_post
      parameters:
        - name: start_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            description: Start date for appointment availability
            title: Start Date
          description: Start date for appointment availability
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/USAddress'
              description: At-home phlebotomy appointment address.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppointmentAvailabilitySlots'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    USAddress:
      properties:
        first_line:
          type: string
          title: First Line
        second_line:
          anyOf:
            - type: string
            - type: 'null'
          title: Second Line
        city:
          type: string
          title: City
        state:
          type: string
          title: State
        zip_code:
          type: string
          pattern: ^\d{5}(-\d{4})?$
          title: Zip Code
        unit:
          anyOf:
            - type: string
            - type: 'null'
          title: Unit
          description: >-
            Deprecated. Use `second_line` instead to provide the unit number.
            Subject to removal after 20 Nov 2023.
          deprecated: true
        access_notes:
          anyOf:
            - type: string
              maxLength: 1000
            - type: 'null'
          title: Access Notes
      type: object
      required:
        - first_line
        - city
        - state
        - zip_code
      title: USAddress
    AppointmentAvailabilitySlots:
      properties:
        slots:
          items:
            $ref: '#/components/schemas/DaySlots'
          type: array
          title: Slots
        timezone:
          anyOf:
            - type: string
              pattern: >-
                ^(?:(?:[A-Za-z_\-]+\/[A-Za-z_\-]+(?:\/[A-Za-z_\-]+)?)|(?:Etc\/[A-Za-z0-9+\-]+(?:\/[A-Za-z0-9]+)?|(?:CET|CST6CDT|EET|EST|EST5EDT|MET|MST|MST7MDT|PST8PDT|HST)))$
            - type: 'null'
          title: Timezone
      type: object
      required:
        - slots
      title: AppointmentAvailabilitySlots
    HTTPValidationError:
      properties:
        detail:
          title: Detail
      type: object
      title: HTTPValidationError
    DaySlots:
      properties:
        location:
          anyOf:
            - $ref: '#/components/schemas/AppointmentLocation'
            - type: 'null'
        date:
          type: string
          format: date
          title: Date
        slots:
          items:
            $ref: '#/components/schemas/TimeSlot'
          type: array
          title: Slots
      type: object
      required:
        - date
        - slots
      title: DaySlots
    AppointmentLocation:
      properties:
        location:
          $ref: '#/components/schemas/LngLat'
        distance:
          anyOf:
            - type: integer
            - type: 'null'
          title: Distance
        address:
          $ref: '#/components/schemas/USAddress'
        code:
          type: string
          title: Code
        name:
          type: string
          title: Name
        iana_timezone:
          anyOf:
            - type: string
              pattern: >-
                ^(?:(?:[A-Za-z_\-]+\/[A-Za-z_\-]+(?:\/[A-Za-z_\-]+)?)|(?:Etc\/[A-Za-z0-9+\-]+(?:\/[A-Za-z0-9]+)?|(?:CET|CST6CDT|EET|EST|EST5EDT|MET|MST|MST7MDT|PST8PDT|HST)))$
            - type: 'null'
          title: Iana Timezone
      type: object
      required:
        - location
        - address
        - code
        - name
      title: AppointmentLocation
    TimeSlot:
      properties:
        booking_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Booking Key
        start:
          type: string
          format: date-time
          title: Start
          description: Time is in UTC
        end:
          type: string
          format: date-time
          title: End
          description: Time is in UTC
        expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expires At
        price:
          type: number
          title: Price
        is_priority:
          type: boolean
          title: Is Priority
        num_appointments_available:
          type: integer
          title: Num Appointments Available
      type: object
      required:
        - start
        - end
        - price
        - is_priority
        - num_appointments_available
      title: TimeSlot
    LngLat:
      properties:
        lng:
          type: number
          maximum: 180
          minimum: -180
          title: Lng
        lat:
          type: number
          maximum: 90
          minimum: -90
          title: Lat
      type: object
      required:
        - lng
        - lat
      title: LngLat
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-vital-api-key
      description: Vital Team API Key

````