# Create Log Entry

Use the `createMealLog` mutation to create a new log entry for the logged-in user. This service is commonly used together with the [autocomplete ](/graphql/query/search/food-search-for-food-log/legacy/autocomplete.md)search.&#x20;

{% hint style="warning" %}
Please note that depending on the *mealType* being logged a different combination of parameters will be required. Please review our[ Food Log Guide ](/graphql/start-here/tutorials-and-walkthroughs/food-log-guide.md)before starting.
{% endhint %}

{% hint style="info" %}
This mutation will be soon deprecated. It is recommended to use [`addFoodLog` ](https://docs.suggestic.com/graphql/query/mutations/food-log/log-entries/add-a-food-log)mutation
{% endhint %}

### Required Arguments

| Argument                  | Required? | Type                                                                                            | Description                                                                                                                                                                                                                                                                      |
| ------------------------- | --------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mealDatabaseId`          | True      | `String!`                                                                                       | <p>The <code>databaseId</code> of the meal being logged. </p><p>I.e. If you are logging a recipe, then <code>mealType</code> should be RECIPE and <code>mealDatabaseId</code> should be the <code>databaseId</code> of the <a href="/pages/-Lwsm6KUyhu8bBwNKRoR">recipe</a>.</p> |
| `mealType`                | True      | [`MealType!`](https://docs.suggestic.com/graphql/objects/food-logs/meal-type#available-options) | Available options are `RECIPE`, `MENU_ITEM`, `OWN_RECIPE`, `USDA_MEAL`, and `OWN_ITEM`                                                                                                                                                                                           |
| `mealTime`                | True      | `MealTime!`                                                                                     | Available options are `BREAKFAST`, `SNACK`, `LUNCH` and `DINNER`                                                                                                                                                                                                                 |
| `quantity`                | True      | `Float`                                                                                         | The number of servings that is being logged                                                                                                                                                                                                                                      |
| `serving`                 | False     | `Float!`                                                                                        | <p>Represents the index of the item in the <a href="/pages/-M7A4Sge8eteCX3Canma">servings </a>object that is being logged.</p><p>Don't use this field if you are using the<code>customServingEquivalent</code> option.</p>                                                       |
| `customServingEquivalent` | False     | `Float`                                                                                         | <p>If not using the <code>serving</code> field, then enter here the equivalent <strong>in grams</strong> that is being logged<strong>.</strong> </p><p>I.e. If a protein bar weighs 100 grams (1 serving) and you want to log 0.8 servings, then this value would be 80.</p>     |
| `date`                    | False     | `Date!`                                                                                         | format `YYYY-mm-dd`                                                                                                                                                                                                                                                              |
| `time`                    | False     | `Time!`                                                                                         | format `HH:MM`                                                                                                                                                                                                                                                                   |

### Example

Creating a new log entry for a recipe that was consumed for dinner on a particular date and time.

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

```graphql
mutation {
    createMealLog(
        mealType: RECIPE,
        mealTime: DINNER,
        mealDatabaseId: "a281aa17-e746-4780-b69b-b4c3597bb783",
        customServingEquivalent: 122.53701305389404,
        date: "2020-04-02",
        quantity: 1,
        time: "20:00"
    ) {
        success
        databaseId
    }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
    "data":{
        "createMealLog":{
            "success":true,
            "databaseId":"cf4b117c751911eaa4d692235651c382"
        }
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.suggestic.com/graphql/query/mutations/food-log/log-entries/meal-log-legacy/food-logs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
