# Create a User Recipe

Use the `createMyRecipe` mutation to create a new user recipe.&#x20;

These recipes are associated with the user's profile and can only be seen and used by them. You can query for a user's recipes using [`myRecipes`](https://docs.suggestic.com/graphql/query/queries/recipes/users-recipes) query.&#x20;

You may add the [recipe](https://docs.suggestic.com/graphql/objects/recipe/recipe-object) object to the mutation's response to geting additional data about the created recipe, such as its `id`.

{% hint style="warning" %}
User recipes cannot be added or used in the meal plan.
{% endhint %}

### Prerequisites

* To have at least one [common ](https://docs.suggestic.com/graphql/query/mutations/food-log/log-entries/create-my-common-foods)or [branded](https://docs.suggestic.com/graphql/query/mutations/food-log/log-entries/create-my-branded-food) food created.

### Available Arguments

<table data-header-hidden><thead><tr><th width="220">Name</th><th>Type</th><th width="164">Required?</th><th>Description</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td><strong>Type</strong></td><td><strong>Required?</strong></td><td><strong>Description</strong></td></tr><tr><td><code>name</code></td><td>String</td><td>Yes</td><td>Name of the recipe</td></tr><tr><td><code>courses</code></td><td>String</td><td>Yes</td><td>Tags representing the courses associated with the recipe. For example Main dishes, Side Dishes, Appetizers, Salads, etc.</td></tr><tr><td><code>cuisines</code></td><td>String</td><td>Yes</td><td>Tags representing the cuisines associated with the recipe.</td></tr><tr><td><code>ingredientLines</code></td><td>[String]</td><td>Yes</td><td>Description of the recipe ingredients. Separate them by using commas. </td></tr><tr><td><code>ingredients</code></td><td><a href="https://docs.suggestic.com/graphql/objects/food-logs/ingredient-amount">IngredientAmount</a></td><td>Yes</td><td>An object that includes the ingredient amount for a given food.</td></tr><tr><td><code>instructions</code></td><td>String</td><td>Yes</td><td>An array of cooking instruction lines. </td></tr><tr><td><code>mealTimes</code></td><td><a href="https://docs.suggestic.com/graphql/objects/common/meal-times">mealTimes</a></td><td>Yes</td><td>Description of the food</td></tr><tr><td><code>numberOfServings</code></td><td>Int</td><td>No</td><td>Original recipe number of servings</td></tr><tr><td><code>language</code></td><td>Language</td><td>No</td><td><p>Language code of the recipe. Possible Values: </p><ul><li><strong>ES: Spanish</strong></li><li><strong>EN: English</strong></li></ul></td></tr><tr><td><code>tags</code></td><td>String</td><td>No</td><td>Meal tags. Possible values: "VEGETARIAN", "Shake", "PLANT_BASED", "DAIRY_FREE", "VEGAN", "GLUTEN_FREE"</td></tr><tr><td><code>totalTime</code></td><td>String</td><td>No</td><td><p>Total preparation and cooking time in text format</p><p>E.g., 5 minutes</p></td></tr><tr><td><code>totalTimeInSeconds</code></td><td>Int</td><td>No</td><td>Total preparation and cooking time in seconds</td></tr><tr><td><code>mainImage</code></td><td>String</td><td>No</td><td>Image URL </td></tr><tr><td><code>squareImage</code></td><td>String</td><td>No</td><td>Image URL</td></tr></tbody></table>

### Available Fields

The following field will be part of the response.

| Field name | Type                     | Description                                                               |
| ---------- | ------------------------ | ------------------------------------------------------------------------- |
| `sucess`   | String                   | **True** if the recipe has been created. Otherwise, it displays **False** |
| `message`  | String                   | Description of the result                                                 |
| `recipe`   | [recipe](#prerequisites) | Recipe object which returns the information of the recipe.                |

## Example

The following example create a recipe. As a part of the response, the `id` and `name` of the recipe are returned.

{% tabs %}
{% tab title="Mutation" %}

```graphql
mutation createMyRecipe {
  createMyRecipe(
    input: {
      name: "Fried Chicken"
      tags: ["tag1", "tag2"]
      ingredientLines: ["Line1", "Line2"]
      ingredients: [
        { foodId: "QnJhbmRlZEZvb2ROb2RlOjE3NTgwNTM3LTQ0YTItNDdjOS05ODg1LWQ1YjIwNGM4NWRmZg==", grams: 10}
      ]
      numberOfServings: 2
      cuisines: "Mexican"
      mealTimes: [DINNER, LUNCH]
      courses: "Main Dish"
      instructions: "In a large bowl, beat the eggs. In another bowl, combine the salt, pepper, garlic powder and paprika to make a seasoned salt. Add the flour to a third bowl."
    }
  ) {
    success
    message
     recipe { id name }
  }
}


```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "createMyRecipe": {
      "success": true,
      "message": "My recipe has been saved",
      "recipe": {
        "id": "VXNlclJlY2lwZTpQeDFSZTN3QlY0Q1V6aWdSV2VqcQ==",
        "name": "Fried Chicken"
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}
