Fuel

Connect your own agent

Base URL: https://fuel.johannesklumpe.com. Use HTTPS and send Authorization: Bearer YOUR_TOKEN on each API request. These examples use shell variables:

BASE='https://fuel.johannesklumpe.com'
TOKEN='YOUR_TOKEN'

Create an API token in app Settings if your build supports token management. Choose read for reading data and POST /fuel/preview, or full for writes. Token management and export require full scope. Save the token when it is shown; the server stores only its hash. Never put it in a URL.

With an existing full credential, token creation is also available through the API:

curl "$BASE/fuel/tokens" -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' -d '{"name":"My agent","scope":"read"}'
{"name":"My agent","scope":"read"}

JSON blocks below are request bodies for writes and labelled response excerpts for reads. A GET has no request body. Responses can contain additional fields. IDs in examples are placeholders: use the IDs returned by your requests.

Log text or a photo

POST /fuel/log: text

Estimate and log food. Generate a new UUID for each new turn; reuse the same client_id and identical input when retrying. Reusing an ID with different input returns 409. The response contains entry_id, items and a snapshot. A 202 response means work is pending; poll the entry.

curl "$BASE/fuel/log" -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"client_id":"9493a9e2-48db-40c9-9d2a-c620efcf12e1","text":"I ate 250 g skyr and 30 g walnuts"}'
{"client_id":"9493a9e2-48db-40c9-9d2a-c620efcf12e1","text":"I ate 250 g skyr and 30 g walnuts"}

POST /fuel/log: photo

Use multipart/form-data with repeated image parts for up to four JPEG or PNG photos. The optional text describes the meal. This JSON example shows the text fields only; upload the image as a file, not JSON or base64.

curl "$BASE/fuel/log" -H "Authorization: Bearer $TOKEN" \
  -F 'client_id=63a3ac3c-7981-41da-b0b5-250123b4cf29' \
  -F 'text=I ate this meal' -F 'image=@meal.jpg;type=image/jpeg'
{"client_id":"63a3ac3c-7981-41da-b0b5-250123b4cf29","text":"I ate this meal"}

GET /fuel/entry/{id}

Read a logged entry or poll pending work using its entry_id. Response excerpt:

curl "$BASE/fuel/entry/ENTRY_ID" -H "Authorization: Bearer $TOKEN"
{"status":"done","entry_id":"ENTRY_ID","photo_ids":[]}

Read a day

GET /fuel/day

Read active items and the snapshot for today. An optional date=YYYY-MM-DD selects today or one of the previous 34 days. Empty-day response excerpt:

curl "$BASE/fuel/day" -H "Authorization: Bearer $TOKEN"
{"date":"2026-11-25","items":[]}

GET /fuel/snapshot

Read the day summary, including totals, targets and context. An optional date selects a day. Response excerpt:

curl "$BASE/fuel/snapshot" -H "Authorization: Bearer $TOKEN"
{"date":"2026-11-25","revision":0}

Your goals

GET /fuel/goals

Read the fuel.goals/1 document, revision and validation warnings. Before you set goals, the response is:

curl "$BASE/fuel/goals" -H "Authorization: Bearer $TOKEN"
{"goals":null,"revision":null,"warnings":[]}

PUT /fuel/goals

Save the following complete request as goals.json. This small document sets a daily protein floor and a weekly target for a custom metric. Use null only for the first write; otherwise replace base_revision with the revision returned by GET. A stale revision returns 409; invalid goals return 422 with issues.

curl -X PUT "$BASE/fuel/goals" -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' --data-binary @goals.json
{
  "base_revision": null,
  "goals": {
    "schema": "fuel.goals/1",
    "tz": "Europe/Zurich",
    "metrics": [{"id":"x_nuts_g","label":"Nuts","unit":"g","describe":"Grams of tree nuts and peanuts in the item."}],
    "targets": [
      {"metric":"protein_g","kind":"floor","value":{"abs":100},"period":"day"},
      {"metric":"x_nuts_g","kind":"floor","value":{"abs":210},"period":"week"}
    ]
  }
}

Custom metric IDs keep their original unit and meaning. Change the ID for a different meaning. Goals bodies are limited to 64 KiB.

