Skip to main content
Analyze Nutrition Image
curl --request POST \
  --url https://app-api.spikeapi.com/v3/nutrition_records/image \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "analysis_mode": "precise",
  "body": "<string>",
  "body_url": "<string>",
  "consumed": true,
  "consumed_at": "2023-11-07T05:31:56Z",
  "country_code": "us",
  "include_dish_description": false,
  "include_ingredients": false,
  "include_nutri_score": false,
  "include_nutrition_fields": [
    "carbohydrate_g",
    "energy_kcal",
    "fat_total_g",
    "protein_g"
  ],
  "language_code": "en",
  "user_time_offset_minutes": 0,
  "wait_on_process": false
}
'
import requests

url = "https://app-api.spikeapi.com/v3/nutrition_records/image"

payload = {
"analysis_mode": "precise",
"body": "<string>",
"body_url": "<string>",
"consumed": True,
"consumed_at": "2023-11-07T05:31:56Z",
"country_code": "us",
"include_dish_description": False,
"include_ingredients": False,
"include_nutri_score": False,
"include_nutrition_fields": ["carbohydrate_g", "energy_kcal", "fat_total_g", "protein_g"],
"language_code": "en",
"user_time_offset_minutes": 0,
"wait_on_process": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
analysis_mode: 'precise',
body: JSON.stringify('<string>'),
body_url: '<string>',
consumed: true,
consumed_at: '2023-11-07T05:31:56Z',
country_code: 'us',
include_dish_description: false,
include_ingredients: false,
include_nutri_score: false,
include_nutrition_fields: ['carbohydrate_g', 'energy_kcal', 'fat_total_g', 'protein_g'],
language_code: 'en',
user_time_offset_minutes: 0,
wait_on_process: false
})
};

