curl --request GET \
--url https://api.withflex.com/v1/product_components \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.withflex.com/v1/product_components"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.withflex.com/v1/product_components', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.withflex.com/v1/product_components",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.withflex.com/v1/product_components"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.withflex.com/v1/product_components")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withflex.com/v1/product_components")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"product_components": [
{
"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"
}
]
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}{
"code": "string",
"detail": "string"
}List Product Components
Returns the product components you have registered, newest first.
Only components you have recorded nutrition for are listed: the underlying name table is shared across accounts, so listing it would return tens of thousands of rows that belong to nobody.
Results are paginated — the default limit is 10, so reading back a full menu
takes several requests. Pass the last object’s component_nutrition_id as
starting_after to fetch the next page, and keep going until a page comes back
shorter than your limit.
Rather than paging the whole catalogue to find one ingredient, filter it:
client_reference_id returns the single component carrying your own identifier,
name matches the shared component name case-insensitively, and category and
canonical_food_key narrow by those fields. Metadata is filtered with
metadata[key]=value, with multiple keys AND-ed. Filters combine with each other
and with the pagination cursors.
curl --request GET \
--url https://api.withflex.com/v1/product_components \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.withflex.com/v1/product_components"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.withflex.com/v1/product_components', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.withflex.com/v1/product_components",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.withflex.com/v1/product_components"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.withflex.com/v1/product_components")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withflex.com/v1/product_components")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"product_components": [
{
"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"
}
]
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}{
"code": "string",
"detail": "string"
}Authorizations
Use a Bearer token to access this API.
Query Parameters
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
1 <= x <= 100Number of objects to skip before returning results.
0 <= x <= 9007199254740991A cursor for use in pagination. starting_after is a component_nutrition_id that defines your place in the list — pass the one from the last object of the previous page to fetch the next.
"fcn_01J9XR8M3K7VZ8N2YB4WJ6T0RA"
A cursor for use in pagination. ending_before is a component_nutrition_id that defines your place in the list.
"fcn_01J9XR8M3K7VZ8N2YB4WJ6T0RA"
Only return the component carrying this client_reference_id. The value is unique within your account and mode, so this returns at most one component — it is the direct answer to "have I registered this ingredient already?".
"example_value"
Only return components in this menu category.
base, protein, topping, premium, dressing "base"
Only return components carrying this price-book join key.
Only return components with this name, matched case-insensitively. Names are shared across accounts, so this is the dedupe lookup for a component you have no id for.
Filter by metadata key-value pairs using bracket syntax. For example: metadata[lookup_key]=premium-plan. Multiple keys use AND logic.
Show child attributes
Show child attributes
{ "lookup_key": "premium-plan" }
Response
An envelope wrapping a list of product component objects.
An envelope wrapping a list of product component objects.
The list of product components.
Show child attributes
Show child attributes