Skip to content
skcal
Esc
↑↓navigate↵open⌘Jpreview

Upsert a day's totals

Directly sets the calorie and protein totals for one calendar day, replacing any existing roll-up.

PUT/api/nutrition
Authorization
__Secure-better-auth.session_tokenAPI key · cookierequired

Better Auth session. Signing in (Google or email magic link) sets an HttpOnly session cookie that scopes every request to that account. The web app and CLI use this; agents use the OAuth 2.1 flow of the MCP server.

or
AuthorizationBearer token · headerrequired

Personal API key sent as Authorization: Bearer skcal_…. Create and scope keys in the app under your profile → API keys. Keys default to full access; a scoped key is limited to its granted resource:action permissions and cannot manage other keys.

Request body
requiredapplication/json

The day's totals to store.

datestring<date>required

Calendar day to upsert (YYYY-MM-DD).

kcalinteger | null

Total calories to set for the day.

min 0 · max 20000
proteinGinteger | null

Total protein in grams to set for the day.

min 0 · max 1000
hitProteinboolean | null

Whether to mark the protein target as met.

adherencestring | null

Calorie adherence bucket to set.

Allowed:underonovernull
Responses
200

The day's totals were stored.

okbooleanrequired

Always true.

400

The request body or parameters failed validation.

errorstringrequired

Human-readable failure reason.

detailstring

Optional extra context, present on upstream failures.

Try it
Server
Authorization
Bodyapplication/json
Request
curl -X PUT 'https://app.skcal.fit/api/nutrition' \
  -H 'Cookie: __Secure-better-auth.session_token=YOUR_API_KEY' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "date": "2026-06-29",
  "kcal": 2150,
  "proteinG": 168,
  "hitProtein": true,
  "adherence": "on"
}'
Response
{
  "ok": true
}

Was this page helpful?