# Create a New Order

Submit a new customer order with product line items and shipping details

Endpoint: POST /orders
Version: 1.0.2
Security: oauth2ClientCredentials

## Request fields (application/json):

  - `customer` (object, required)
    Customer information for the order

  - `customer.sourceId` (string, required)
    Unique customer identifier in your system
    Example: "1234567890"

  - `customer.firstName` (string, required)
    Customer's first name
    Example: "John"

  - `customer.lastName` (string, required)
    Customer's last name
    Example: "Doe"

  - `customer.email` (string)
    Customer's email address
    Example: "john.doe@example.com"

  - `customer.phone` (string)
    Customer's phone number
    Example: "1234567890"

  - `customer.address` (object, required)
    Physical address information

  - `customer.address.line1` (string, required)
    Primary address line
    Example: "437 Lytton"

  - `customer.address.line2` (string,null)
    Secondary address line (optional)
    Example: "Suite 100"

  - `customer.address.city` (string, required)
    City name
    Example: "Palo Alto"

  - `customer.address.state` (string, required)
    State or province code
    Example: "CA"

  - `customer.address.zipCode` (string, required)
    Postal/ZIP code (5 digits)
    Example: "94301"

  - `daysSupply` (integer, required)
    Number of days the order is intended to supply
    Enum: 30, 60, 90

  - `lineItems` (array, required)
    Products included in the order

  - `lineItems.productId` (integer, required)
    Unique identifier of the product
    Example: 77123129891

  - `lineItems.quantity` (integer, required)
    Quantity of the product
    Example: 2

  - `lineItems.packDescription` (string)
    Description of the product packaging (required for pack items, optional for external items like powders)
    Example: "Whole Body Wellness"

  - `lineItems.administration` (object,null)
    Dosage schedule information specifying how many pills to take at each time of day.

Null for external products (powders, liquids, standalone items outside the pill pack). For pack products, the sum of morning + afternoon + evening + sleep must equal the line item quantity.

  - `lineItems.administration.morning` (integer, required)
    Morning dosage quantity
    Example: 1

  - `lineItems.administration.afternoon` (integer, required)
    Afternoon dosage quantity

  - `lineItems.administration.evening` (integer, required)
    Evening dosage quantity
    Example: 1

  - `lineItems.administration.sleep` (integer, required)
    Bedtime dosage quantity

  - `shippingMethod` (string, required)
    Shipping method for the order
    Enum: "STANDARD", "EXPRESS", "OVERNIGHT"

  - `orderType` (string, required)
    Type of order (this is currently only used for inventory forecasting by Juniper)
    Enum: "ONE_TIME", "SUBSCRIPTION"

## Response 201 fields (application/json):

  - `id` (string)
    Unique order identifier
    Example: "2vSGym0bH8qVEwCIGlyFoRgJq1A"

  - `discount` (string)
    Discount percentage applied to the order
    Example: "10%"

  - `daysSupply` (integer)
    Number of days the order is intended to supply
    Example: 30

  - `orderType` (string)
    Order type (one-time or subscription)
    Enum: "ONE_TIME", "SUBSCRIPTION"

  - `shippingMethod` (string)
    Selected shipping method
    Enum: "STANDARD", "EXPRESS", "OVERNIGHT"

  - `status` (string)
    Current status of the order
    Enum: "NEW", "PROCESSING", "DISPENSING", "FILLED", "FULFILLED", "AWAITING_SHIPMENT", "SHIPPED", "DELIVERED", "CANCELLED"

  - `fulfillmentInfo` (object,null)
    Details about the order fulfillment process. The object itself is null until the order has shipped, and individual fields are null until the carrier provides them.

  - `fulfillmentInfo.carrier` (string,null)
    Shipping carrier name
    Example: "UPS"

  - `fulfillmentInfo.trackingNumber` (string,null)
    Shipping carrier tracking number
    Example: "1Z9999999999999999"

  - `fulfillmentInfo.trackingStatus` (string,null)
    Current tracking status from carrier (e.g., InTransit, Delivered)
    Example: "InTransit"

  - `fulfillmentInfo.trackingUrl` (string,null)
    URL to track the shipment
    Example: "https://www.ups.com/track?tracknum=1Z9999999999999999"

  - `fulfillmentInfo.checkpoints` (array,null)
    Tracking checkpoint history from carrier

  - `fulfillmentInfo.checkpoints.checkpointTime` (string,null)
    Timestamp of the checkpoint event
    Example: "2023-10-03T09:15:00Z"

  - `fulfillmentInfo.checkpoints.location` (string,null)
    Location of the shipment at this checkpoint
    Example: "Chicago, IL, USA"

  - `fulfillmentInfo.checkpoints.message` (string,null)
    Status message from the carrier
    Example: "Package arrived at facility"

  - `fulfillmentInfo.checkpoints.tag` (string,null)
    Status tag (e.g., InTransit, OutForDelivery, Delivered)
    Example: "InTransit"

  - `lineItems` (array)
    Products included in the order

  - `lineItems.productId` (integer, required)
    Unique identifier of the product
    Example: 77123129891

  - `lineItems.name` (string)
    Product name
    Example: "Elite EPA"

  - `lineItems.quantity` (integer, required)
    Quantity of the product
    Example: 2

  - `lineItems.packDescription` (string)
    Description of the product packaging (present for pack items, not for external items)
    Example: "Whole Body Wellness"

  - `lineItems.price` (string)
    Per pill price of product
    Example: "0.37"

  - `lineItems.discountedPrice` (string)
    Per pill price of product with partner discount applied
    Example: "0.33"

  - `lineItems.totalPrice` (string)
    Total price for this line item (discountedPrice  quantity  daysSupply)
    Example: "29.70"

  - `lineItems.external` (boolean)
    Whether this is an external product (powder, liquid) outside the pill pack

  - `lineItems.imageUrl` (string,null)
    URL to the product image
    Example: "https://example.com/images/elite-epa.jpg"

  - `lineItems.administration` (object,null)
    Dosage schedule information specifying how many pills to take at each time of day.

