---
title: Create Patient Recommendation
slug: create-patient-recommendation
icon: {"faIcon":"fa-solid fa-code"}
createdAt: 2022-12-20T17:02:10.000Z
---

There are two ways to create a recommendation. The parameters for the JSON object are entirely optional. You can pass an array of item objects to add items right upon creation to reduce the amount of api calls required to create a complete recommendation.

The only requirement is a path variable `:patient_id`, so it is necessary to create the patient prior to creating a recommendation if the patient does not yet exist.&#x20;

:::hint{type="warning"}
**Deprecation Notice**


The `:patient_id` is identical to the Magento `customer_id` and applications may create customers using the core Magento API calls.&#x20;
:::

When creating comprehensive recommendations, each item passed in the items array require at minimum a `sku` and `qty` attribute. The rest of the attributes are optional. See the **Recommendation Item Object** documention for details.

## Return

This call returns the entire recommendation object.

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/V1/dispensary/patient/:patient_id/recommendation",
  "name": "API",
  "method": "POST",
  "request": {
    "pathParameters": [
      {
        "kind": "required",
        "name": "patient_id",
        "type": "Integer",
        "children": [],
        "description": "The patient id for which to create this recommendation"
      }
    ],
    "queryParameters": [],
    "headerParameters": [
      {
        "kind": "required",
        "name": "Authorization",
        "type": "string",
        "children": [],
        "description": "The Access Token"
      }
    ],
    "bodyDataParameters": [
      {
        "kind": "optional",
        "name": "recommendation",
        "type": "Object",
        "children": [
          {
            "kind": "optional",
            "name": "notify_email",
            "type": "Boolean",
            "description": "Whether to notify the patient via their email address. Default: 1"
          },
          {
            "kind": "optional",
            "name": "notify_sms",
            "type": "Boolean",
            "description": "Wether to notify the patient via SMS text message. Default: 0"
          },
          {
            "kind": "optional",
            "name": "note",
            "type": "string",
            "description": "A note for this recommendation"
          },
          {
            "kind": "optional",
            "name": "items array[]",
            "type": "Object",
            "children": [
              {
                "kind": "required",
                "name": "sku",
                "type": "string",
                "description": "The item's sku"
              },
              {
                "kind": "required",
                "name": "qty",
                "type": "Integer",
                "description": "The item's quantity"
              },
              {
                "kind": "optional",
                "name": "fulfillment_type",
                "type": "string",
                "description": "LC for in practice fulfillment\n1L for first time in practice fulfillment on subscriptions"
              },
              {
                "kind": "optional",
                "name": "note",
                "type": "string",
                "description": "Item specific note, usually dosing instructions."
              },
              {
                "kind": "optional",
                "name": "autoship_interval",
                "type": "string",
                "description": "For subscription recommendations. See The Recommendation Item Object spec for details."
              },
              {
                "kind": "optional",
                "name": "doctor_id",
                "type": "Integer",
                "description": "To associate this item with a specific doctor. See the Doctor Object spec for details."
              },
              {
                "kind": "optional",
                "name": "location_id",
                "type": "Integer",
                "description": "To associate this item with a specific doctor. See the Location Object spec for details."
              }
            ],
            "description": "Optional array of items"
          }
        ],
        "description": "ID of the cake to get"
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "sT7x5eCla7VJy6tWNaRmD",
        "code": "{\n    \"recommendation_id\": \"6e6e08cf-e2a0-4e0e-9359-e2e42896b56e\",\n    \"note\": \"Overall recommendation notes\",\n    \"status\": \"pending\",\n    \"patient\": {\n        \"patient_id\": 71,\n        \"firstname\": \"Juergen\",\n        \"lastname\": \"Schreck\",\n        \"email\": \"juergen+uat@gethealthy.store\"\n    },\n    \"practice_id\": 1,\n    \"notify_email\": 1,\n    \"notify_sms\": 0,\n    \"practice_conversion_url\": \"https://uat.gethealthy.store/admin/dispensary/recommendation/convert/rid/6e6e08cf-e2a0-4e0e-9359-e2e42896b56e/\",\n    \"patient_conversion_url\": \"https://uat.gethealthy.store/dispensary/recommendation/convert/rid/6e6e08cf-e2a0-4e0e-9359-e2e42896b56e/\"      \n    \"items\": [\n        {\n            \"item_id\": \"54dddeea-19d6-4914-8b52-4064f050737c\",\n            \"sku\": \"SF811\",\n            \"qty\": 1,\n            \"autoship_interval\": \"once\",\n            \"fulfillment_type\": \"LC\",\n            \"note\": \"Item specific Note\",\n            \"additional_options\":[],\n            \"availability\": \"In Stock\"\n        },\n        {\n            \"item_id\": \"179a7ef1-e1c7-42a2-a468-bd50dbee71f8\",\n            \"sku\": \"SP607\",\n            \"qty\": 2,\n            \"autoship_interval\": \"30d\",\n            \"fulfillment_type\": \"1L\",\n            \"note\": \"This is really good stuff\",\n            \"availability\": \"In Stock\",\n            \"additional_options\":[]\n        }\n    ]\n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "sT7x5eCla7VJy6tWNaRmD"
  },
  "examples": {
    "languages": [
      {
        "id": "YeG4SZbH1SAvSk3UPFYKt",
        "code": "curl --location -g --request POST 'https://{{api_host}}/rest/{{scope}}/V1/dispensary/patient/71/recommendation' \\\n--header 'Content-Type: application/json' \\\n--header 'Authorization: Bearer {{access_token}}' \\\n--data-raw '{\n    \"recommendation\": {\n        \"notify_email\" : \"1\",\n        \"notify_sms\":\"0\",\n        \"note\":\"Recommendation to help with your lipids.\"\n        \"items\":[{\n            \"sku\":\"SF811\",\n            \"qty\":\"1\",\n            \"autoship_interval\":\"once\",\n            \"note\":\"Take two before bedtime.\",\n            \"doctor_id\": 25,\n            \"loction_id\": 123,\n        },{\n            \"sku\":\"SP607\",\n            \"qty\":3,\n            \"fulfillment_type\":\"1L\",\n            \"autoship_interval\":\"30d\",\n            \"note\":\"This is really good stuff. Take 1 in the morning with food\"\n        }]\n    }\n}'",
        "language": "json",
        "customLabel": "Comprehensive"
      },
      {
        "id": "9L_AJvHioS_kzZp5HwyEv",
        "code": "curl --location -g --request POST 'https://{{api_host}}/rest/{{scope}}/V1/dispensary/patient/50/recommendation' \\\n--header 'Content-Type: application/json' \\\n--header 'Authorization: Bearer {{access_token}}' \\\n--data-raw '{\n    \"recommendation\": {\n        \"notify_email\" : \"1\",\n        \"note\":\"Recommendation to help with your lipids.\"\n    }\n}'",
        "language": "none",
        "customLabel": "Simple"
      }
    ],
    "selectedLanguageId": "YeG4SZbH1SAvSk3UPFYKt"
  },
  "description": "Recommendations require an existing patient record and a initiated from the patient API:\n",
  "currentNewParameter": {
    "label": "Header Parameter",
    "value": "headerParameters"
  },
  "autoGeneratedAnchorSlug": "api",
  "legacyHash": "SqzjFv70KmmYJSrnE8RbA"
}
```
:::

