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

# Create order

> Create an order for delivering kits to a client, which will be created with a status of 'pending'.The order will be created with the user making the request as the 'placed_by' user.

<ResponseExample>
  ```json Response theme={null}
  {
    "order_id": "O1234567",
    "status": "pending",
    "recipient": {
      "first_name": "Alice",
      "last_name": "Smith",
      "email": "alice123@gmail.com",
      "phone": "1234567890",
      "address": {
        "street1": "123 Main St",
        "street2": "Apt 1",
        "city": "San Francisco",
        "state": "CA",
        "country": "US",
        "zip": "94105"
      }
    },
    "kit_types": ["health_kit_1"],
    "kits": [],
    "created": "2023-01-01T04:30:11.222Z",
    "updated": "2023-01-01T04:30:11.222Z",
    "metadata": {
      "some_key": "some_value"
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml POST /api/v2/orders/
openapi: 3.0.3
info:
  title: Spot API v2
  version: 2.0.0
  description: API Docs for Spot API
servers:
  - url: https://app.spotdx.com
    description: Production
security: []
paths:
  /api/v2/orders/:
    post:
      description: >-
        Create an order for delivering kits to a client, which will be created
        with a status of 'pending'.The order will be created with the user
        making the request as the 'placed_by' user.
      operationId: api_v2_create_order
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrder'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CreateOrder'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreateOrder'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderEmpty'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequest'
          description: ''
      security:
        - tokenAuth: []
components:
  schemas:
    CreateOrder:
      type: object
      properties:
        kit_types:
          type: array
          items:
            type: string
          description: A list of all the kit types to place in the order.
          example:
            - health_kit_1
        recipient:
          $ref: '#/components/schemas/Recipient'
        metadata:
          type: object
          nullable: true
          description: An optional dictionary of key-value pairs stored with the order.
          example:
            some_key: some_value
      required:
        - kit_types
        - recipient
    OrderEmpty:
      type: object
      properties:
        order_id:
          type: string
          description: The unique identifier of the order.
          example: O1234567
        created:
          type: string
          format: date-time
          example: '2023-01-01T04:30:11.222Z'
        status:
          $ref: '#/components/schemas/OrderStatus'
        recipient:
          $ref: '#/components/schemas/Recipient'
        kit_types:
          type: array
          items:
            type: string
          description: A list of the kit types that are included in this order.
          example:
            - health_kit_1
        kits:
          type: array
          items:
            $ref: '#/components/schemas/Kit'
          example: []
        metadata:
          type: object
          nullable: true
          description: An optional dictionary of key-value pairs stored with the order.
          example:
            some_key: some_value
    BadRequest:
      type: object
      properties:
        error:
          type: object
          properties:
            status:
              type: number
              example: 400
              enum:
                - 400
                - 401
                - 403
                - 404
                - 500
            type:
              type: string
              example: bad_request
              enum:
                - bad_request
                - not_found
                - unauthorized
                - forbidden
                - rate_limit_exceeded
                - internal_server_error
            detail:
              type: string
              example: The first_name field is required
      required:
        - error
    Recipient:
      type: object
      properties:
        first_name:
          type: string
          description: Recipient's first name.
          example: Alice
        last_name:
          type: string
          description: Recipient's last name.
          example: Smith
        email:
          type: string
          description: Recipient's email.
          example: alice123@gmail.com
        phone:
          type: string
          description: Recipient's phone number, as a string.
          example: '1234567890'
        address:
          $ref: '#/components/schemas/Address'
      required:
        - address
        - email
        - first_name
        - last_name
        - phone
    OrderStatus:
      type: string
      enum:
        - pending
        - in_progress
        - completed
        - canceled
    Kit:
      type: object
      properties:
        kit_id:
          type: string
          description: The unique identifier of the kit.
          example: SPOT123456
        type:
          type: string
          description: The kit's type
          example: health_kit_1
        status:
          $ref: '#/components/schemas/KitStatus'
        events:
          type: array
          items:
            $ref: '#/components/schemas/KitEvent'
          description: A list of all the events that have occurred for this kit.
          example:
            - status: preparing
              created: '2023-01-01T04:30:11.222Z'
            - status: in_transit
              created: '2023-01-05T04:30:11.222Z'
            - status: delivered
              created: '2023-01-06T04:30:11.222Z'
            - status: registered
              created: '2023-01-07T04:30:11.222Z'
        shipment_to_customer:
          $ref: '#/components/schemas/Shipment'
        registered_to:
          type: object
          properties:
            patient_id:
              type: string
              format: uuid
              example: 7563e8e2-7fbd-480c-9b8b-2070eda884bf
            first_name:
              type: string
              example: Alice
            last_name:
              type: string
              example: Smith
            date_of_birth:
              type: string
              format: date
              example: '1990-01-01'
            sex:
              type: string
              enum:
                - M
                - F
              example: F
            email:
              type: string
              example: alice123@gmail.com
            phone:
              type: string
              example: '1234567890'
        sample:
          type: object
          properties:
            sample_id:
              type: string
              example: SPOT654321
            status:
              $ref: '#/components/schemas/SampleStatus'
            events:
              type: array
              items:
                $ref: '#/components/schemas/SampleEvent'
              example:
                - status: awaiting_collection
                  created: '2023-01-01T04:30:11.222Z'
                - status: in_transit
                  created: '2023-01-10T04:30:11.222Z'
                - status: delivered
                  created: '2023-01-11T04:30:11.222Z'
                - status: received
                  created: '2023-01-12T04:30:11.222Z'
                - status: resulted
                  created: '2023-01-13T04:30:11.222Z'
            type:
              type: string
              enum:
                - adx100
                - adx100_2
                - adx100_4
                - whatman903_10
                - dry_transport_swab
                - hemaspot_hf
                - saliva_3
              example: adx100
            shipments:
              type: array
              items:
                $ref: '#/components/schemas/Shipment'
            panels:
              type: array
              description: >-
                The panel codes of the test being performed on the sample. We'll
                create these with you during onboarding.
              example:
                - PANEL-123
              items:
                type: string
            reports:
              type: array
              items:
                $ref: '#/components/schemas/Report'
    Address:
      type: object
      properties:
        street1:
          type: string
          description: Recipient's address.
          example: 123 Main St
        street2:
          description: Second line of recipient's address.
          type: string
          nullable: true
          example: Apt 1
        city:
          type: string
          description: Recipient's city of residence.
          example: San Francisco
        state:
          type: string
          description: Recipient's state of residence.
          example: CA
        country:
          type: string
          description: Recipient's country of residence.
          enum:
            - US
            - CA
          example: US
        zip:
          type: string
          description: Recipient's zip code.
          example: '94105'
      required:
        - street1
        - city
        - state
        - country
        - zip
    KitStatus:
      type: string
      description: The new status of the kit.
      enum:
        - preparing
        - in_transit
        - delivered
        - delivery_exception
        - registered
        - canceled
      example: preparing
    KitEvent:
      type: object
      properties:
        status:
          $ref: '#/components/schemas/KitStatus'
        created:
          type: string
          format: date-time
          description: The date and time the event occurred.
          example: '2023-01-01T04:30:11.222Z'
    Shipment:
      type: object
      properties:
        tracking_number:
          type: string
          nullable: true
          example: '9400123456789999876500'
        carrier:
          type: string
          enum:
            - fedex
            - ups
            - usps
          example: usps
          nullable: true
        created:
          type: string
          format: date-time
          example: '2023-01-01T04:30:11.222Z'
    SampleStatus:
      type: string
      description: The new status of the sample.
      enum:
        - awaiting_collection
        - collection_exception
        - delivery_exception
        - delivered
        - in_transit
        - received
        - resulted
        - partially_resulted
        - extra_quality_checks
        - canceled
    SampleEvent:
      type: object
      properties:
        status:
          $ref: '#/components/schemas/SampleStatus'
        created:
          type: string
          format: date-time
          example: '2023-01-01T04:30:11.222Z'
    Report:
      nullable: true
      type: object
      properties:
        report_id:
          type: string
        results:
          description: ''
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/ResultQuantity'
              - $ref: '#/components/schemas/ResultReactivity'
              - $ref: '#/components/schemas/ResultGenotype'
          example:
            - result_type: quantity
              name: HDL Cholesterol
              time_collected: '2023-01-14T04:30:11.222Z'
              result: 123
              unit_of_measure: mg/dL
              range_minimum: 20
              range_maximum: 200
              comments: null
            - result_type: quantity
              name: Vitamin B12
              time_collected: '2023-01-14T04:30:11.222Z'
              result: <10
              unit_of_measure: pg/mL
              range_minimum: 20
              range_maximum: 200
              comments: null
            - result_type: reactivity
              name: Chlamydia
              time_collected: '2023-01-14T04:30:11.222Z'
              result: negative
              unit_of_measure: null
              range_minimum: null
              range_maximum: null
              comments: null
            - result_type: genotype
              name: rs1234567
              time_collected: '2023-01-14T04:30:11.222Z'
              result: TT
              unit_of_measure: null
              range_minimum: null
              range_maximum: null
              comments: null
        pdf:
          type: string
          format: url
          description: A URL to the PDF report.
          example: >-
            https://app.spotkits.com/results/f0e5a607-5b52-4d7c-a3f2-c40772d41482.pdf
          nullable: true
        txt:
          type: string
          format: url
          description: A URL to the TXT report.
          example: >-
            https://app.spotkits.com/results/f0e5a607-5b52-4d7c-a3f2-c40772d41482.txt
          nullable: true
        date_collected:
          type: string
          format: date-time
        date_received:
          type: string
          format: date-time
        date_resulted:
          type: string
          format: date-time
        is_amendment:
          type: boolean
          description: Whether this report is an amendment to a previous report.
          example: false
    ResultQuantity:
      type: object
      properties:
        result_type:
          type: string
          enum:
            - quantity
        name:
          type: string
          description: The biomarker that was analyzed.
        time_collected:
          type: string
          format: date-time
        result:
          description: ''
          oneOf:
            - type: string
            - type: number
        unit_of_measure:
          type: string
          nullable: true
        range_minimum:
          type: string
          minimum: 0
        range_maximum:
          type: number
          minimum: 0
        comments:
          type: string
          nullable: true
    ResultReactivity:
      type: object
      properties:
        result_type:
          type: string
          enum:
            - reactivity
        name:
          type: string
          description: The biomarker that was analyzed.
        time_collected:
          type: string
          format: date-time
        result:
          description: ''
          type: string
          enum:
            - positive
            - negative
        unit_of_measure:
          type: string
          nullable: true
        range_minimum:
          type: number
          nullable: true
        range_maximum:
          type: number
          nullable: true
        comments:
          type: string
          nullable: true
    ResultGenotype:
      type: object
      properties:
        result_type:
          type: string
          enum:
            - genotype
        name:
          type: string
          description: The biomarker that was analyzed.
        time_collected:
          type: string
          format: date-time
        result:
          description: ''
          type: string
          enum:
            - TT
            - GG
            - CG
            - AG
            - CT
            - CC
            - AA
            - AT
            - AC
            - TA
            - TG
            - TC
            - GA
            - GT
            - GC
            - CA
        unit_of_measure:
          type: string
          nullable: true
        range_minimum:
          type: number
          nullable: true
        range_maximum:
          type: number
          nullable: true
        comments:
          type: string
          nullable: true
  securitySchemes:
    tokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Token-based authentication with required prefix "Token"

````