> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spikeapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Analyze Nutrition Image

> ##### Upload a food image and analyze the nutritional content.

The system uses advanced computer vision and machine learning models to identify ingredients, calculate nutritional values, and provide detailed food composition data.

### Processing Flow

The processing mode is controlled by the `wait_on_process` parameter. The API supports two processing modes, each suited for a different use case:

- **Asynchronous** (recommended) — returns immediately and processes the image in the background (see [Asynchronous Processing](/nutrition-ai/async)); use webhooks for real-time notifications
- **Synchronous** — waits for analysis to be completed before responding

If your application is configured to use asynchronous processing and ready to consume webhooks, our API will send a webhook notification in both processing modes, synchronous or asynchronous, once the nutritional analysis is completed.

### Analysis Modes

- **`precise`** (default) — uses advanced AI models for the highest accuracy and detail with good processing time
- **`fast`** — uses optimized AI models for good accuracy and detail with the fastest processing time

### Localization

Optionally provide `country_code` and/or `language_code` in lowercase (ISO 3166-1 alpha-2 code) for region-specific analysis.

### Including Optional Data

If `include_nutrition_fields` is omitted or empty, only four basic fields are included by default:
- `carbohydrate_g`
- `energy_kcal`
- `fat_total_g`
- `protein_g`

Example of how to include optional fields and custom nutritional fields:

```json
{
  "include_nutri_score": true,
  "include_dish_description": true,
  "include_ingredients": true,
  "include_nutrition_fields": [
    "energy_kcal",
    "protein_g",
    "fat_total_g",
    "carbohydrate_g",
    "fiber_total_dietary_g",
    "sodium_mg",
    "calcium_mg",
    "iron_mg"
  ]
}
```

For more documentation, including implementation examples, processing workflows, and integration guides, see **[Implementation Guide](/nutrition-ai/implementation)**.




## OpenAPI

````yaml post /nutrition_records/image
openapi: 3.1.0
info:
  title: Application user API
  version: 3.0.2
servers:
  - url: https://app-api.spikeapi.com/v3
security: []
paths:
  /nutrition_records/image:
    post:
      tags:
        - Nutrition AI
      summary: Analyze Nutrition Image
      description: >
        ##### Upload a food image and analyze the nutritional content.


        The system uses advanced computer vision and machine learning models to
        identify ingredients, calculate nutritional values, and provide detailed
        food composition data.


        ### Processing Flow


        The processing mode is controlled by the `wait_on_process` parameter.
        The API supports two processing modes, each suited for a different use
        case:


        - **Asynchronous** (recommended) — returns immediately and processes the
        image in the background (see [Asynchronous
        Processing](/nutrition-ai/async)); use webhooks for real-time
        notifications

        - **Synchronous** — waits for analysis to be completed before responding


        If your application is configured to use asynchronous processing and
        ready to consume webhooks, our API will send a webhook notification in
        both processing modes, synchronous or asynchronous, once the nutritional
        analysis is completed.


        ### Analysis Modes


        - **`precise`** (default) — uses advanced AI models for the highest
        accuracy and detail with good processing time

        - **`fast`** — uses optimized AI models for good accuracy and detail
        with the fastest processing time


        ### Localization


        Optionally provide `country_code` and/or `language_code` in lowercase
        (ISO 3166-1 alpha-2 code) for region-specific analysis.


        ### Including Optional Data


        If `include_nutrition_fields` is omitted or empty, only four basic
        fields are included by default:

        - `carbohydrate_g`

        - `energy_kcal`

        - `fat_total_g`

        - `protein_g`


        Example of how to include optional fields and custom nutritional fields:


        ```json

        {
          "include_nutri_score": true,
          "include_dish_description": true,
          "include_ingredients": true,
          "include_nutrition_fields": [
            "energy_kcal",
            "protein_g",
            "fat_total_g",
            "carbohydrate_g",
            "fiber_total_dietary_g",
            "sodium_mg",
            "calcium_mg",
            "iron_mg"
          ]
        }

        ```


        For more documentation, including implementation examples, processing
        workflows, and integration guides, see **[Implementation
        Guide](/nutrition-ai/implementation)**.
      operationId: postNutritionRecordsImage
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NutritionRecordUploadInput'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NutritionRecord'
          description: OK
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Bad Request
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Unauthorized
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Not Found
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Unprocessable Entity
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Internal Server Error
      security:
        - bearer: []
