LogMeal Image Recognition API

Detect food items in user-submitted images.

OpenAPI Specification

logmeal-image-recognition-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: LogMeal Food Recognition History Image Recognition API
  description: The LogMeal API is a RESTful service that recognizes foods, drinks, vegetables, fruits, and prepared dishes from images, returns ingredient lists with quantities, computes nutritional information, and tracks user intakes over time. Authentication is by user token in the Authorization header. Images are submitted as multipart/form-data or as a base64-encoded string in JSON.
  version: '2.0'
  contact:
    name: LogMeal
    url: https://logmeal.com/api/
servers:
- url: https://api.logmeal.com
  description: LogMeal production API
security:
- bearerToken: []
tags:
- name: Image Recognition
  description: Detect food items in user-submitted images.
paths:
  /v2/image/segmentation/complete:
    post:
      tags:
      - Image Recognition
      summary: Segment and recognize foods in an image
      description: Detects multiple food items in an image, recognizes each item, and logs a user intake in a single request.
      operationId: segmentationComplete
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
              - image
              properties:
                image:
                  type: string
                  format: binary
                  description: Image file containing one or more food items.
                language:
                  type: string
                  description: ISO language code for returned labels.
                  default: eng
      responses:
        '200':
          description: Recognition results with detected food items.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentationResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    SegmentationResult:
      type: object
      properties:
        imageId:
          type: integer
        segmentation_results:
          type: array
          items:
            type: object
            properties:
              recognition_results:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                    name:
                      type: string
                    prob:
                      type: number
                      format: float
              foodFamily:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                    name:
                      type: string
                    prob:
                      type: number
                      format: float
        foodType:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              name:
                type: string
              prob:
                type: number
                format: float
    Error:
      type: object
      properties:
        message:
          type: string
        code:
          type: integer
  responses:
    Unauthorized:
      description: Missing or invalid access token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerToken:
      type: http
      scheme: bearer
      description: User access token issued by LogMeal.