FoodData Central at https://api.nal.usda.gov/fdc/v1 is the USDA's nutrient database for branded and generic foods. It uses api.data.gov keys; DEMO_KEY works for trying it.
Get a free api.data.gov key at fdc.nal.usda.gov and pass it as api_key. DEMO_KEY has a low hourly limit.
Full reference: https://fdc.nal.usda.gov/api-guide
curl "https://api.nal.usda.gov/fdc/v1/foods/search?query=apple&pageSize=1&api_key=DEMO_KEY"
{
"totalHits": 25775,
"currentPage": 1,
"totalPages": 25775,
"pageList": [
1,
2
],
"foodSearchCriteria": {
"query": "apple",
"generalSearchInput": "apple",
"pageNumber": 1,
"numberOfResultsPerPage": 50,
"pageSize": 1,
"requireAllWords": false
},
"foods": [
{
"fdcId": 454004,
"description": "APPLE",
"dataType": "Branded",
"gtinUpc": "867824000001",
"publishedDate": "2019-04-01",
"brandOwner": "TREECRISP 2 GO",
"ingredients": "CRISP APPLE.",
"marketCountry": "United States",
"foodCategory": "Pre-Packaged Fruit & Vegetables",
"modifiedDate": "2017-07-14",
"dataSource": "LI",
"servingSizeUnit": "g",
"servingSize": 154,
"householdServingFullText": "5.5 ONZ",
"tradeChannels": [
"NO_TRADE_CHANNEL"
]
}
],
"aggregations": {
"dataType": {
"Branded": 25638,
"SR Legacy": 89,
"Survey (FNDDS)": 42,
"Foundation": 6
},
"nutrients": {}
}
}