> For the complete documentation index, see [llms.txt](https://docs.suggestic.com/graphql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.suggestic.com/graphql/query/queries/food-log/macros-log-aggregation.md).

# Macros Aggregation

The `mealLogMacroAggs` query returns a list of aggregated macronutrients for the given date ranges, **not grouped by date.** I.e. the sum of carbs in grams consumed in the past 5 days.

{% hint style="warning" %}
The calculations made before logging a meal must be on the user's side.
{% endhint %}

### Required Arguments

| Argument   | Type  | Required |
| ---------- | ----- | -------- |
| `fromDate` | Date! | true     |
| `toDate`   | Date! | true     |

### Available Fields

| Nutrient           | Description | Unit |
| ------------------ | ----------- | ---- |
| `chocdf (carbs)`   | Carbs       | g    |
| `fat`              | Fat         | g    |
| `procnt (protein)` | Protein     | g    |
| `sugar`            | Sugar       | g    |
| `netcarbs`         | Net Carbs   | g    |
| `calories`         | Calories    | cal  |

### Example

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

```graphql
{
  mealLogMacroAggs(fromDate: "2020-01-01" toDate: "2020-01-21") {
    sugar
    fat
    procnt
    chocdf
    calories
  }
}
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "mealLogMacroAggs": {
      "sugar": 30.53749942779541,
      "fat": 62.32470226287842,
      "procnt": 65.92470264434814,
      "chocdf": 86.83156776428223,
      "calories": 600
    }
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/queries/food-log/macros-log-aggregation.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.
