Welcome to Juniper Health's Order Fulfillment API! This quickstart guide will help you get started with Juniper's order fulfillment API, allowing you to make your first API call and begin exploring the possibilites of offloading your inventory and fulfillment workloads to Juniper.
- Email us at sales@juniperhealth.com to get in touch with our sales to discuss partnering with Juniper Health for your fulfillment needs.
- Recieve your OAuth credentials from the Juniper team.
Let's start by generating an access token with your client id and secret. Once we have an access token we can begin making calls to the API endpoints.
Use the following curl command to set a generate an access token:
curl -X POST auth.fulfillment.sandbox.juniperhealth.com
-H "Content-Type: application/x-www-form-urlencoded"
-d "grant_type=client_credentials"
-d "client_id=YOUR_CLIENT_ID"
-d "client_secret=YOUR_CLIENT_SECRET"
client_id: The client id provided to you by the Juniper engineering team.client_secret: The client secret provided to you by the Juniper engineering team.
{
"access_token":"eyJraWQiOiJ...LLGFVEnZ9PhJQ",
"expires_in":3600,
"token_type":"Bearer"
}This response confirms that the access token has been generated and provides an expires_in parameter to provide how long the token is good for before a new one needs to be generated.
Next, let's pull product information to see what products are available when creating an order
curl -X GET https://api.fulfillment.sandbox.juniperhealth.com/v1/product
-H "authorization: Bearer eyJraWQiOiJrVnRvNHBGQ...meCMjLLGFVEnZ9PhJQ"authorization: Bearer plus the access token we retrieved from step 1
{
"products": [
{
"id": 7184241754206,
"name": "SAMe",
"description": "SAM-E is a naturally occurring compound in the body that aids in neurotransmitter synthesis, energy production in the brain, cell membrane function, and cartilage metabolism.",
"recommendedUsage": {
"morning": 1,
"afternoon": 0,
"evening": 0,
"sleep": 0
},
"supplementFactsPanel": {
"servingSize": 1,
"otherIngredients": [
"Hypromellose (cellulose capsule)",
"Microcrystalline Cellulose",
"Magnesium Stearate (vegetable source)",
"Silicon Dioxide"
],
"ingredientInformation": [
{
"name": "SAMe (S-Adenosyl-L-Methionine)",
"value": "200",
"unit": "mg",
"dailyValue": null,
"children": null
},
{
"name": " (from S-Adenosyl-L-Methionine Disulfate Tosylate)",
"value": null,
"unit": null,
"dailyValue": null,
"children": null
}
],
"nutritionInformation": []
},
"originalPrice": "28.00",
"price": "27.00",
"status": "active",
"form": "Veg Capsule",
"image": "https://cdn.shopify.com/s/files/1/0570/9955/0814/files/SAMe200mg.png?v=1723484386",
"packDescription": "Nervous System Support ",
"allergens": [
"Gluten_Free"
],
"certifications": [
"vegan",
"kosher",
"halal",
"non_gmo"
],
"createdAt": "2025-04-02T13:24:40.388693Z",
"updatedAt": "2025-04-02T13:24:40.388699Z"
}
],
"cursor": "eyJwayI6ICJQUk9EVUNUIzcxODQyNDEzOTM3NTgiLCAic2siOiAiUFJPRFVDVCM3MTg0MjQxMzkzNzU4In0="
}This response confirms that you have successfully traveled to the specified time and location.
Returns eligble shipping methods and pricing based on our agreement with Juniper
Use the following curl command to retrieve shipping methods:
curl --location 'https://api.fulfillment.sandbox.juniperhealth.com/v1/shipping-methods' \
--header 'authorization: Bearer eyJraWQi...qUSw'{
"shippingMethods": [
{
"name": "EXPEDITED",
"description": "Standard shipping delivery 3-5 days",
"price": "20",
"createdAt": "2025-04-03T15:45:12.164032",
"updatedAt": "2025-04-03T15:45:12.164042"
},
{
"name": "STANDARD",
"description": "Standard shipping delivery 7-10 days",
"price": "0",
"createdAt": "2025-04-03T15:45:12.164060",
"updatedAt": "2025-04-03T15:45:12.164061"
}
]
}Now that we have our product and shipping data we can create an order for Juniper to fulfill
curl --location 'https://api.fulfillment.sandbox.juniperhealth.com/v1/orders' \
--header 'authorization: Bearer eyJraWQiOi...oFXfDUNQ' \
--header 'Content-Type: application/json' \
--data '{
"days_supply": 30,
"orderType": "subscription",
"shippingMethod": "STANDARD",
"customer": {
"sourceId": "src123",
"firstName": "John",
"lastName": "Doe",
"address": {
"line1": "123 Main St",
"line2": "Suite 200",
"city": "Anytown",
"state": "CA",
"zipCode": "12345"
}
},
"lineItems": [
{
"productId": "7294312317022",
"quantity": 1,
"administration": {
"morning": 1,
"afternoon": 0,
"evening": 1,
"sleep": 1
}
}
]
}'{
"id": "2vE9vnqodHisA0JJx1pvN2XqJJa",
"state": "ORDER_CREATED",
"originalSubTotalPrice": "16.00",
"subTotalPrice": "14.40",
"shippingPrice": "9.99",
"totalPrice": "24.39"
"customer": {
"firstName": "John",
"lastName": "Doe",
"sourceId": "src123",
"address": {
"line1": "123 Main St",
"line2": "Suite 200",
"city": "Anytown",
"state": "CA",
"zipCode": "12345"
},
"phone": null,
"email": null
},
"discount": "10%",
"daysSupply": 30,
"orderType": "subscription",
"lineItems": [
{
"administration": {
"afternoon": 0,
"evening": 1,
"morning": 1,
"sleep": 1
},
"productId": 7294312317022,
"packDescription": null,
"originalPrice": "16.00",
"price": "14.40",
"supplementFactsPanel": {
"serving_size": 1,
"other_ingredients": [
"Hypromellose (cellulose capsule)",
"Rice Flour"
],
"ingredient_information": [
{
"name": "5-HTP (5-hydroxytryptophan) (from Griffonia simplicifolia Extract) (Seed)",
"value": "100",
"unit": "mg",
"daily_value": null,
"children": null
}
],
"nutrition_information": []
},
"id": "2vE8C1kTAbF7dQ5ov03iIjmSthf"
}
],
"shippingMethod": "STANDARD",
"fulfillmentInfo": null,
"createdAt": "2025-04-03T16:45:41.435164Z",
"updatedAt": "2025-04-03T16:45:41.435304Z",
}This response confirms that you've successfully created an order!
Finally, lets cancel our order
Use the following curl command:
curl --location 'https://api.fulfillment.sandbox.juniperhealth.com/v1/orders/2vE9vnqodHisA0JJx1pvN2XqJJa/cancel' \
--header 'authorization: Bearer eyJraWQiOi...xoFXfDUNQ' \{
"order_id": "2vE9vnqodHisA0JJx1pvN2XqJJa",
"status": "CANCELLED"
}This response indicates that your order has been cancelled.
You’ve completed the quickstart guide! Explore more advanced features in our documentation.