Null for external products (powders, liquids, standalone items outside the pill pack). For pack products, the sum of morning + afternoon + evening + sleep must equal the line item quantity.

  - `lineItems.administration.morning` (integer, required)
    Morning dosage quantity
    Example: 1

  - `lineItems.administration.afternoon` (integer, required)
    Afternoon dosage quantity

  - `lineItems.administration.evening` (integer, required)
    Evening dosage quantity
    Example: 1

  - `lineItems.administration.sleep` (integer, required)
    Bedtime dosage quantity

  - `customer` (object)
    Customer information

  - `customer.sourceId` (string, required)
    Unique customer identifier in the partner system
    Example: "1234567890"

  - `customer.firstName` (string, required)
    Customer's first name
    Example: "John"

  - `customer.lastName` (string, required)
    Customer's last name
    Example: "Doe"

  - `customer.email` (string,null)
    Customer's email address
    Example: "john.doe@example.com"

  - `customer.phone` (string,null)
    Customer's phone number
    Example: "1234567890"

  - `customer.address` (object, required)
    Physical address information

  - `customer.address.line1` (string, required)
    Primary address line
    Example: "437 Lytton"

  - `customer.address.line2` (string,null)
    Secondary address line (optional)
    Example: "Suite 100"

  - `customer.address.city` (string, required)
    City name
    Example: "Palo Alto"

  - `customer.address.state` (string, required)
    State or province code
    Example: "CA"

  - `customer.address.zipCode` (string, required)
    Postal/ZIP code (5 digits)
    Example: "94301"

  - `subtotalPrice` (string)
    Order subtotal amount
    Example: "30.00"

  - `totalDiscount` (string)
    Total discount amount applied to the order
    Example: "27.00"

  - `totalFees` (string)
    Total for handling fees on external products. Each external item has a $5 handling fee.
    Example: "5.00"

  - `totalShipping` (string)
    Shipping cost
    Example: "9.99"

  - `totalVolumeDiscount` (string)
    Additional discount as for purchasing a days supply over the specified volume discount limits.
    Example: "12.10"

  - `totalPrice` (string)
    Total order amount (subtotal + shipping)
    Example: "36.99"

  - `createdAt` (string)
    Order creation timestamp
    Example: "2023-10-01T12:00:00Z"

  - `updatedAt` (string)
    Order last update timestamp
    Example: "2023-10-01T12:00:00Z"

## Response 400 fields (application/json):

  - `detail` (string, required)
    Detailed error message explaining the bad request
    Example: "Invalid request parameters"

## Response 422 fields (application/json):

  - `detail` (array)
    List of specific validation errors

  - `detail.loc` (array, required)
    Location of the error in the request body

  - `detail.type` (string, required)
    Type of validation error
    Enum: "missing", "invalid", "type_error"


