---
title: "Retrieve analytics"
method: GET
path: "/analytics"
tags: ["Days"]
---

# Retrieve analytics

`GET /analytics`

## Request

- Base URL: `https://app.splot.health/v1`
- URL: `https://app.splot.health/v1/analytics`
- Auth: HTTP bearer

Reads daily totals, meal times, the logging streak and favourite foods for the 400 days up to today.

## Query parameters

- `today` string, date, required

## Response `200`

Your analytics.

- Analytics
  - `days` object[], required: The days with a logged meal or a mark, oldest first. Planned meals don't count.
    - `day` string, date, required: The calendar day the meals show on.
    - `meals` integer, required: How many meals were logged.
    - `kcal` number, required: Energy logged, in kcal. Items without nutrition add nothing; `unknownItems` counts them.
    - `proteinG` number, required: Protein logged, in grams.
    - `carbsG` number, required: Carbohydrates logged, in grams.
    - `fatG` number, required: Fat logged, in grams.
    - `firstMeal` integer, nullable, required: When the day's first meal was eaten, in minutes after its midnight. The day starts after its night: the longest gap between meals reaching into the small hours.
    - `lastMeal` integer, nullable, required: When the day's last meal was eaten, in minutes after its midnight, so a snack after midnight is over 1440.
    - `logging` 'complete' | 'partial', nullable, required: `partial` when the day is marked as partly logged, `complete` when fully, `null` when unmarked.
    - `unknownItems` integer, required: How many logged items have no calories.
  - `streak` object, required: Days in a row with a logged meal, however late it was logged.
    - `current` integer, required: The run ending today, or yesterday while today has nothing yet; 0 otherwise.
    - `longest` integer, required: The longest run ever.
  - `foods` object, required: The foods logged most over the last 7, 30, 182 and 365 days, eight at most each.
    - `week` object[], required
      - `library` 'off' | 'splot' | 'mine' | 'composition', required
      - `key` string, required
      - `name` string, required
      - `count` integer, required
    - `month` object[], required
      - `library` 'off' | 'splot' | 'mine' | 'composition', required
      - `key` string, required
      - `name` string, required
      - `count` integer, required
    - `half` object[], required
      - `library` 'off' | 'splot' | 'mine' | 'composition', required
      - `key` string, required
      - `name` string, required
      - `count` integer, required
    - `year` object[], required
      - `library` 'off' | 'splot' | 'mine' | 'composition', required
      - `key` string, required
      - `name` string, required
      - `count` integer, required

## Other responses

- `400`: The body or query is invalid; `issues` says which fields. Or the body is not valid JSON.
- `401`: The key is missing, revoked or expired.
- `403`: The key's permission doesn't allow this request, or you haven't yet agreed to how Splot handles health information.
- `429`: Too many requests. Wait for `Retry-After` seconds.

---

[API](https://skmtc.dev/splot/apis/splot-api.md) · [All operations](https://skmtc.dev/splot/apis/splot-api/llms.txt) · [OpenAPI document](https://skmtc.dev/splot/apis/splot-api/revisions/02f2a6340fe9?raw)