Repeat buttons

GET /fuel/buttons

Read pinned and suggested foods, plus workout buttons. limit defaults to 12 and may be at most 40. Empty response:

curl "$BASE/fuel/buttons?limit=12" -H "Authorization: Bearer $TOKEN"
{"pinned":[],"suggested":[],"workouts":[]}

PUT /fuel/buttons/{key}

Use a URL-encoded key from the list to pin, hide, relabel or scale a button. Null clears a preference. This request pins it first:

curl -X PUT "$BASE/fuel/buttons/BUTTON_KEY" -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' -d '{"pin_rank":0}'
{"pin_rank":0}

Workouts

POST /fuel/workouts

Record a workout. Date defaults to today in the account zone. Keep client_id stable on retry; optional source and source_id support import updates without duplicates.

curl "$BASE/fuel/workouts" -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"client_id":"9d70ecfb-57ef-4cf2-a024-937f44b4c728","label":"Walk","kcal":150,"minutes":30}'
{"client_id":"9d70ecfb-57ef-4cf2-a024-937f44b4c728","label":"Walk","kcal":150,"minutes":30}

GET /fuel/workouts

Read today's workouts, or pass date=YYYY-MM-DD. Empty response:

curl "$BASE/fuel/workouts" -H "Authorization: Bearer $TOKEN"
{"workouts":[]}

DELETE /fuel/workouts/{id}

Soft-delete a workout so it no longer contributes to sums. Response:

curl -X DELETE "$BASE/fuel/workouts/WORKOUT_ID" -H "Authorization: Bearer $TOKEN"
{"deleted":true}

Weights

POST /fuel/weights

Record weight in kilograms. Date defaults to today. Keep client_id stable on retry; source and source_id can identify an imported measurement.

curl "$BASE/fuel/weights" -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' -d '{"client_id":"8d889743-6f79-4fa1-a654-5f9e97b467d3","kg":78}'
{"client_id":"8d889743-6f79-4fa1-a654-5f9e97b467d3","kg":78}

GET /fuel/weights

Read measurements from the last N days. days defaults to 30 and may be at most 400. Empty response:

curl "$BASE/fuel/weights?days=30" -H "Authorization: Bearer $TOKEN"
{"weights":[]}

DELETE /fuel/weights/{id}

Soft-delete a measurement so it no longer counts as the newest weight. Response:

curl -X DELETE "$BASE/fuel/weights/WEIGHT_ID" -H "Authorization: Bearer $TOKEN"
{"deleted":true}

Export your data

GET /fuel/export

Requires full scope. The successful response is application/zip, containing fuel.sqlite and photos/. It is not JSON. With a read token the JSON error is:

curl "$BASE/fuel/export" -H "Authorization: Bearer $TOKEN" -o fuel-export.zip
{"error":{"code":"forbidden","message":"insufficient scope","retryable":false}}

Errors and limits

Errors use an error object with code, message and retryable. For example, a request without a token:

curl "$BASE/fuel/day"
{"error":{"code":"unauthorized","message":"missing or wrong token","retryable":false}}

Expect 400 for bad input, 401 for authentication, 403 for scope, 404 for missing objects, 409 for conflicts, 413 for size limits, 415 for unsupported media, 422 for consumer validation, 429 for limits and 502 or 503 for upstream or temporary failures. Respect Retry-After when present. Retry a write with the same client_id and unchanged input.

Configured daily account quotas: 100 admitted turns and 40 photo turns (UTC day). Built-in defaults are 60 and 30. Replaying an admitted client_id costs no additional quota. Each account also has the existing log caps of 30 per rolling hour and 200 per rolling day, and two concurrent log slots. The configured global model/transcription slot count is 4 (default 4).

Public sign-in, linking and these site pages share 30 requests per minute per client address. Existing /fuel/web/ static files are exempt. A rate limit returns 429.

Log uploads allow 24 MiB total, text of 2,000 characters, at most four images of 8 MiB each, and one audio file of 10 MiB. Consumer JSON bodies allow 64 KiB. JPEG and PNG are accepted; convert HEIC before upload.