components:
  schemas:
    NutritionRecordUploadInput:
      additionalProperties: false
      properties:
        analysis_mode:
          default: precise
          description: A preferred mode for the analysis
          enum:
            - fast
            - precise
          type: string
        body:
          description: Base64-encoded binary data, this or 'body_url' is required
          type: string
        body_url:
          description: URL to the image, this or 'body' is required
          type: string
        consumed:
          default: true
          description: Whether to save the record (true) or only analyze (false)
          type: boolean
        consumed_at:
          description: >-
            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'
          format: date-time
        country_code:
          default: us
          description: Country ISO 3166-1 alpha-2 code in lowercase
          enum:
            - 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
          type: string
        include_dish_description:
          default: false
          description: Include dish description of the food
          examples:
            - true
          type: boolean
        include_ingredients:
          default: false
          description: Include ingredients of the food
          examples:
            - true
          type: boolean
        include_nutri_score:
          default: false
          description: Include nutri-score label of the food
          type: boolean
        include_nutrition_fields:
          default:
            - carbohydrate_g
            - energy_kcal
            - fat_total_g
            - protein_g
          description: >-
            Include specific nutrition fields in the analysis report. By
            default, carbohydrate_g, energy_kcal, fat_total_g and protein_g will
            be included
          items:
            enum:
              - 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
            type: string
          type: array
        language_code:
          default: en
          description: Language ISO 639-1 code in lowercase
          enum:
            - 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
          examples:
            - de
          type: string
        user_time_offset_minutes:
          default: 0
          description: User's local timezone offset in minutes
          examples:
            - -540
          format: int32
          type: integer
        wait_on_process:
          default: false
          description: >-
            If true, waits for the process to complete. If false, returns
            immediate response and sends notification with analysis report to
            webhook URL when finished
          type: boolean
      type: object
    NutritionRecord:
      additionalProperties: false
      properties:
        consumed_at:
          description: >-
            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'
          format: date-time
        dish_description:
          description: Detected dish description
          examples:
            - >-
              beef, ground, lean, cooked with broccoli, raw and rice, brown,
              cooked
          type: string
        dish_description_translated:
          description: Dish description translated to target language
          examples:
            - >-
              Rindfleisch, Hackfleisch, mager, gekocht mit Brokkoli, roh und
              Reis, braun, gekocht
          type: string
        dish_name:
          description: Detected dish name
          examples:
            - beef and broccoli stir-fry
          type: string
        dish_name_translated:
          description: Dish name translated to target language
          examples:
            - Rindfleisch und Brokkoli Pfanne
          type: string
        failure_reason:
          description: Reason for processing failure
          examples:
            - Unable to identify food items
          readOnly: true
          type: string
        ingredients:
          description: List of detected ingredients with nutritional information
          items:
            $ref: '#/components/schemas/NutritionRecordIngredient'
          type:
            - array
            - 'null'
        input_type:
          description: Nutrition record input type
          enum:
            - image
            - manual
          examples:
            - image
          readOnly: true
          type: string
        modified_at:
          description: Update timestamp in UTC
          examples:
            - '2025-09-15T10:30:12.132Z'
          format: date-time
          readOnly: true
          type: string
        nutri_score:
          description: Nutri-Score known as the 5-Colour Nutrition label (A-E)
          examples:
            - B
          type: string
        nutritional_fields:
          additionalProperties: false
          description: Nutritional values in the given serving size
          properties:
            calcium_mg:
              description: Calcium in milligrams
              examples:
                - 1000
              type: number
            carbohydrate_g:
              description: Carbohydrates in grams
              examples:
                - 250
              type: number
            cholesterol_mg:
              description: Cholesterol in milligrams
              examples:
                - 300
              type: number
            energy_kcal:
              description: Energy in kilocalories
              examples:
                - 800
              type: number
            fat_monounsaturated_g:
              description: Monounsaturated Fat in grams
              examples:
                - 20
              type: number
            fat_polyunsaturated_g:
              description: Polyunsaturated Fat in grams
              examples:
                - 15
              type: number
            fat_saturated_g:
              description: Saturated Fat in grams
              examples:
                - 20
              type: number
            fat_total_g:
              description: Total Fat in grams
              examples:
                - 65
              type: number
            fat_trans_g:
              description: Trans Fat in grams
              examples:
                - 0.5
              type: number
            fiber_total_dietary_g:
              description: Dietary Fiber in grams
              examples:
                - 25
              type: number
            folate_mcg:
              description: Folate in micrograms
              examples:
                - 400
              type: number
            iron_mg:
              description: Iron in milligrams
              examples:
                - 18
              type: number
            magnesium_mg:
              description: Magnesium in milligrams
              examples:
                - 400
              type: number
            niacin_mg:
              description: Niacin in milligrams
              examples:
                - 16
              type: number
            phosphorus_mg:
              description: Phosphorus in milligrams
              examples:
                - 700
              type: number
            potassium_mg:
              description: Potassium in milligrams
              examples:
                - 3500
              type: number
            protein_g:
              description: Protein in grams
              examples:
                - 50
              type: number
            riboflavin_mg:
              description: Riboflavin in milligrams
              examples:
                - 1.3
              type: number
            salt_g:
              description: Salt in grams
              examples:
                - 12
              type: number
            salt_mg:
              description: Salt in milligrams
              examples:
                - 25
              type: number
            sodium_g:
              description: Sodium in grams
              examples:
                - 56
              type: number
            sodium_mg:
              description: Sodium in milligrams
              examples:
                - 2300
              type: number
            sugars_total_g:
              description: Total Sugars in grams
              examples:
                - 50
              type: number
            thiamin_mg:
              description: Thiamin in milligrams
              examples:
                - 1.2
              type: number
            vitamin_a_rae_mcg:
              description: Vitamin A in micrograms
              examples:
                - 900
              type: number
            vitamin_b12_mcg:
              description: Vitamin B12 in micrograms
              examples:
                - 2.4
              type: number
            vitamin_b6_mg:
              description: Vitamin B6 in milligrams
              examples:
                - 1.7
              type: number
            vitamin_c_mg:
              description: Vitamin C in milligrams
              examples:
                - 90
              type: number
            vitamin_d_mcg:
              description: Vitamin D in micrograms
              examples:
                - 20
              type: number
            vitamin_e_mg:
              description: Vitamin E in milligrams
              examples:
                - 15
              type: number
            vitamin_k_mcg:
              description: Vitamin K in micrograms
              examples:
                - 120
              type: number
            zinc_mg:
              description: Zinc in milligrams
              examples:
                - 11
              type: number
          type: object
        record_id:
          description: Report record ID
          examples:
            - 6ba7b810-9dad-11d1-80b4-00c04fd430c8
          format: uuid
          readOnly: true
          type: string
        serving_size:
          description: Serving size in metric units
          examples:
            - 120
          format: double
          minimum: 0.01
          type: number
        status:
          description: Processing status
          enum:
            - pending
            - processing
            - completed
            - failed
            - updated
          examples:
            - completed
          readOnly: true
          type: string
        unit:
          description: Metric unit (g for solids, ml for liquids)
          enum:
            - g
            - mg
            - mcg
            - ml
            - kcal
          examples:
            - g
          type: string
        uploaded_at:
          description: Upload timestamp in UTC
          examples:
            - '2025-09-15T10:30:04.521Z'
          format: date-time
          readOnly: true
          type: string
        user_time_offset_minutes:
          description: User's local timezone offset in minutes
          examples:
            - -540
          format: int32
          type: integer
      required:
        - dish_name
        - serving_size
        - unit
      type: object
    ErrorModel:
      additionalProperties: false
      properties:
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    NutritionRecordIngredient:
      additionalProperties: false
      properties:
        name:
          description: Ingredient name using LANGUAL standard terminology
          examples:
            - beef, ground, lean, cooked
          type: string
        name_translated:
          description: Ingredient name translated to target language
          examples:
            - Rindfleisch, Hackfleisch, mager, gekocht
          type: string
        nutritional_fields:
          additionalProperties: false
          description: Nutritional values in the given serving size
          properties:
            calcium_mg:
              description: Calcium in milligrams
              examples:
                - 1000
              type: number
            carbohydrate_g:
              description: Carbohydrates in grams
              examples:
                - 250
              type: number
            cholesterol_mg:
              description: Cholesterol in milligrams
              examples:
                - 300
              type: number
            energy_kcal:
              description: Energy in kilocalories
              examples:
                - 800
              type: number
            fat_monounsaturated_g:
              description: Monounsaturated Fat in grams
              examples:
                - 20
              type: number
            fat_polyunsaturated_g:
              description: Polyunsaturated Fat in grams
              examples:
                - 15
              type: number
            fat_saturated_g:
              description: Saturated Fat in grams
              examples:
                - 20
              type: number
            fat_total_g:
              description: Total Fat in grams
              examples:
                - 65
              type: number
            fat_trans_g:
              description: Trans Fat in grams
              examples:
                - 0.5
              type: number
            fiber_total_dietary_g:
              description: Dietary Fiber in grams
              examples:
                - 25
              type: number
            folate_mcg:
              description: Folate in micrograms
              examples:
                - 400
              type: number
            iron_mg:
              description: Iron in milligrams
              examples:
                - 18
              type: number
            magnesium_mg:
              description: Magnesium in milligrams
              examples:
                - 400
              type: number
            niacin_mg:
              description: Niacin in milligrams
              examples:
                - 16
              type: number
            phosphorus_mg:
              description: Phosphorus in milligrams
              examples:
                - 700
              type: number
            potassium_mg:
              description: Potassium in milligrams
              examples:
                - 3500
              type: number
            protein_g:
              description: Protein in grams
              examples:
                - 50
              type: number
            riboflavin_mg:
              description: Riboflavin in milligrams
              examples:
                - 1.3
              type: number
            salt_g:
              description: Salt in grams
              examples:
                - 12
              type: number
            salt_mg:
              description: Salt in milligrams
              examples:
                - 25
              type: number
            sodium_g:
              description: Sodium in grams
              examples:
                - 56
              type: number
            sodium_mg:
              description: Sodium in milligrams
              examples:
                - 2300
              type: number
            sugars_total_g:
              description: Total Sugars in grams
              examples:
                - 50
              type: number
            thiamin_mg:
              description: Thiamin in milligrams
              examples:
                - 1.2
              type: number
            vitamin_a_rae_mcg:
              description: Vitamin A in micrograms
              examples:
                - 900
              type: number
            vitamin_b12_mcg:
              description: Vitamin B12 in micrograms
              examples:
                - 2.4
              type: number
            vitamin_b6_mg:
              description: Vitamin B6 in milligrams
              examples:
                - 1.7
              type: number
            vitamin_c_mg:
              description: Vitamin C in milligrams
              examples:
                - 90
              type: number
            vitamin_d_mcg:
              description: Vitamin D in micrograms
              examples:
                - 20
              type: number
            vitamin_e_mg:
              description: Vitamin E in milligrams
              examples:
                - 15
              type: number
            vitamin_k_mcg:
              description: Vitamin K in micrograms
              examples:
                - 120
              type: number
            zinc_mg:
              description: Zinc in milligrams
              examples:
                - 11
              type: number
          type: object
        serving_size:
          description: Serving size in metric units
          examples:
            - 120
          format: double
          type: number
        unit:
          description: Metric unit (g for solids, ml for liquids)
          enum:
            - g
            - mg
            - mcg
            - ml
            - kcal
          examples:
            - g
          type: string
      required:
        - name
        - serving_size
        - unit
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
  securitySchemes:
    bearer:
      bearerFormat: JWT
      scheme: bearer
      type: http

````