# Create "own" Food Item

Use the `createOwnMealLog` mutation to create a new food item for the currently logged user.

Optional: use *logAfterCreation* to automatically add to the user's log after the item has been created.

| Arguments          | Required | Type                                                                                          |
| ------------------ | -------- | --------------------------------------------------------------------------------------------- |
| `name`             | true     | String!                                                                                       |
| `barcode`          | false    | String                                                                                        |
| `brand`            | false    | String                                                                                        |
| `date`             | false    | Date                                                                                          |
| `logAfterCreation` | false    | Boolean                                                                                       |
| `mealTimes`        | true     | [MealTimes!](https://docs.suggestic.com/graphql/objects/common/meal-time)                     |
| `mealType`         | true     | [MealType!](https://docs.suggestic.com/graphql/objects/food-logs/meal-type#available-options) |
| `ownNutrients`     | true     | [OwnNutrients!](https://docs.suggestic.com/graphql/objects/common/own-nutrients)              |
| `ownServing`       | true     | [OwnServing!](https://docs.suggestic.com/graphql/objects/common/own-serving)                  |

Note:

{% hint style="info" %}
mealTime parameter has been deprecated. Instead, mealTimes parameter has been added.
{% endhint %}

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

```graphql
mutation {
  createOwnMealLog(
    name: "Powercrunch Protein bar"
    barcode: "580062789"
    brand: "Powercrunch"
    date: "2020-08-10"
    logAfterCreation: true
    mealTimes: [BREAKFAST, LUNCH, DINNER]
    mealType: OWN_ITEM
    ownNutrients: {
      enercKcal: 220,
    	ca: 60,
      chocdf: 12,
      chole: 0,
      fams: 0,
      fapu: 0,
      fasat: 0,
      fat: 13,
      fatrn: 0,
      fe: 0,
      fibtg: 0,
      k: 0,
      na: 0,
      procnt: 13,
      sugar: 6,
      vitaIu: 0,
      vitc: 0
    }
    ownServing:{
      equivalent: 40,
      name: "5 servings"
   }
  ) {
    databaseId
  }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "createOwnMealLog": {
      "databaseId": "31170210-db3d-11ea-a04e-0242ac180007"
    }
  }
}
```

{% endtab %}
{% endtabs %}
