{
  "openapi": "3.1.0",
  "info": {
    "title": "Pegboard Nutrition API",
    "version": "1.1.0",
    "description": "Initial read-only API. Requires an owner-issued expiring journal:read token. No mobile password sign-in, write endpoints, billing, or photo access is implemented by this contract. Decimals and IDs are strings."
  },
  "servers": [
    {
      "url": "https://pegboardnutrition.com/api/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/me": {
      "get": {
        "operationId": "getProfile",
        "summary": "Read minimal account settings.",
        "responses": {
          "200": {
            "description": "Owner-scoped result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Profile"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          }
        }
      }
    },
    "/journal": {
      "get": {
        "operationId": "getJournal",
        "summary": "Read six meal slots and precise daily totals without creating records.",
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Defaults to the current calendar date in the owner's saved time zone, or UTC."
          }
        ],
        "responses": {
          "200": {
            "description": "Owner-scoped result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Journal"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          }
        }
      }
    },
    "/macro_goal": {
      "get": {
        "operationId": "getMacroGoal",
        "summary": "Read targets, or null if none are saved.",
        "responses": {
          "200": {
            "description": "Owner-scoped result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Targets"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          }
        }
      }
    },
    "/food_logs": {
      "get": {
        "operationId": "listFoodLogs",
        "summary": "List owned records ordered by logged_on descending, then ID descending.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000,
              "default": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 30
            }
          },
          {
            "name": "logged_on",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Owner-scoped result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Food"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          }
        }
      }
    },
    "/food_logs/{id}": {
      "get": {
        "operationId": "getFood",
        "summary": "Read one owned food entry.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Owner-scoped result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Food"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          }
        }
      }
    },
    "/weight_entries": {
      "get": {
        "operationId": "listWeightEntries",
        "summary": "List owned records ordered by logged_on descending, then ID descending.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000,
              "default": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Owner-scoped result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Weight"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          }
        }
      }
    },
    "/weight_entries/{id}": {
      "get": {
        "operationId": "getWeight",
        "summary": "Read one owned weight entry in pounds.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Owner-scoped result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Weight"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          }
        }
      }
    },
    "/body_measurements": {
      "get": {
        "operationId": "listBodyMeasurements",
        "summary": "List owned records ordered by logged_on descending, then ID descending.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000,
              "default": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Owner-scoped result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Measurement"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          }
        }
      }
    },
    "/body_measurements/{id}": {
      "get": {
        "operationId": "getMeasurement",
        "summary": "Read one owned body measurement in its original unit.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Owner-scoped result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Measurement"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          }
        }
      }
    },
    "/food_library": {
      "get": {
        "operationId": "searchReferenceFoods",
        "summary": "Search reviewed USDA foods; journal:read required. Empty query returns 12 suggestions, nonempty query at most 60 matches, not a paginated complete catalog.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Prefix tokens, case insensitive. One-character searches return no matches."
          }
        ],
        "responses": {
          "200": {
            "description": "Read-only food preview; never creates journal entries.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "maxItems": 60,
                      "items": {
                        "$ref": "#/components/schemas/ReferenceFood"
                      }
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "catalog_version": {
                          "type": "integer"
                        },
                        "source": {
                          "type": "string"
                        },
                        "source_verified_on": {
                          "type": "string",
                          "format": "date"
                        },
                        "total_count": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "returned_count": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 60
                        }
                      },
                      "required": [
                        "catalog_version",
                        "source",
                        "source_verified_on",
                        "total_count",
                        "returned_count"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "metadata"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          }
        }
      }
    },
    "/barcode_lookup": {
      "get": {
        "operationId": "lookupBarcode",
        "summary": "Look up one Open Food Facts preview; journal:read required. Additional limit: 30/minute/IP.",
        "parameters": [
          {
            "name": "barcode",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^(?:[0-9]{8}|[0-9]{12,14})$"
            },
            "description": "ASCII digits only, preserving leading zeros. No URL or image is accepted."
          }
        ],
        "responses": {
          "200": {
            "description": "Read-only food preview; never creates journal entries.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/BarcodeProduct"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "description": "product_not_found: barcode absent from Open Food Facts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/Error422"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Create a token in Profile → API access. Supply only in the Authorization header. Browser cookies and query-string credentials are not accepted."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "Profile": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "username": {
            "type": "string"
          },
          "time_zone": {
            "type": "string"
          },
          "measurement_unit": {
            "type": "string",
            "enum": [
              "in",
              "cm"
            ]
          },
          "scope": {
            "type": "string",
            "const": "journal:read"
          }
        },
        "required": [
          "id",
          "username",
          "time_zone",
          "measurement_unit",
          "scope"
        ],
        "additionalProperties": false
      },
      "Totals": {
        "type": "object",
        "properties": {
          "protein": {
            "type": "string",
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "carbs": {
            "type": "string",
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "fat": {
            "type": "string",
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "calories": {
            "type": "integer"
          }
        },
        "required": [
          "protein",
          "carbs",
          "fat",
          "calories"
        ],
        "additionalProperties": false
      },
      "Food": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "logged_on": {
            "type": "string",
            "format": "date"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "meal_position": {
            "type": "integer",
            "minimum": 1,
            "maximum": 6
          },
          "protein": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "carbs": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "fat": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "calories": {
            "type": "integer"
          },
          "calculated_calories": {
            "type": "integer"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "logged_on",
          "name",
          "meal_position",
          "protein",
          "carbs",
          "fat",
          "calories",
          "calculated_calories",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "Weight": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "logged_on": {
            "type": "string",
            "format": "date"
          },
          "weight": {
            "type": "string",
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "unit": {
            "type": "string",
            "const": "lb"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "logged_on",
          "weight",
          "unit",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "Measurement": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "logged_on": {
            "type": "string",
            "format": "date"
          },
          "unit": {
            "type": "string",
            "enum": [
              "in",
              "cm"
            ]
          },
          "neck": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "chest": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "bicep": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "waist": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "hips": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "thigh": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "calves": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?[0-9]+(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; parse with decimal arithmetic, not binary floating point."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "logged_on",
          "unit",
          "neck",
          "chest",
          "bicep",
          "waist",
          "hips",
          "thigh",
          "calves",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "Targets": {
        "type": "object",
        "properties": {
          "protein": {
            "type": "integer"
          },
          "carbs": {
            "type": "integer"
          },
          "fat": {
            "type": "integer"
          },
          "calories": {
            "type": "integer"
          }
        },
        "required": [
          "protein",
          "carbs",
          "fat",
          "calories"
        ],
        "additionalProperties": false
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "per_page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "has_more": {
            "type": "boolean"
          },
          "next_page": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "page",
          "per_page",
          "has_more",
          "next_page"
        ],
        "additionalProperties": false
      },
      "Journal": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "time_zone": {
            "type": "string"
          },
          "targets": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Targets"
              },
              {
                "type": "null"
              }
            ]
          },
          "totals": {
            "$ref": "#/components/schemas/Totals"
          },
          "meals": {
            "type": "array",
            "minItems": 6,
            "maxItems": 6,
            "items": {
              "type": "object",
              "properties": {
                "position": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 6
                },
                "name": {
                  "type": "string"
                },
                "totals": {
                  "$ref": "#/components/schemas/Totals"
                },
                "food_logs": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Food"
                  }
                }
              },
              "required": [
                "position",
                "name",
                "totals",
                "food_logs"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "date",
          "time_zone",
          "targets",
          "totals",
          "meals"
        ],
        "additionalProperties": false
      },
      "ReferenceFood": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "group_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "emoji": {
            "type": "string"
          },
          "preparation": {
            "type": "string"
          },
          "log_name": {
            "type": "string"
          },
          "detail_name": {
            "type": "string"
          },
          "per_100": {
            "type": "object",
            "properties": {
              "protein": {
                "type": "string",
                "pattern": "^[0-9]+(?:\\.[0-9]+)?$"
              },
              "carbs": {
                "type": "string",
                "pattern": "^[0-9]+(?:\\.[0-9]+)?$"
              },
              "fat": {
                "type": "string",
                "pattern": "^[0-9]+(?:\\.[0-9]+)?$"
              }
            },
            "required": [
              "protein",
              "carbs",
              "fat"
            ],
            "additionalProperties": false
          },
          "unit": {
            "type": "string",
            "enum": [
              "g",
              "ml"
            ]
          },
          "unit_inferred": {
            "type": "boolean"
          },
          "serving_quantity": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[0-9]+(?:\\.[0-9]+)?$"
          },
          "serving_unit": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "g",
              "ml",
              null
            ]
          },
          "serving_label": {
            "type": "string"
          },
          "source_url": {
            "type": "string",
            "format": "uri"
          },
          "servings": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "grams": {
                  "type": "string",
                  "pattern": "^[0-9]+(?:\\.[0-9]+)?$"
                }
              },
              "required": [
                "id",
                "label",
                "grams"
              ],
              "additionalProperties": false
            }
          },
          "default_serving_id": {
            "type": "string"
          },
          "portion_note": {
            "type": "string"
          },
          "source_name": {
            "type": "string"
          },
          "source_description": {
            "type": "string"
          },
          "source_verified_on": {
            "type": "string",
            "format": "date"
          }
        },
        "required": [
          "id",
          "group_id",
          "name",
          "emoji",
          "preparation",
          "log_name",
          "detail_name",
          "per_100",
          "unit",
          "unit_inferred",
          "serving_quantity",
          "serving_unit",
          "serving_label",
          "source_url",
          "servings",
          "default_serving_id",
          "portion_note",
          "source_name",
          "source_description",
          "source_verified_on"
        ],
        "additionalProperties": false
      },
      "BarcodeProduct": {
        "type": "object",
        "properties": {
          "barcode": {
            "type": "string",
            "pattern": "^(?:[0-9]{8}|[0-9]{12,14})$"
          },
          "name": {
            "type": "string"
          },
          "per_100": {
            "type": "object",
            "properties": {
              "protein": {
                "type": "string",
                "pattern": "^[0-9]+(?:\\.[0-9]+)?$"
              },
              "carbs": {
                "type": "string",
                "pattern": "^[0-9]+(?:\\.[0-9]+)?$"
              },
              "fat": {
                "type": "string",
                "pattern": "^[0-9]+(?:\\.[0-9]+)?$"
              },
              "calories": {
                "type": "string",
                "pattern": "^[0-9]+(?:\\.[0-9]+)?$"
              }
            },
            "required": [
              "protein",
              "carbs",
              "fat",
              "calories"
            ],
            "additionalProperties": false
          },
          "unit": {
            "type": "string",
            "enum": [
              "g",
              "ml"
            ]
          },
          "unit_inferred": {
            "type": "boolean"
          },
          "serving_quantity": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[0-9]+(?:\\.[0-9]+)?$"
          },
          "serving_unit": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "g",
              "ml",
              null
            ]
          },
          "serving_label": {
            "type": "string"
          },
          "source_url": {
            "type": "string",
            "format": "uri"
          },
          "calories_derived": {
            "type": "boolean"
          }
        },
        "required": [
          "barcode",
          "name",
          "per_100",
          "unit",
          "unit_inferred",
          "serving_quantity",
          "serving_unit",
          "serving_label",
          "source_url",
          "calories_derived"
        ],
        "additionalProperties": false
      }
    },
    "responses": {
      "Error400": {
        "description": "Invalid date or pagination parameter.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error401": {
        "description": "Missing, unknown, expired, or revoked bearer token.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "Error402": {
        "description": "Membership required when the existing rollout policy is enforced.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error403": {
        "description": "Token does not allow journal reads.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error404": {
        "description": "Record does not exist or is not owned by this account.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error429": {
        "description": "Shared per-IP API rate limit exceeded.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "string",
              "const": "60"
            }
          }
        }
      },
      "Error422": {
        "description": "incomplete_nutrition: enter the label manually.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error503": {
        "description": "food_database_unavailable: transient upstream failure; retry with backoff.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "string",
              "const": "60"
            }
          }
        }
      }
    }
  }
}
