/** * January AI - Nutrition Intelligence APIs * Build food and metabolic intelligence into your product — one API for understanding what people eat and how food may affect them. **Clinical-grade precision, consumer-grade experiences.** January builds the infrastructure underneath the product: turning messy health and nutrition data into reliable intelligence, so your team spends its time on the experience instead of the foundation. **Security & compliance** — **SOC 2 Type II** · **HIPAA-aligned practices** · **BAA** and **Zero Data Retention (ZDR)** available **What you can build** - **Scan food** — photo and text food recognition: detect foods and nutrition, then correct results conversationally - **Search the food database** — by name or barcode — and get healthier alternatives for any food - **Log food, water and weight** — per-user diaries with day-range queries - **Predict glucose response** to any meal — no sensor required **Getting started** 1. Create an API key in the [Developer Dashboard](https://dashboard.january.ai) — the full key is shown once, at creation. 2. Send it as `Authorization: Bearer sk-…` — click **Authorize** here to make every example below a live request. 3. On the endpoints that read or write an end user\'s logs, say whose with the `January-End-User-ID` header — each one documents it. No other endpoint takes it: everything else either asks the shared food database a question or works on the body you send, and neither depends on who the food is for. **Calling from a mobile app** — your `sk-` key must never ship inside an app. Instead, exchange it on your backend for a *client token*: a credential that lasts up to two hours, acts as exactly one of your end users, and carries only the scopes you grant it (see the **authentication** section). Your app then calls these endpoints directly, with no proxy of your own in the request path. Both credentials travel in the same `Authorization: Bearer` header, and every endpoint below opens by saying which it accepts — **API key or client token**, or **API key only**. **Support** — [support@january.ai](mailto:support@january.ai) · [Discord community](https://discord.gg/cYQeh3UnC) · [docs.january.ai](https://docs.january.ai) * * The version of the OpenAPI document: 1.2 * Contact: support@january.ai * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime.js'; import { type CreateFoodLogBody } from '../models/CreateFoodLogBody.js'; import { type FoodLog } from '../models/FoodLog.js'; import { type FoodLogSummary } from '../models/FoodLogSummary.js'; import { type ListFoodLogsResponse } from '../models/ListFoodLogsResponse.js'; import { type UpdateFoodLogBody } from '../models/UpdateFoodLogBody.js'; export interface CreateFoodLogRequest { createFoodLogBody: CreateFoodLogBody; januaryEndUserID?: string; } export interface DeleteFoodLogRequest { logId: string; januaryEndUserID?: string; } export interface GetFoodLogRequest { logId: string; januaryEndUserID?: string; } export interface GetFoodLogSummaryRequest { startDate: Date; endDate: Date; timezone: string; januaryEndUserID?: string; groupBy?: GetFoodLogSummaryGroupByEnum; weekStart?: GetFoodLogSummaryWeekStartEnum; } export interface ListFoodLogsRequest { startDate: Date; endDate: Date; timezone: string; januaryEndUserID?: string; } export interface UpdateFoodLogRequest { logId: string; updateFoodLogBody: UpdateFoodLogBody; januaryEndUserID?: string; } /** * */ export declare class FoodLogsApi extends runtime.BaseAPI { /** * Creates request options for createFoodLog without sending the request */ createFoodLogRequestOpts(requestParameters: CreateFoodLogRequest): Promise; /** * **API key or client token.** Creates a food log from food + serving ids (from search or food-analysis results). The response echoes the log hydrated with full nutrition — save its `id` to update or delete the log, or fetch it again with GET /v1.2/food-logs/{log_id}. Not idempotent: verify with the list or get endpoint before retrying a timed-out create. Callable with a client token carrying the `food_logs:write` scope. * Log foods for a user */ createFoodLogRaw(requestParameters: CreateFoodLogRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * **API key or client token.** Creates a food log from food + serving ids (from search or food-analysis results). The response echoes the log hydrated with full nutrition — save its `id` to update or delete the log, or fetch it again with GET /v1.2/food-logs/{log_id}. Not idempotent: verify with the list or get endpoint before retrying a timed-out create. Callable with a client token carrying the `food_logs:write` scope. * Log foods for a user */ createFoodLog(requestParameters: CreateFoodLogRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Creates request options for deleteFoodLog without sending the request */ deleteFoodLogRequestOpts(requestParameters: DeleteFoodLogRequest): Promise; /** * **API key or client token.** Idempotent: deleting an unknown or already-deleted log answers the same 204, so it is safe to retry. Callable with a client token carrying the `food_logs:write` scope. * Delete a food log */ deleteFoodLogRaw(requestParameters: DeleteFoodLogRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * **API key or client token.** Idempotent: deleting an unknown or already-deleted log answers the same 204, so it is safe to retry. Callable with a client token carrying the `food_logs:write` scope. * Delete a food log */ deleteFoodLog(requestParameters: DeleteFoodLogRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Creates request options for getFoodLog without sending the request */ getFoodLogRequestOpts(requestParameters: GetFoodLogRequest): Promise; /** * **API key or client token.** Fetches one food log by the id returned when it was created. Callable with a client token carrying the `food_logs:read` scope. * Get a food log */ getFoodLogRaw(requestParameters: GetFoodLogRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * **API key or client token.** Fetches one food log by the id returned when it was created. Callable with a client token carrying the `food_logs:read` scope. * Get a food log */ getFoodLog(requestParameters: GetFoodLogRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Creates request options for getFoodLogSummary without sending the request */ getFoodLogSummaryRequestOpts(requestParameters: GetFoodLogSummaryRequest): Promise; /** * **API key or client token.** Aggregates the logs between `start_date` and `end_date` (both inclusive local calendar dates in `timezone`) into per-day or per-week buckets, each with summed nutrients, plus totals for the range and an average per logged day. The range spans at most 366 days — wide enough for a year at a time; the 366-day cap bounds the number of buckets. The buckets tile the whole range in chronological order: a day or week with no logs is still returned, with zero counts, and under `group_by=week` the first and last buckets are clipped to the dates you asked for. `nutrients` is sparse, so read `logs_count` to tell a bucket with no logs from one whose logs could not be resolved. Callable with a client token carrying the `food_logs:read` scope. * Summarize a user\'s food logs over a date range */ getFoodLogSummaryRaw(requestParameters: GetFoodLogSummaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * **API key or client token.** Aggregates the logs between `start_date` and `end_date` (both inclusive local calendar dates in `timezone`) into per-day or per-week buckets, each with summed nutrients, plus totals for the range and an average per logged day. The range spans at most 366 days — wide enough for a year at a time; the 366-day cap bounds the number of buckets. The buckets tile the whole range in chronological order: a day or week with no logs is still returned, with zero counts, and under `group_by=week` the first and last buckets are clipped to the dates you asked for. `nutrients` is sparse, so read `logs_count` to tell a bucket with no logs from one whose logs could not be resolved. Callable with a client token carrying the `food_logs:read` scope. * Summarize a user\'s food logs over a date range */ getFoodLogSummary(requestParameters: GetFoodLogSummaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Creates request options for listFoodLogs without sending the request */ listFoodLogsRequestOpts(requestParameters: ListFoodLogsRequest): Promise; /** * **API key or client token.** Returns the logs between `start_date` and `end_date` (both inclusive local calendar dates in `timezone`; the range spans at most 60 days), ordered by timestamp. An empty list is a valid result. Callable with a client token carrying the `food_logs:read` scope. * List a user\'s food logs in a date range */ listFoodLogsRaw(requestParameters: ListFoodLogsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * **API key or client token.** Returns the logs between `start_date` and `end_date` (both inclusive local calendar dates in `timezone`; the range spans at most 60 days), ordered by timestamp. An empty list is a valid result. Callable with a client token carrying the `food_logs:read` scope. * List a user\'s food logs in a date range */ listFoodLogs(requestParameters: ListFoodLogsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Creates request options for updateFoodLog without sending the request */ updateFoodLogRequestOpts(requestParameters: UpdateFoodLogRequest): Promise; /** * **API key or client token.** Replaces any subset of the log: `foods`, `created_at`, `name`. Omitted fields are left unchanged. Callable with a client token carrying the `food_logs:write` scope. * Update a food log */ updateFoodLogRaw(requestParameters: UpdateFoodLogRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * **API key or client token.** Replaces any subset of the log: `foods`, `created_at`, `name`. Omitted fields are left unchanged. Callable with a client token carrying the `food_logs:write` scope. * Update a food log */ updateFoodLog(requestParameters: UpdateFoodLogRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * @export */ export declare const GetFoodLogSummaryGroupByEnum: { readonly day: 'day'; readonly week: 'week'; readonly unknownDefaultOpenApi: '11184809'; }; export type GetFoodLogSummaryGroupByEnum = typeof GetFoodLogSummaryGroupByEnum[keyof typeof GetFoodLogSummaryGroupByEnum]; /** * @export */ export declare const GetFoodLogSummaryWeekStartEnum: { readonly monday: 'monday'; readonly sunday: 'sunday'; readonly unknownDefaultOpenApi: '11184809'; }; export type GetFoodLogSummaryWeekStartEnum = typeof GetFoodLogSummaryWeekStartEnum[keyof typeof GetFoodLogSummaryWeekStartEnum]; //# sourceMappingURL=FoodLogsApi.d.ts.map