Products

Update Product Component

Changed on

Updates your nutrition for a product component. Only the fields you supply are changed.

The component's name cannot be changed — the name row is shared with every other account that registered the same ingredient. Use clear to reset a value to "not supplied"; omitting a field means "leave unchanged", so omission cannot express erasure.

metadata is the one field that merges rather than replaces: the keys you send are added or overwritten and the rest are left alone, so removing a key means clear: ["metadata"]. Moving a client_reference_id onto this component when another of your components in this mode already carries that value returns 409.

patch/v1/product_components/{id}

Request

  • Base URL
    https://api.withflex.com
  • URL
    https://api.withflex.com/v1/product_components/{id}
  • Auth
    HTTP bearer

Path parameters

idstring required

The component's fcomp_ identifier.

Example:fcomp_01J9XR8M3K7VZ8N2YB4WJ6T0RA

Request body

Example request

{
  "product_component": {
    "category": "base",
    "nutrition_basis": "per_100g",
    "serving_size_g": 0,
    "nutrition": {
      "calories": 0,
      "total_fat_g": 0,
      "saturated_fat_g": 0,
      "trans_fat_g": 0,
      "carbohydrate_g": 0,
      "fiber_g": 0,
      "protein_g": 0,
      "sodium_mg": 0,
      "added_sugar_g": 0
    },
    "vegan": true,
    "gluten_free": true,
    "canonical_food_key": "string",
    "client_reference_id": "example_value",
    "metadata": {
      "order_id": "8842",
      "channel": "shopify"
    },
    "clear": [
      "serving_size_g"
    ]
  }
}

Response

An envelope wrapping a single product component object.

Example response

{
  "product_component": {
    "component_id": "fcomp_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
    "component_nutrition_id": "fcn_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
    "name": "string",
    "shared": true,
    "test_mode": true,
    "category": "string",
    "serving_size_g": 0,
    "nutrition": {
      "calories": 0,
      "total_fat_g": 0,
      "saturated_fat_g": 0,
      "trans_fat_g": 0,
      "carbohydrate_g": 0,
      "fiber_g": 0,
      "protein_g": 0,
      "sodium_mg": 0,
      "added_sugar_g": 0
    },
    "vegan": true,
    "gluten_free": true,
    "canonical_food_key": "string",
    "client_reference_id": "string",
    "metadata": {},
    "created_at": "string",
    "updated_at": "string"
  }
}

Changes