openapi: 3.2.0 info: title: wger Nutritionplaninfo API version: 2.7.0a2 description: "Self hosted FLOSS workout and fitness tracker.\n\n## Authentication\n\nSystem-wide data such as the exercise database, ingredients and units can be\nread without authenticating. Everything tied to a user account needs one of the\nfollowing, which are tried in this order:\n\n* `Authorization: Token ` with a personal API key. Users create one on the\n API key page of their profile, e.g. `/en/user/api-key`.\n* `Authorization: Bearer ` with a JWT access token.\n* The session cookie, which is what a logged-in browser uses.\n\n## Pagination\n\nList endpoints take `limit` and `offset`, and answer with `count`, `next`,\n`previous` and `results`. The default page size is 20 and `limit` is capped\nat 999.\n\n`/api/v2/ingredient-sync/` is the exception. It uses cursor pagination so that\nsyncing the catalogue stays fast no matter how far a client has paginated. That\nresponse carries no `count`, and clients follow `next` instead of picking an\noffset.\n\n## Filtering and ordering\n\nMost list endpoints accept filters on a subset of their fields, plus `ordering`\nwith a field name that can be prefixed with `-` to reverse it. Both are listed\nper endpoint.\n\n## Unknown fields are dropped on write\n\nA field that the endpoint does not declare is ignored instead of rejected. Such\na request still answers 200 or 201, and the unknown field simply has no effect,\nso check a write against the response body rather than the status code.\n\n## Rate limits\n\nThe ingredient endpoints are rate limited because the catalogue holds millions\nof rows, and creating exercises is capped as well. Limits count per user for\nauthenticated callers and per IP otherwise. Exceeding one answers 429.\n" license: name: AGPL-3.0-or-later url: https://www.gnu.org/licenses/agpl-3.0.html servers: - url: / description: This server - url: https://wger.de description: The "official" upstream wger instance tags: - name: nutritionplaninfo description: The same plans read-only, with meals, items and their nutritional values expanded inline. Meant for external tools and integrations that want a whole plan in one request, with no IDs left to resolve. paths: /api/v2/nutritionplaninfo/: get: operationId: nutritionplaninfo_list description: 'Read-only info API endpoint for nutrition plan objects. Returns nested data structures for more easy parsing.' parameters: - in: query name: creation_date schema: type: string format: date - in: query name: description schema: type: string - in: query name: has_goal_calories schema: type: boolean - name: limit required: false in: query description: Number of results to return per page. schema: type: integer - name: offset required: false in: query description: The initial index from which to return the results. schema: type: integer - name: ordering required: false in: query description: Which field to use when ordering the results. schema: type: string tags: - nutritionplaninfo security: - cookieAuth: [] - tokenAuth: [] - headlessJwtAuth: [] - oidcAuth: [] - jwtAuth: [] responses: '200': content: application/json: schema: $ref: '#/components/schemas/PaginatedNutritionPlanInfoList' description: '' /api/v2/nutritionplaninfo/{id}/: get: operationId: nutritionplaninfo_retrieve description: 'Read-only info API endpoint for nutrition plan objects. Returns nested data structures for more easy parsing.' parameters: - in: path name: id schema: type: string format: uuid description: A UUID string identifying this nutrition plan. required: true tags: - nutritionplaninfo security: - cookieAuth: [] - tokenAuth: [] - headlessJwtAuth: [] - oidcAuth: [] - jwtAuth: [] responses: '200': content: application/json: schema: $ref: '#/components/schemas/NutritionPlanInfo' description: '' /api/v2/nutritionplaninfo/{id}/nutritional_values/: get: operationId: nutritionplaninfo_nutritional_values_retrieve description: Return an overview of the nutritional plan's values parameters: - in: path name: id schema: type: string format: uuid description: A UUID string identifying this nutrition plan. required: true tags: - nutritionplaninfo security: - cookieAuth: [] - tokenAuth: [] - headlessJwtAuth: [] - oidcAuth: [] - jwtAuth: [] responses: '200': content: application/json: schema: $ref: '#/components/schemas/NutritionalValues' description: '' components: schemas: NutritionPlanInfo: type: object description: Nutritional plan info serializer properties: id: type: string format: uuid creation_date: type: string format: date readOnly: true start: type: string format: date title: Start date end: type: - string - 'null' format: date title: End date description: type: string description: A description of the goal of the plan, e.g. "Gain mass" or "Prepare for summer" maxLength: 80 only_logging: type: boolean goal_energy: type: - integer - 'null' maximum: 2147483647 minimum: -2147483648 goal_protein: type: - integer - 'null' maximum: 2147483647 minimum: -2147483648 goal_carbohydrates: type: - integer - 'null' maximum: 2147483647 minimum: -2147483648 goal_fat: type: - integer - 'null' maximum: 2147483647 minimum: -2147483648 goal_fiber: type: - integer - 'null' maximum: 2147483647 minimum: -2147483648 meals: type: array items: $ref: '#/components/schemas/MealInfo' required: - creation_date - meals MealItemInfo: type: object description: Meal Item info serializer properties: id: type: string format: uuid meal: type: string format: uuid readOnly: true ingredient: type: integer readOnly: true ingredient_obj: allOf: - $ref: '#/components/schemas/IngredientInfo' readOnly: true weight_unit: type: integer readOnly: true weight_unit_obj: allOf: - $ref: '#/components/schemas/IngredientWeightUnit' readOnly: true image: allOf: - $ref: '#/components/schemas/IngredientImage' readOnly: true order: type: integer readOnly: true amount: type: string format: decimal pattern: ^-?\d{0,4}(?:\.\d{0,2})?$ required: - amount - image - ingredient - ingredient_obj - meal - order - weight_unit - weight_unit_obj MealInfo: type: object description: Meal info serializer properties: id: type: string format: uuid plan: type: string format: uuid readOnly: true order: type: integer readOnly: true time: type: - string - 'null' format: time title: Time (approx) name: type: string description: Give meals a textual description / name such as "Breakfast" or "after workout" maxLength: 25 meal_items: type: array items: $ref: '#/components/schemas/MealItemInfo' nutritional_values: allOf: - $ref: '#/components/schemas/NutritionalValues' readOnly: true required: - meal_items - nutritional_values - order - plan IngredientInfo: type: object description: Ingredient info serializer properties: id: type: integer readOnly: true uuid: type: string format: uuid readOnly: true remote_id: type: - string - 'null' maxLength: 200 source_name: type: - string - 'null' maxLength: 200 source_url: title: Link description: Link to product oneOf: - type: string format: uri maxLength: 200 - type: string maxLength: 0 code: type: - string - 'null' maxLength: 200 name: type: string maxLength: 200 minLength: 3 common_name: type: - string - 'null' maxLength: 200 brand: type: - string - 'null' title: Brand name of product maxLength: 200 created: type: string format: date-time readOnly: true title: Date last_update: type: string format: date-time readOnly: true title: Date last_imported: type: - string - 'null' format: date-time readOnly: true title: Date energy: type: integer maximum: 2147483647 minimum: -2147483648 description: In kcal per 100g protein: type: string format: decimal pattern: ^-?\d{0,3}(?:\.\d{0,3})?$ description: In g per 100g of product carbohydrates: type: string format: decimal pattern: ^-?\d{0,3}(?:\.\d{0,3})?$ description: In g per 100g of product carbohydrates_sugar: type: - string - 'null' format: decimal pattern: ^-?\d{0,3}(?:\.\d{0,3})?$ title: Sugar content in carbohydrates description: In g per 100g of product fat: type: string format: decimal pattern: ^-?\d{0,3}(?:\.\d{0,3})?$ description: In g per 100g of product fat_saturated: type: - string - 'null' format: decimal pattern: ^-?\d{0,3}(?:\.\d{0,3})?$ title: Saturated fat content in fats description: In g per 100g of product fiber: type: - string - 'null' format: decimal pattern: ^-?\d{0,3}(?:\.\d{0,3})?$ description: In g per 100g of product sodium: type: - string - 'null' format: decimal pattern: ^-?\d{0,3}(?:\.\d{0,3})?$ description: In g per 100g of product is_vegan: type: - boolean - 'null' title: Vegan description: Whether the ingredient is suitable for a vegan diet is_vegetarian: type: - boolean - 'null' title: Vegetarian description: Whether the ingredient is suitable for a vegetarian diet nutriscore: title: Nutri-Score description: 'Nutri-Score grade from Open Food Facts * `a` - A * `b` - B * `c` - C * `d` - D * `e` - E' oneOf: - $ref: '#/components/schemas/NutriscoreEnum' - $ref: '#/components/schemas/BlankEnum' - $ref: '#/components/schemas/NullEnum' weight_units: type: array items: $ref: '#/components/schemas/IngredientWeightUnit' language: allOf: - $ref: '#/components/schemas/Language' readOnly: true license: allOf: - $ref: '#/components/schemas/License' readOnly: true license_title: type: string title: The original title of this object, if available maxLength: 300 license_object_url: title: Link to original object, if available oneOf: - type: string format: uri maxLength: 200 - type: string maxLength: 0 license_author: type: string title: Author(s) description: If you are not the author, enter the name or source here. maxLength: 3500 license_author_url: title: Link to author profile, if available oneOf: - type: string format: uri maxLength: 200 - type: string maxLength: 0 license_derivative_source_url: title: Link to the original source, if this is a derivative work description: Note that a derivative work is one which is not only based on a previous work, but which also contains sufficient new, creative content to entitle it to its own copyright. oneOf: - type: string format: uri maxLength: 200 - type: string maxLength: 0 image: allOf: - $ref: '#/components/schemas/IngredientImage' readOnly: true thumbnails: allOf: - $ref: '#/components/schemas/Thumbnails' readOnly: true required: - carbohydrates - created - energy - fat - id - image - language - last_imported - last_update - license - name - protein - thumbnails - uuid - weight_units License: type: object description: License serializer properties: id: type: integer readOnly: true full_name: type: string description: If a license has been localized, e.g. the Creative Commons licenses for the different countries, add them as separate entries here. maxLength: 60 short_name: type: string title: Short name, e.g. CC-BY-SA 3 maxLength: 15 url: title: Link description: Link to license text or other information oneOf: - type: string format: uri maxLength: 200 - type: string maxLength: 0 required: - full_name - id - short_name BlankEnum: enum: - '' NullEnum: enum: - null IngredientImage: type: object description: Image serializer properties: id: type: integer readOnly: true uuid: type: string format: uuid readOnly: true ingredient_id: type: - integer - 'null' readOnly: true ingredient_uuid: type: string readOnly: true image: type: string format: uri description: Only PNG and JPEG formats are supported created: type: string format: date-time readOnly: true last_update: type: string format: date-time readOnly: true size: type: integer maximum: 2147483647 minimum: -2147483648 width: type: integer readOnly: true height: type: integer readOnly: true license: type: integer license_title: type: string title: The original title of this object, if available maxLength: 300 license_object_url: title: Link to original object, if available oneOf: - type: string format: uri maxLength: 200 - type: string maxLength: 0 license_author: type: string title: Author(s) description: If you are not the author, enter the name or source here. maxLength: 3500 license_author_url: title: Link to author profile, if available oneOf: - type: string format: uri maxLength: 200 - type: string maxLength: 0 license_derivative_source_url: title: Link to the original source, if this is a derivative work description: Note that a derivative work is one which is not only based on a previous work, but which also contains sufficient new, creative content to entitle it to its own copyright. oneOf: - type: string format: uri maxLength: 200 - type: string maxLength: 0 required: - created - height - id - image - ingredient_id - ingredient_uuid - last_update - size - uuid - width PaginatedNutritionPlanInfoList: type: object required: - count - results properties: count: type: integer example: 123 next: type: - string - 'null' format: uri example: http://api.example.org/accounts/?offset=400&limit=100 previous: type: - string - 'null' format: uri example: http://api.example.org/accounts/?offset=200&limit=100 results: type: array items: $ref: '#/components/schemas/NutritionPlanInfo' NutriscoreEnum: enum: - a - b - c - d - e type: string description: '* `a` - A * `b` - B * `c` - C * `d` - D * `e` - E' NutritionalValues: type: object description: Nutritional values serializer properties: energy: type: number format: double protein: type: number format: double carbohydrates: type: number format: double carbohydrates_sugar: type: - number - 'null' format: double fat: type: number format: double fat_saturated: type: - number - 'null' format: double fiber: type: - number - 'null' format: double sodium: type: - number - 'null' format: double required: - carbohydrates - carbohydrates_sugar - energy - fat - fat_saturated - fiber - protein - sodium IngredientWeightUnit: type: object description: IngredientWeightUnit serializer properties: id: type: integer readOnly: true uuid: type: string format: uuid readOnly: true ingredient: type: integer readOnly: true gram: type: integer maximum: 2147483647 minimum: -2147483648 title: Amount in grams name: type: string maxLength: 200 required: - gram - id - ingredient - name - uuid Language: type: object description: Language serializer properties: id: type: integer readOnly: true short_name: type: string title: Language short name description: ISO 639-1 maxLength: 2 full_name: type: string title: Language full name maxLength: 30 full_name_en: type: string title: Language full name in English maxLength: 30 required: - full_name - full_name_en - id - short_name Thumbnails: type: object description: 'Shape of the ``thumbnails`` field, used for schema generation only. The aliases are read from settings.THUMBNAIL_ALIASES and are the same for every thumbnailed image in the API. Without this, the generated schema falls back to a plain string for the dict the method fields return.' properties: small: type: string format: uri medium: type: string format: uri required: - medium - small securitySchemes: cookieAuth: type: apiKey in: cookie name: sessionid headlessJwtAuth: type: http scheme: bearer bearerFormat: JWT description: Access token issued by the allauth headless endpoints jwtAuth: type: http scheme: bearer bearerFormat: JWT oidcAuth: type: oauth2 description: Access token issued by the OAuth2/OIDC provider flows: authorizationCode: authorizationUrl: https://wger.de/identity/o/authorize tokenUrl: https://wger.de/identity/o/api/token scopes: api:read: View your training, nutrition and body data api:write: Add and change your training, nutrition and body data tokenAuth: type: apiKey in: header name: Authorization description: Token-based authentication with required prefix "Token" externalDocs: url: https://wger.readthedocs.io description: wger documentation