> For the complete documentation index, see [llms.txt](https://docs.january.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.january.ai/rest-api/glucose.md).

# Glucose

Glucose intelligence for a meal — a predicted curve and an impact score in one call, no sensor required. CGM personalization rides the same endpoint via cgm\_data.

## Predict the glucose response to a meal

> Predicts the glucose curve a meal will produce for the given profile. Optionally personalize by sending cgm\_data with the consumed\_foods eaten during it (both together; the upstream needs at least five complete days of paired history). Without x-end-user-id, the partner itself is the acting user.

```json
{"openapi":"3.0.0","info":{"title":"January AI - Nutrition Intelligence APIs","version":"1.2"},"tags":[{"name":"glucose","description":"Glucose intelligence for a meal — a predicted curve and an impact score in one call, no sensor required. CGM personalization rides the same endpoint via cgm_data."}],"servers":[{"url":"https://partners.january.ai"}],"security":[{"api-key":[]}],"components":{"securitySchemes":{"api-key":{"scheme":"bearer","bearerFormat":"JWT","type":"http","description":"Your API key (sk-…), minted through the developer portal."}},"schemas":{"GlucosePredictDto":{"type":"object","properties":{"user_profile":{"$ref":"#/components/schemas/GlucoseUserProfileDto"},"foods":{"description":"The meal to predict the glucose response for.","maxItems":100,"type":"array","items":{"$ref":"#/components/schemas/FoodSelectionDto"}},"start_time":{"type":"string","format":"date-time","description":"When the meal is (or will be) eaten. Must carry a timezone designator."},"cgm_data":{"description":"Optional CGM history for personalization; requires consumed_foods.","type":"array","items":{"$ref":"#/components/schemas/CgmReadingDto"}},"consumed_foods":{"description":"The meals eaten during the CGM history; requires cgm_data.","type":"array","items":{"$ref":"#/components/schemas/ConsumedFoodEntryDto"}}},"required":["user_profile","foods","start_time"]},"GlucoseUserProfileDto":{"type":"object","properties":{"age":{"type":"number"},"sex":{"type":"string","enum":["male","female"],"description":"Biological sex, as consumed by the prediction model."},"height":{"$ref":"#/components/schemas/HeightDto"},"weight":{"$ref":"#/components/schemas/WeightDto"},"activity_level":{"type":"string","enum":["sedentary","lightly_active","moderately_active","very_active"]},"health_conditions":{"type":"array","description":"Omit it (or send []) if none apply. Type 1 diabetes is not supported by the prediction model.","items":{"type":"string","enum":["type_2_diabetes","prediabetes"]}}},"required":["age","sex","height","weight"]},"HeightDto":{"type":"object","properties":{"value":{"type":"number"},"unit":{"type":"string","enum":["in","cm"]}},"required":["value","unit"]},"WeightDto":{"type":"object","properties":{"value":{"type":"number"},"unit":{"type":"string","enum":["lb","kg"]}},"required":["value","unit"]},"FoodSelectionDto":{"type":"object","properties":{"id":{"type":"number","description":"Food id from a search, scan, or detection result."},"serving":{"$ref":"#/components/schemas/ServingSelectionDto"}},"required":["id","serving"]},"ServingSelectionDto":{"type":"object","properties":{"id":{"type":"number","description":"One of the food's serving ids."},"quantity":{"type":"number","description":"How many of that serving were consumed.","maximum":10000}},"required":["id","quantity"]},"CgmReadingDto":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time","description":"When the reading was taken. Must carry a timezone designator."},"value":{"type":"number","description":"mg/dL. At most one reading per 15-minute window."}},"required":["timestamp","value"]},"ConsumedFoodEntryDto":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time","description":"When the food was eaten. Must carry a timezone designator."},"id":{"type":"number"},"serving":{"$ref":"#/components/schemas/ServingSelectionDto"}},"required":["timestamp","id","serving"]},"GlucosePredictionResponseDto":{"type":"object","properties":{"prediction":{"description":"The predicted glucose curve at 15-minute intervals, starting at start_time.","type":"array","items":{"$ref":"#/components/schemas/GlucosePredictionPointDto"}},"impact_score":{"type":"string","enum":["low","medium","high"],"description":"The meal's overall glucose impact."},"chart":{"$ref":"#/components/schemas/GlucoseChartDto"}},"required":["prediction","impact_score","chart"]},"GlucosePredictionPointDto":{"type":"object","properties":{"minutes":{"type":"number","description":"Minutes after start_time."},"value":{"type":"number","description":"Predicted glucose, mg/dL."}},"required":["minutes","value"]},"GlucoseChartDto":{"type":"object","properties":{"min":{"type":"number","description":"Suggested Y-axis lower bound (mg/dL). A fixed target-range bound, not the minimum of the curve."},"max":{"type":"number","description":"Suggested Y-axis upper bound (mg/dL): 180 with Type 2 diabetes in health_conditions, otherwise 140. Not the maximum of the curve."}},"required":["min","max"]},"ApiErrorDto":{"type":"object","properties":{"message":{"type":"string","description":"A developer-facing explanation of what went wrong and how to fix it."},"code":{"type":"string","description":"A stable machine-readable identifier for the class of failure — build retry logic on this, never on message wording. Current values: invalid_request, unauthorized, forbidden, not_found, not_implemented, payload_too_large, rate_limited, internal_error, upstream_error, service_unavailable, upstream_timeout. Only rate_limited, internal_error, upstream_error, service_unavailable, and upstream_timeout are safe to retry (with backoff) — not_implemented is permanent until the feature ships. New codes may be added over time; treat an unknown code according to its HTTP status class."},"docs_url":{"type":"string","description":"Link to the developer documentation."}},"required":["message","code","docs_url"]}}},"paths":{"/v1.2/glucose/predictions":{"post":{"operationId":"predictGlucose","summary":"Predict the glucose response to a meal","description":"Predicts the glucose curve a meal will produce for the given profile. Optionally personalize by sending cgm_data with the consumed_foods eaten during it (both together; the upstream needs at least five complete days of paired history). Without x-end-user-id, the partner itself is the acting user.","parameters":[{"name":"x-end-user-id","in":"header","description":"Optional: your stable ID for the end user this request acts on behalf of. Opaque to January.","required":false,"schema":{"type":"string"}},{"name":"x-end-user-timezone","in":"header","description":"The end user's IANA timezone, e.g. America/New_York. Defaults to UTC when omitted; must be sent when using cgm_data — the history is bucketed into their local days.","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlucosePredictDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlucosePredictionResponseDto"}}}},"400":{"description":"A field is missing or invalid; the message names it and the accepted values.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorDto"}}}},"401":{"description":"The Authorization header is missing or the API key is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorDto"}}}},"429":{"description":"Either a rate limit was exceeded (`code: rate_limited`) or the monthly credit allowance is spent (`code: credit_limit_exceeded`). When Retry-After is present, wait that many seconds; a per-day allowance resets 24 hours after the first request in its window. Credit exhaustion carries no Retry-After and retrying does not help — the allowance returns at the start of the next calendar month. Call `GET /v1.2/credits` for the balance and reset date.","headers":{"Retry-After":{"description":"Seconds to wait before retrying; present when the window is known.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorDto"}}}},"504":{"description":"The prediction took too long; retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorDto"}}}},"default":{"description":"Any other error: the HTTP status plus { message, code, docs_url }. Retry only rate_limited and the transient 5xx codes — never not_implemented.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorDto"}}}}},"tags":["glucose"]}}}}
```
