Foodvisor API - Vision

v1.0
Server
URL
https://vision.foodvisor.io/api/1.0/en
Authentication
Prefix Authorization header with Api-Key -> "Authorization: Api-Key YOUR_API_KEY"
Endpoints
POST
/analysis/
Perform an image analysis.

Request body
Required

scopes
Optional
array of
Optional list of scopes, defaults to your organization scopes
image
Required
string[binary]
The image to analyze, in jpg or png, via binary file upload. Max 2MB.

Responses

200
Analysis successful.
400
Request malformed.
403
Access forbidden.
404
Requested resource does not exist.
429
Maximum calls reached, or rate limit exceeded.
GET
/food/list/
Fetch Foodvisor's food list mapping.
No request body

Responses

200
Success
Content
array of
food_id
Required
string
Food unique identifier
display_name
Required
string
Localized food name.
GET
/limits/
Check how many calls you have left in the current period.
No request body

Responses

200
Success
Content
Schemas
Scope enum
A scope requested by client, returning corresponding data in API responses
enum[string]
multiple_items
position
nutrition:macro
nutrition:micro
nutrition:nutriscore
quantity
FVGrade enum
Foodvisor's equivalent of NutriScore, U being 'unknown'
enum[string]
A
B
C
D
U
FoodInfo object
Object holding all the data about a food.
food_id
Required
string
Food unique identifier
display_name
Required
string
Localized name of the food.
g_per_serving
Required
number[float]
Serving size in g.
fv_grade
Optional
FVGrade
NutriScore for this food. Requires scope `nutrition:nutriscore`.
nutrition
Optional
calories_100g
Required
number[float]
Calories quantity in 100g of food (in Cal)
proteins_100g
Optional
number[float]
Proteins quantity in 100g of food (in g)
fat_100g
Optional
number[float]
Fat quantity in 100g of food (in g)
carbs_100g
Optional
number[float]
Carbs quantity in 100g of food (in g)
fibers_100g
Optional
number[float]
Fibers quantity in 100g of food (in g)
alcohol_100g
Optional
number[float]
Alcohol quantity in 100g of food (in g)
calcium_100g
Optional
number[float]
Calcium quantity in 100g of food (in g)
chloride_100g
Optional
number[float]
Chloride quantity in 100g of food (in g)
cholesterol_100g
Optional
number[float]
Cholesterol quantity in 100g of food (in g)
copper_100g
Optional
number[float]
Copper quantity in 100g of food (in g)
glycemic_index
Optional
number[float]
Glycemic index
insat_fat_100g
Optional
number[float]
Insaturated fat quantity in 100g of food (in g)
iodine_100g
Optional
number[float]
Iodine quantity in 100g of food (in g)
iron_100g
Optional
number[float]
Iron quantity in 100g of food (in g)
magnesium_100g
Optional
number[float]
Magnesium quantity in 100g of food (in g)
manganese_100g
Optional
number[float]
Manganese quantity in 100g of food (in g)
mono_fat_100g
Optional
number[float]
Mono fat quantity in 100g of food (in g)
omega_3_100g
Optional
number[float]
Omega 3 quantity in 100g of food (in g)
omega_6_100g
Optional
number[float]
Omega 6 quantity in 100g of food (in g)
phosphorus_100g
Optional
number[float]
Phosphorus quantity in 100g of food (in g)
poly_fat_100g
Optional
number[float]
Poly fat quantity in 100g of food (in g)
polyols_100g
Optional
number[float]
Polyols quantity in 100g of food (in g)
potassium_100g
Optional
number[float]
Potassium quantity in 100g of food (in g)
salt_100g
Optional
number[float]
Salt quantity in 100g of food (in g)
sat_fat_100g
Optional
number[float]
Saturated fat quantity in 100g of food (in g)
selenium_100g
Optional
number[float]
Selenium quantity in 100g of food (in g)
sodium_100g
Optional
number[float]
Sodium quantity in 100g of food (in g)
sugars_100g
Optional
number[float]
Sugars quantity in 100g of food (in g)
veg_percent
Optional
number[float]
Vegetable percentage
vitamin_a_beta_k_100g
Optional
number[float]
Vitamin A beta K quantity in 100g of food (in g)
vitamin_a_retinol_100g
Optional
number[float]
Vitamin A retinol quantity in 100g of food (in g)
vitamin_b1_100g
Optional
number[float]
Vitamin B1 quantity in 100g of food (in g)
vitamin_b12_100g
Optional
number[float]
Vitamin B12 quantity in 100g of food (in g)
vitamin_b2_100g
Optional
number[float]
Vitamin B2 quantity in 100g of food (in g)
vitamin_b3_100g
Optional
number[float]
Vitamin B3 quantity in 100g of food (in g)
vitamin_b5_100g
Optional
number[float]
Vitamin B5 quantity in 100g of food (in g)
vitamin_b6_100g
Optional
number[float]
Vitamin B6 quantity in 100g of food (in g)
vitamin_b9_100g
Optional
number[float]
Vitamin B9 quantity in 100g of food (in g)
vitamin_c_100g
Optional
number[float]
Vitamin C quantity in 100g of food (in g)
vitamin_d_100g
Optional
number[float]
Vitamin D quantity in 100g of food (in g)
vitamin_e_100g
Optional
number[float]
Vitamin E quantity in 100g of food (in g)
vitamin_k1_100g
Optional
number[float]
Vitamin K1 quantity in 100g of food (in g)
water_100g
Optional
number[float]
Water quantity in 100g of food (in g)
zinc_100g
Optional
number[float]
Zinc quantity in 100g of food (in g)
All nutritional facts for the food.
{
  "food_id": "c4fd512774abbe73f98c23297266d988",
  "fv_grade": "B",
  "g_per_serving": 200,
  "display_name": "Mixed salad",
  "nutrition": {
    "alcohol_100g": 0,
    "calcium_100g": 0,
    "calories_100g": 0,
    "carbs_100g": 0,
    "chloride_100g": null,
    "cholesterol_100g": 0,
    "copper_100g": null,
    "fat_100g": null,
    "fibers_100g": 0,
    "glycemic_index": 15,
    "insat_fat_100g": 0,
    "iodine_100g": null,
    "iron_100g": 0,
    "magnesium_100g": 0,
    "manganese_100g": null,
    "mono_fat_100g": 0,
    "omega_3_100g": 0,
    "omega_6_100g": 0,
    "phosphorus_100g": 0,
    "poly_fat_100g": 0,
    "polyols_100g": null,
    "potassium_100g": 0,
    "proteins_100g": 0,
    "salt_100g": null,
    "sat_fat_100g": 0,
    "selenium_100g": null,
    "sodium_100g": 0,
    "sugars_100g": 0,
    "veg_percent": 0,
    "vitamin_a_beta_k_100g": null,
    "vitamin_a_retinol_100g": null,
    "vitamin_b12_100g": null,
    "vitamin_b1_100g": null,
    "vitamin_b2_100g": null,
    "vitamin_b3_100g": null,
    "vitamin_b5_100g": null,
    "vitamin_b6_100g": null,
    "vitamin_b9_100g": 0,
    "vitamin_c_100g": 0,
    "vitamin_d_100g": null,
    "vitamin_e_100g": null,
    "vitamin_k1_100g": null,
    "water_100g": null,
    "zinc_100g": null
  }
}
AnalysisResponse object
Main response object representing our analysis.
scopes
Required
array of
Scope requested during this analysis.
items
Required
array of
All the items the analysis found in the image. Require scope `multiple_items` to return more than one item.
{
  "analysis_id": "bc7409e3-b182-4bf2-a074-8bb0d4641c58",
  "scopes": [
    "multiple_items",
    "nutrition:macro",
    "nutrition:micro",
    "nutrition:nutriscore"
  ],
  "items": [
    "..."
  ]
}
AnalysisItem object
Object representing one item detected in your image.
position
Optional
AnalysisItemPosition
Position of the item in the image. Require scope `position`.
food
Required
array of
Food possibilites for this item.
{
  "position": {},
  "food": {}
}
AnalysisFood object
Object representing one possible food for a detected item.
confidence
Required
number[float]
Scoring of this food by our algorithm against the other possible food.
quantity
Optional
number[float]
Quantity estimation of this food. Requires scope `quantity`.
ingredients
Required
array of
List of ingredients contained in this food.
food_info
Required
{
  "confidence": 0.9986,
  "quantity": 140,
  "food_info": {},
  "ingredients": []
}
AnalysisItemPosition object
Object representing the position of a detected item in the image. Requires scope `position`.
x
Required
number[float]
Relative top left box corner X coordinate, between 0 and 1, (1 = image width).
y
Required
number[float]
Relative top left box corner Y coordinate, between 0 and 1, (1 = image height).
width
Required
number[float]
Relative box width, between 0 and 1, (1 = image width).
height
Required
number[float]
Relative box height, between 0 and 1, (1 = image height).
{
  "height": 0.4518,
  "width": 0.3346,
  "x": 0.2445,
  "y": 0.1405
}
Limits object
Object representing current API usage.
current
Required
integer
Current number of API calls made this month.
limit
Required
integer
Maximum number of API calls allowed this month.
renew_on
Required
string
Date when the limit will be reset.
{
  "analysis": {
    "current": 100,
    "limit": 100,
    "renew_on": "2023-05-01"
  }
}
Error object
Object representing an API error.
code
Required
string
Unique code identifier for this error
status_code
Required
integer
HTTP status code
detail
Required
string
Comprehensive error message.
{
  "detail": "Requested scopes do not exist : ['[\"test\"]']",
  "status_code": 404,
  "code": "scope_does_not_exist"
}
Responses
ScopeDoesNotExist
Requested scope does not exist.
Content
{
  "detail": "Requested scopes do not exist : ['[\"test\"]']",
  "status_code": 404,
  "code": "scope_does_not_exist"
}
ScopeNotGranted
Requested scope is not granted to your organization.
Content
{
  "detail": "Your organization does not have one requested scope.",
  "status_code": 403,
  "code": "scope_not_granted"
}
NotSupportedMIMEType
File uploaded format is not supported by our API.
Content
{
  "detail": "Image should be jpg or png.",
  "status_code": 400,
  "code": "not_supported_mime_type"
}
OrganizationForbidden
Your organiation does not have access to the requested resource.
Content
{
  "detail": "Your organization does not have access to this resource.",
  "status_code": 403,
  "code": "organization_forbidden"
}
OrganizationLimitExceeded
Your organiation has reached the maximum allowed calls.
Content
{
  "detail": "OrganizationLimitExceeded: Limit of 100 reached for analysis.",
  "status_code": 429,
  "code": "organization_limit_exceeded"
}
ThrottleError
You made too many calls too fast.
Content
{
  "detail": "Request was throttled. Expected available in 1 second.",
  "status_code": 429,
  "code": "throttled"
}