fetch('https://app-api.spikeapi.com/v3/nutrition_records/image', 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://app-api.spikeapi.com/v3/nutrition_records/image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'analysis_mode' => 'precise',
'body' => '<string>',
'body_url' => '<string>',
'consumed' => true,
'consumed_at' => '2023-11-07T05:31:56Z',
'country_code' => 'us',
'include_dish_description' => false,
'include_ingredients' => false,
'include_nutri_score' => false,
'include_nutrition_fields' => [
'carbohydrate_g',
'energy_kcal',
'fat_total_g',
'protein_g'
],
'language_code' => 'en',
'user_time_offset_minutes' => 0,
'wait_on_process' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://app-api.spikeapi.com/v3/nutrition_records/image"

payload := strings.NewReader("{\n \"analysis_mode\": \"precise\",\n \"body\": \"<string>\",\n \"body_url\": \"<string>\",\n \"consumed\": true,\n \"consumed_at\": \"2023-11-07T05:31:56Z\",\n \"country_code\": \"us\",\n \"include_dish_description\": false,\n \"include_ingredients\": false,\n \"include_nutri_score\": false,\n \"include_nutrition_fields\": [\n \"carbohydrate_g\",\n \"energy_kcal\",\n \"fat_total_g\",\n \"protein_g\"\n ],\n \"language_code\": \"en\",\n \"user_time_offset_minutes\": 0,\n \"wait_on_process\": false\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://app-api.spikeapi.com/v3/nutrition_records/image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"analysis_mode\": \"precise\",\n \"body\": \"<string>\",\n \"body_url\": \"<string>\",\n \"consumed\": true,\n \"consumed_at\": \"2023-11-07T05:31:56Z\",\n \"country_code\": \"us\",\n \"include_dish_description\": false,\n \"include_ingredients\": false,\n \"include_nutri_score\": false,\n \"include_nutrition_fields\": [\n \"carbohydrate_g\",\n \"energy_kcal\",\n \"fat_total_g\",\n \"protein_g\"\n ],\n \"language_code\": \"en\",\n \"user_time_offset_minutes\": 0,\n \"wait_on_process\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://app-api.spikeapi.com/v3/nutrition_records/image")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"analysis_mode\": \"precise\",\n \"body\": \"<string>\",\n \"body_url\": \"<string>\",\n \"consumed\": true,\n \"consumed_at\": \"2023-11-07T05:31:56Z\",\n \"country_code\": \"us\",\n \"include_dish_description\": false,\n \"include_ingredients\": false,\n \"include_nutri_score\": false,\n \"include_nutrition_fields\": [\n \"carbohydrate_g\",\n \"energy_kcal\",\n \"fat_total_g\",\n \"protein_g\"\n ],\n \"language_code\": \"en\",\n \"user_time_offset_minutes\": 0,\n \"wait_on_process\": false\n}"

response = http.request(request)
puts response.read_body
{
  "dish_name": "<string>",
  "serving_size": 1.01,
  "consumed_at": "2023-11-07T05:31:56Z",
  "dish_description": "<string>",
  "dish_description_translated": "<string>",
  "dish_name_translated": "<string>",
  "failure_reason": "<string>",
  "ingredients": [
    {
      "name": "<string>",
      "serving_size": 123,
      "name_translated": "<string>",
      "nutritional_fields": {
        "calcium_mg": 123,
        "carbohydrate_g": 123,
        "cholesterol_mg": 123,
        "energy_kcal": 123,
        "fat_monounsaturated_g": 123,
        "fat_polyunsaturated_g": 123,
        "fat_saturated_g": 123,
        "fat_total_g": 123,
        "fat_trans_g": 123,
        "fiber_total_dietary_g": 123,
        "folate_mcg": 123,
        "iron_mg": 123,
        "magnesium_mg": 123,
        "manganese_mcg": 123,
        "niacin_mg": 123,
        "phosphorus_mg": 123,
        "potassium_mg": 123,
        "protein_g": 123,
        "riboflavin_mg": 123,
        "salt_g": 123,
        "salt_mg": 123,
        "sodium_g": 123,
        "sodium_mg": 123,
        "sugars_total_g": 123,
        "thiamin_mg": 123,
        "vitamin_a_rae_mcg": 123,
        "vitamin_b12_mcg": 123,
        "vitamin_b6_mg": 123,
        "vitamin_c_mg": 123,
        "vitamin_d_mcg": 123,
        "vitamin_e_mg": 123,
        "vitamin_k_mcg": 123,
        "zinc_mg": 123
      }
    }
  ],
  "modified_at": "2023-11-07T05:31:56Z",
  "nutri_score": "<string>",
  "nutritional_fields": {
    "calcium_mg": 123,
    "carbohydrate_g": 123,
    "cholesterol_mg": 123,
    "energy_kcal": 123,
    "fat_monounsaturated_g": 123,
    "fat_polyunsaturated_g": 123,
    "fat_saturated_g": 123,
    "fat_total_g": 123,
    "fat_trans_g": 123,
    "fiber_total_dietary_g": 123,
    "folate_mcg": 123,
    "iron_mg": 123,
    "magnesium_mg": 123,
    "manganese_mcg": 123,
    "niacin_mg": 123,
    "phosphorus_mg": 123,
    "potassium_mg": 123,
    "protein_g": 123,
    "riboflavin_mg": 123,
    "salt_g": 123,
    "salt_mg": 123,
    "sodium_g": 123,
    "sodium_mg": 123,
    "sugars_total_g": 123,
    "thiamin_mg": 123,
    "vitamin_a_rae_mcg": 123,
    "vitamin_b12_mcg": 123,
    "vitamin_b6_mg": 123,
    "vitamin_c_mg": 123,
    "vitamin_d_mcg": 123,
    "vitamin_e_mg": 123,
    "vitamin_k_mcg": 123,
    "zinc_mg": 123
  },
  "record_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "uploaded_at": "2023-11-07T05:31:56Z",
  "user_time_offset_minutes": 123
}
{
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}
{
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}
{
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}
{
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}
{
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
analysis_mode
enum<string>
default:precise

A preferred mode for the analysis

Available options:
fast,
precise
body
string

Base64-encoded binary data, this or 'body_url' is required

body_url
string

URL to the image, this or 'body' is required

consumed
boolean
default:true

Whether to save the record (true) or only analyze (false)

consumed_at
string<date-time>

The UTC time when food was consumed. By default, it is set to the upload time

Examples:

"2006-01-02T15:04:05"

"2006-01-02T15:04:05Z"

country_code
enum<string>
default:us

Country ISO 3166-1 alpha-2 code in lowercase

Available options:
af,
al,
dz,
ad,
ao,
ag,
ar,
am,
au,
at,
az,
bs,
bh,
bd,
bb,
by,
be,
bz,
bj,
bt,
bo,
ba,
bw,
br,
bn,
bg,
bf,
bi,
cv,
kh,
cm,
ca,
cf,
td,
cl,
cn,
co,
km,
cg,
cd,
cr,
ci,
hr,
cu,
cy,
cz,
dk,
dj,
dm,
do,
ec,
eg,
sv,
gq,
er,
ee,
sz,
et,
fj,
fi,
fr,
ga,
gm,
ge,
de,
gh,
gr,
gd,
gt,
gn,
gw,
gy,
ht,
hn,
hu,
is,
in,
id,
ir,
iq,
ie,
il,
it,
jm,
jp,
jo,
kz,
ke,
ki,
kp,
kr,
kw,
kg,
la,
lv,
lb,
ls,
lr,
ly,
li,
lt,
lu,
mg,
mw,
my,
mv,
ml,
mt,
mh,
mr,
mu,
mx,
fm,
md,
mc,
mn,
me,
ma,
mz,
mm,
na,
nr,
np,
nl,
nz,
ni,
ne,
ng,
mk,
no,
om,
pk,
pw,
pa,
pg,
py,
pe,
ph,
pl,
pt,
qa,
ro,
ru,
rw,
kn,
lc,
vc,
ws,
sm,
st,
sa,
sn,
rs,
sc,
sl,
sg,
sk,
si,
sb,
so,
za,
ss,
es,
lk,
sd,
sr,
se,
ch,
sy,
tj,
tz,
th,
tl,
tg,
to,
tt,
tn,
tr,
tm,
tv,
ug,
ua,
ae,
gb,
us,
uy,
uz,
vu,
ve,
vn,
ye,
zm,
zw
include_dish_description
boolean
default:false

Include dish description of the food

Example:

true

include_ingredients
boolean
default:false

Include ingredients of the food

Example:

true

include_nutri_score
boolean
default:false

Include nutri-score label of the food

include_nutrition_fields
enum<string>[]

Include specific nutrition fields in the analysis report. By default, carbohydrate_g, energy_kcal, fat_total_g and protein_g will be included

Available options:
energy_kcal,
carbohydrate_g,
protein_g,
fat_total_g,
fat_saturated_g,
fat_polyunsaturated_g,
fat_monounsaturated_g,
fat_trans_g,
fiber_total_dietary_g,
sugars_total_g,
cholesterol_mg,
sodium_mg,
potassium_mg,
calcium_mg,
iron_mg,
magnesium_mg,
phosphorus_mg,
zinc_mg,
vitamin_a_rae_mcg,
vitamin_c_mg,
vitamin_d_mcg,
vitamin_e_mg,
vitamin_k_mcg,
thiamin_mg,
riboflavin_mg,
niacin_mg,
vitamin_b6_mg,
folate_mcg,
vitamin_b12_mcg,
sodium_g,
salt_mg,
salt_g,
manganese_mcg
language_code
enum<string>
default:en

Language ISO 639-1 code in lowercase

Available options:
aa,
ab,
ae,
af,
ak,
am,
an,
ar,
as,
av,
ay,
az,
ba,
be,
bg,
bh,
bi,
bm,
bn,
bo,
br,
bs,
ca,
ce,
ch,
co,
cr,
cs,
cu,
cv,
cy,
da,
de,
dv,
dz,
ee,
el,
en,
eo,
es,
et,
eu,
fa,
ff,
fi,
fj,
fo,
fr,
fy,
ga,
gd,
gl,
gn,
gu,
gv,
ha,
he,
hi,
ho,
hr,
ht,
hu,
hy,
hz,
ia,
id,
ie,
ig,
ii,
ik,
io,
is,
it,
iu,
ja,
jv,
ka,
kg,
ki,
kj,
kk,
kl,
km,
kn,
ko,
kr,
ks,
ku,
kv,
kw,
ky,
la,
lb,
lg,
li,
ln,
lo,
lt,
lu,
lv,
mg,
mh,
mi,
mk,
ml,
mn,
mr,
ms,
mt,
my,
na,
nb,
nd,
ne,
ng,
nl,
nn,
no,
nr,
nv,
ny,
oc,
oj,
om,
or,
os,
pa,
pi,
pl,
ps,
pt,
qu,
rm,
rn,
ro,
ru,
rw,
sa,
sc,
sd,
se,
sg,
si,
sk,
sl,
sm,
sn,
so,
sq,
sr,
ss,
st,
su,
sv,
sw,
ta,
te,
tg,
th,
ti,
tk,
tl,
tn,
to,
tr,
ts,
tt,
tw,
ty,
ug,
uk,
ur,
uz,
ve,
vi,
vo,
wa,
wo,
xh,
yi,
yo,
za,
zh,
zu
Example:

"de"

user_time_offset_minutes
integer<int32>
default:0

User's local timezone offset in minutes

Example:

-540

wait_on_process
boolean
default:false

If true, waits for the process to complete. If false, returns immediate response and sends notification with analysis report to webhook URL when finished

Response

OK

dish_name
string
required

Detected dish name

Example:

"beef and broccoli stir-fry"

serving_size
number<double>
required

Serving size in metric units

Required range: x >= 0.01
Example:

120

unit
enum<string>
required

Metric unit (g for solids, ml for liquids)

Available options:
g,
mg,
mcg,
ml,
kcal
Example:

"g"

consumed_at
string<date-time>

The UTC time when food was consumed. By default, it is set to the record update time

Examples:

"2006-01-02T15:04:05"

"2006-01-02T15:04:05Z"

dish_description
string

Detected dish description

Example:

"beef, ground, lean, cooked with broccoli, raw and rice, brown, cooked"

dish_description_translated
string

Dish description translated to target language

Example:

"Rindfleisch, Hackfleisch, mager, gekocht mit Brokkoli, roh und Reis, braun, gekocht"

dish_name_translated
string

Dish name translated to target language

Example:

"Rindfleisch und Brokkoli Pfanne"

failure_reason
string
read-only

Reason for processing failure

Example:

"Unable to identify food items"

ingredients
object[] | null

List of detected ingredients with nutritional information

input_type
enum<string>
read-only

Nutrition record input type

Available options:
image,
manual,
push,
text
Example:

"image"

modified_at
string<date-time>
read-only

Update timestamp in UTC

Example:

"2025-09-15T10:30:12.132Z"

nutri_score
string

Nutri-Score known as the 5-Colour Nutrition label (A-E)

Example:

"B"

nutritional_fields
object

Nutritional values in the given serving size

record_id
string<uuid>
read-only

Report record ID

Example:

"6ba7b810-9dad-11d1-80b4-00c04fd430c8"

status
enum<string>
read-only

Processing status

Available options:
pending,
processing,
completed,
failed,
updated
Example:

"completed"

uploaded_at
string<date-time>
read-only

Upload timestamp in UTC

Example:

"2025-09-15T10:30:04.521Z"

user_time_offset_minutes
integer<int32>

User's local timezone offset in minutes

Example:

-540