Kosthensyn

Allergier, intoleranser og dietter som planleggeren velger retter etter.4 operasjoner

Hoder på hvert svar

Hvert svar på denne siden har disse hodene.
X-Trace-Id
— The W3C trace id of this request — the same id in the log and in the traceId of a problem. Quote it when reporting.
Server-Timing
— Where the time went: total, db;dur=…;desc="N queries", and every step the handler named (ADR-163).
X-Diagnostics
— Only when the request asked with X-Diagnostics: 1 or ?diagnostics=1: the same breakdown as one JSON object, with the trace id (ADR-163).

Operasjoner

GET/api/v1/households/{householdId}/constraints

List the household's allergies, intolerances, diets and avoidances

Parametre

NavnHvorTypePåkrevdBeskrivelse
householdIdpathstring (uuid)Påkrevd—

Svar

200OK
application/jsonDietaryConstraintResponse[]
401No session, or the session is no longer valid.
application/problem+jsonProblemDetails
426The build named in X-App-Version is below its platform's version floor (ADR-070). Problem type app-version-unsupported; the only way forward is the store. Callers without the header are never turned away.
application/problem+jsonProblemDetails
429Too many calls in the window; Retry-After says how long.
application/problem+jsonProblemDetails
Hoder
Retry-After
— Seconds to wait when a rate limit answered or the server is down for maintenance, or an HTTP date when the household's AI is paused. Absent when the household's AI quota for the period is used up — that resets by itself.
503The server is down for maintenance (#4693). Retry-After says when to try again; problem type maintenance. Every call under /api answers this while maintenance mode is on, the version floor included.
application/problem+jsonProblemDetails
Hoder
Retry-After
— Seconds to wait when a rate limit answered or the server is down for maintenance, or an HTTP date when the household's AI is paused. Absent when the household's AI quota for the period is used up — that resets by itself.

Eksempel

curl -b "bryti_session=…" \
  "https://bryti.app/api/v1/households/3fa85f64-5717-4562-b3fc-2c963f66afa6/constraints"

Eksempel på svar

200application/json
[
  {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "householdId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "householdMemberId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "kind": "Allergy",
    "foodOrCategory": "string",
    "severity": "Hard",
    "notes": "string",
    "createdAt": "2026-09-07T16:30:00Z",
    "updatedAt": "2026-09-07T16:30:00Z",
    "foodKey": "string",
    "displayName": "string"
  }
]
POST/api/v1/households/{householdId}/constraints

Add a dietary constraint for the whole household or one person

Adults only; a Junior member gets 403. householdMemberId null means it applies to everyone at the table. 404 when the person is not in this household. 409 with code consent_required for an Allergy, Intolerance or DietaryPattern when the subject's explicit yes to storing health data is not on file (GDPR art. 9(2)(a), #2932). The yes is per person: the household's covers only a constraint that names nobody, and the refusal names whose yes is missing in householdMemberId (#4878). An Avoidance is a preference and needs none.

Parametre

NavnHvorTypePåkrevdBeskrivelse
householdIdpathstring (uuid)Påkrevd—

Forespørselskropp

application/jsonPåkrevdCreateDietaryConstraintRequest

Svar

201Created
application/jsonDietaryConstraintResponse
400Bad Request
application/problem+jsonProblemDetails
401No session, or the session is no longer valid.
application/problem+jsonProblemDetails
404Not Found
application/problem+jsonProblemDetails
409Conflict
application/problem+jsonProblemDetails
426The build named in X-App-Version is below its platform's version floor (ADR-070). Problem type app-version-unsupported; the only way forward is the store. Callers without the header are never turned away.
application/problem+jsonProblemDetails
429Too many calls in the window; Retry-After says how long.
application/problem+jsonProblemDetails
Hoder
Retry-After
— Seconds to wait when a rate limit answered or the server is down for maintenance, or an HTTP date when the household's AI is paused. Absent when the household's AI quota for the period is used up — that resets by itself.
503The server is down for maintenance (#4693). Retry-After says when to try again; problem type maintenance. Every call under /api answers this while maintenance mode is on, the version floor included.
application/problem+jsonProblemDetails
Hoder
Retry-After
— Seconds to wait when a rate limit answered or the server is down for maintenance, or an HTTP date when the household's AI is paused. Absent when the household's AI quota for the period is used up — that resets by itself.

Problemkoder

`code` i problemkroppen er den du forgreiner på. `detail` er engelsk, skrevet for loggen.

consent_required
— Bryti trenger et uttrykkelig ja før den kan lagre helseopplysninger. Det ja-et gir du på personens kort under Husholdning.

Eksempel

curl -b "bryti_session=…" \
  -X POST \
  "https://bryti.app/api/v1/households/3fa85f64-5717-4562-b3fc-2c963f66afa6/constraints" \
  -H "Content-Type: application/json" \
  -d '{"householdMemberId":"3fa85f64-5717-4562-b3fc-2c963f66afa6","kind":"Allergy","foodOrCategory":"string","severity":"Hard","notes":"string"}'

Eksempel på svar

201application/json
{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "householdId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "householdMemberId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "kind": "Allergy",
  "foodOrCategory": "string",
  "severity": "Hard",
  "notes": "string",
  "createdAt": "2026-09-07T16:30:00Z",
  "updatedAt": "2026-09-07T16:30:00Z",
  "foodKey": "string",
  "displayName": "string"
}
PATCH/api/v1/households/{householdId}/constraints/{constraintId}

Change a constraint's kind, food, severity or notes

Adults only; a Junior member gets 403. The person it applies to cannot be changed here — delete it and add a new one. 409 with code consent_required when the new kind is health data and the subject's explicit yes is not on file (#2932); the refusal names the subject in householdMemberId (#4878).

Parametre

NavnHvorTypePåkrevdBeskrivelse
householdIdpathstring (uuid)Påkrevd—
constraintIdpathstring (uuid)Påkrevd—

Forespørselskropp

application/jsonPåkrevdUpdateDietaryConstraintRequest

Svar

200OK
application/jsonDietaryConstraintResponse
400Bad Request
application/problem+jsonProblemDetails
401No session, or the session is no longer valid.
application/problem+jsonProblemDetails
404Not Found
application/problem+jsonProblemDetails
409Conflict
application/problem+jsonProblemDetails
426The build named in X-App-Version is below its platform's version floor (ADR-070). Problem type app-version-unsupported; the only way forward is the store. Callers without the header are never turned away.
application/problem+jsonProblemDetails
429Too many calls in the window; Retry-After says how long.
application/problem+jsonProblemDetails
Hoder
Retry-After
— Seconds to wait when a rate limit answered or the server is down for maintenance, or an HTTP date when the household's AI is paused. Absent when the household's AI quota for the period is used up — that resets by itself.
503The server is down for maintenance (#4693). Retry-After says when to try again; problem type maintenance. Every call under /api answers this while maintenance mode is on, the version floor included.
application/problem+jsonProblemDetails
Hoder
Retry-After
— Seconds to wait when a rate limit answered or the server is down for maintenance, or an HTTP date when the household's AI is paused. Absent when the household's AI quota for the period is used up — that resets by itself.

Problemkoder

`code` i problemkroppen er den du forgreiner på. `detail` er engelsk, skrevet for loggen.

consent_required
— Bryti trenger et uttrykkelig ja før den kan lagre helseopplysninger. Det ja-et gir du på personens kort under Husholdning.

Eksempel

curl -b "bryti_session=…" \
  -X PATCH \
  "https://bryti.app/api/v1/households/3fa85f64-5717-4562-b3fc-2c963f66afa6/constraints/3fa85f64-5717-4562-b3fc-2c963f66afa6" \
  -H "Content-Type: application/json" \
  -d '{"kind":"Allergy","foodOrCategory":"string","severity":"Hard","notes":"string"}'

Eksempel på svar

200application/json
{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "householdId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "householdMemberId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "kind": "Allergy",
  "foodOrCategory": "string",
  "severity": "Hard",
  "notes": "string",
  "createdAt": "2026-09-07T16:30:00Z",
  "updatedAt": "2026-09-07T16:30:00Z",
  "foodKey": "string",
  "displayName": "string"
}
DELETE/api/v1/households/{householdId}/constraints/{constraintId}

Remove a dietary constraint

Adults only; a Junior member gets 403.

Parametre

NavnHvorTypePåkrevdBeskrivelse
householdIdpathstring (uuid)Påkrevd—
constraintIdpathstring (uuid)Påkrevd—

Svar

204No Content
401No session, or the session is no longer valid.
application/problem+jsonProblemDetails
404Not Found
application/problem+jsonProblemDetails
426The build named in X-App-Version is below its platform's version floor (ADR-070). Problem type app-version-unsupported; the only way forward is the store. Callers without the header are never turned away.
application/problem+jsonProblemDetails
429Too many calls in the window; Retry-After says how long.
application/problem+jsonProblemDetails
Hoder
Retry-After
— Seconds to wait when a rate limit answered or the server is down for maintenance, or an HTTP date when the household's AI is paused. Absent when the household's AI quota for the period is used up — that resets by itself.
503The server is down for maintenance (#4693). Retry-After says when to try again; problem type maintenance. Every call under /api answers this while maintenance mode is on, the version floor included.
application/problem+jsonProblemDetails
Hoder
Retry-After
— Seconds to wait when a rate limit answered or the server is down for maintenance, or an HTTP date when the household's AI is paused. Absent when the household's AI quota for the period is used up — that resets by itself.

Eksempel

curl -b "bryti_session=…" \
  -X DELETE \
  "https://bryti.app/api/v1/households/3fa85f64-5717-4562-b3fc-2c963f66afa6/constraints/3fa85f64-5717-4562-b3fc-2c963f66afa6"

Skjema

ConstraintSeverity

Type

Verdier

HardSoft

CreateDietaryConstraintRequest

FeltTypePåkrevd
householdMemberIdstring (uuid) | nullPåkrevd
kindDietaryConstraintKindPåkrevd
foodOrCategorystringPåkrevd
severityConstraintSeverityPåkrevd
notesstring | nullPåkrevd

DietaryConstraintKind

Type

Verdier

AllergyIntoleranceDietaryPatternAvoidance

DietaryConstraintResponse

FeltTypePåkrevd
idstring (uuid)Påkrevd
householdIdstring (uuid)Påkrevd
householdMemberIdstring (uuid) | nullPåkrevd
kindDietaryConstraintKindPåkrevd
foodOrCategorystringPåkrevd
severityConstraintSeverityPåkrevd
notesstring | nullPåkrevd
createdAtstring (date-time)Påkrevd
updatedAtstring (date-time)Påkrevd
foodKeystring | nullPåkrevd
displayNamestringPåkrevd

ProblemDetails

FeltTypePåkrevd
typestring | null—
titlestring | null—
statusinteger (int32) | null—
detailstring | null—
instancestring | null—
codestring | null—

UpdateDietaryConstraintRequest

FeltTypePåkrevd
kindDietaryConstraintKindPåkrevd
foodOrCategorystringPåkrevd
severityConstraintSeverityPåkrevd
notesstring | nullPåkrevd