CalorieNinjas API

The CalorieNinjas API returns nutrition and recipe data for 100,000+ foods and beverages. It offers three endpoints: GET /nutrition for natural-language nutrition lookups (returns calories, macros, vitamins, and minerals), POST /imagetextnutrition for extracting nutrition from images containing food/beverage text, and GET /recipe for searching recipes with titles, ingredients, servings, and instructions. All requests authenticate with an API key sent in the X-Api-Key header.

OpenAPI Specification

calorieninjas-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: CalorieNinjas
  description: Get nutrition and recipe data for 100,000  foods and beverages.
  version: 1.0.0
servers:
  - url: https://api.calorieninjas.com/v1
paths:
  /nutrition:
    get:
      summary: CalorieNinjas Get nutrition information
      description: >-
        Retrieve a detailed list of nutrition information for items based on a
        query.
      parameters:
        - name: query
          in: query
          description: >-
            A string containing food or drink items. Prefix a quantity before an
            item to calculate for that quantity. Default is 100 grams if
            unspecified.
          required: true
          schema:
            type: string
            maxLength: 1500
      responses:
        '200':
          description: Successful response containing nutrition information.
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        sugar_g:
                          type: number
                        fiber_g:
                          type: number
                        serving_size_g:
                          type: number
                        sodium_mg:
                          type: number
                        name:
                          type: string
                        potassium_mg:
                          type: number
                        fat_saturated_g:
                          type: number
                        fat_total_g:
                          type: number
                        calories:
                          type: number
                        cholesterol_mg:
                          type: number
                        protein_g:
                          type: number
                        carbohydrates_total_g:
                          type: number
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
      security:
        - ApiKeyAuth: []
      tags:
        - Nutrition
  /imagetextnutrition:
    post:
      summary: CalorieNinjas Get nutrition information from an image
      description: >-
        Analyze an image containing food/beverage text to get nutrition
        information.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                media:
                  type: string
                  format: binary
      responses:
        '200':
          description: Successful response containing nutrition information.
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
      security:
        - ApiKeyAuth: []
      tags:
        - Imagetextnutrition
  /recipe:
    get:
      summary: CalorieNinjas Get recipes
      description: Retrieve a list of recipes matching the search query.
      parameters:
        - name: query
          in: query
          description: A string containing a dish name. Partial match is supported.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response containing recipe information.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    title:
                      type: string
                    ingredients:
                      type: string
                    servings:
                      type: string
                    instructions:
                      type: string
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
      security:
        - ApiKeyAuth: []
      tags:
        - Recipe
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
tags:
  - name: Imagetextnutrition
  - name: Nutrition
  - name: Recipe