Nutrition AI API

Document image


Getting Started

1. Obtain an API key from the Spike Team. 2. Make HTTP requests to the API endpoint, including the necessary parameters. 3. Parse the JSON responses to extract and utilize the nutritional data within your application.

Postman Collection Example

JSON file provides an example to help you get started quickly. You can test it easily by importing it into Postman and running it with the sample image already set up:

Utilizing advanced image recognition and machine learning algorithms, the API identifies food items within an image and calculates their nutritional content.
POST
Request
Header Parameters
X-API-Key
required
String
Your authentication key for accessing the service, which you will obtain from the Spike Team.
Body Parameters
userUuid
required
String
A unique identifier for your end-user that you use internally within your application.
imageLink
required
String
A string containing the URL of the meal image. Use this parameter when your image is hosted online and accessible via a public URL. Ensure that the link points directly to the image file (e.g., ends with .jpg, .png). Either imageLink or imageBase64 is required in your request.
imageBase64
required
String
A string of the meal image encoded in Base64 format. Use this parameter to send the image directly within the request payload, without the need for external hosting. This is useful when you prefer not to expose the image publicly. Either imageBase64 or imageLink is required in your request.
config
optional
Object
Configurable parameters for each query.
EXAMPLES
Responses
200




Usage

Guidelines for End User

For Optimal Results:

  • Capture a photo of the food you plan to eat, centering on the contents of your plate.
  • Ensure the meal occupies the majority of the image for better recognition.
  • Take off any packaging or utensils before snapping the photo.
  • Keep the background clutter-free; include only your plate or glass without additional items.
  • Use natural or bright lighting to clearly capture details of the food.
  • Adjust the angle to minimize items obscuring each other and at a slight angle for the best perspective.
  • Avoid using filters or enhancements that might alter the food’s appearance.



Requirements & Errors Image Size

Minimum image size required: 512x512 pixel.

Errors


No Food Detected

Computer vision has not detected any food or drink in the provided image.

Errors


User ID not found

Bad Request, userUuid must be provided in String format. It is a unique identifier for your end-user that you use internally within your application.

Errors


Invalid API Key

No or wrong API key provided.

Errors


Missing or Incorrect Image URL

The imageLink must be an absolute URL that includes the full protocol (e.g., https://)

Errors




Measurement units

Curl




Response times

Response times can vary because the AI doesn’t always process images at the same speed. Even with the same photo, the system might take longer due to internal factors in how it analyzes the image and provides nutritional information. This means you might experience different wait times even when scanning the same meal.