Skip to main content
POST
/
api
/
parseRecipeFromImage
Parse Recipe from Image
curl --request POST \
  --url https://api.example.com/api/parseRecipeFromImage \
  --header 'Content-Type: application/json' \
  --data '{}'
{
  "success": true,
  "title": "<string>",
  "ingredients": [
    {
      "groupName": "<string>",
      "ingredients": [
        {
          "amount": "<string>",
          "units": "<string>",
          "ingredient": "<string>"
        }
      ]
    }
  ],
  "instructions": [
    {}
  ],
  "summary": "<string>",
  "author": "<string>",
  "cuisine": [
    {}
  ],
  "servings": "<string>",
  "prepTimeMinutes": 123,
  "cookTimeMinutes": 123,
  "totalTimeMinutes": 123,
  "imageData": "<string>",
  "imageFilename": "<string>",
  "error": {
    "code": "<string>",
    "message": "<string>",
    "retryAfter": 123
  }
}

Overview

The /api/parseRecipeFromImage endpoint accepts image uploads (recipe cards, cookbook pages, screenshots) and uses AI vision models to extract recipe data from the image. Supported formats: JPG, PNG, WEBP, GIF Maximum file size: 10MB

Request

This endpoint accepts multipart/form-data requests with an image file.
image
file
required
Image file containing a recipe. Supported formats: JPG, PNG, WEBP, GIF.Maximum file size: 10MB

Response

Success Response

success
boolean
required
Always true for successful responses
title
string
required
The recipe title extracted from the image
ingredients
array
required
Array of ingredient groups. Each group contains a groupName and an array of ingredients.
instructions
array
required
Array of cooking instruction steps as strings
summary
string
AI-generated recipe summary
author
string
Recipe author name (if visible in the image)
cuisine
array
Array of cuisine tags (e.g., ["Italian", "Mediterranean"])
servings
string
Number of servings or yield (e.g., “4 servings”, “12 cookies”)
prepTimeMinutes
number
Preparation time in minutes (if visible in the image)
cookTimeMinutes
number
Cooking time in minutes (if visible in the image)
totalTimeMinutes
number
Total time in minutes (prep + cook)
imageData
string
Base64-encoded data URL of the uploaded image for preview purposes
imageFilename
string
Original filename of the uploaded image

Error Response

success
boolean
Always false for error responses
error
object
Error details

Error Codes

ERR_INVALID_URL
No image file provided or invalid file type. Despite the code name, this is used for file validation errors.
ERR_NO_RECIPE_FOUND
No recipe found in image - could not read recipe text
ERR_AI_PARSE_FAILED
Failed to extract recipe from image or AI service not configured
ERR_RATE_LIMIT
Too many requests - rate limit exceeded
ERR_UNKNOWN
An unexpected error occurred

Examples

curl -X POST https://your-domain.com/api/parseRecipeFromImage \
  -H "Content-Type: multipart/form-data" \
  -F "[email protected]"

Success Response Example

{
  "success": true,
  "title": "Grandma's Chocolate Cake",
  "ingredients": [
    {
      "groupName": "For the cake",
      "ingredients": [
        {
          "amount": "2",
          "units": "cups",
          "ingredient": "all-purpose flour"
        },
        {
          "amount": "1 3/4",
          "units": "cups",
          "ingredient": "granulated sugar"
        }
      ]
    }
  ],
  "instructions": [
    "Preheat oven to 350°F.",
    "Mix flour and sugar in a large bowl.",
    "Bake for 30-35 minutes."
  ],
  "summary": "A classic chocolate cake recipe with rich, moist layers.",
  "author": "Grandma Smith",
  "servings": "12 servings",
  "prepTimeMinutes": 20,
  "cookTimeMinutes": 35,
  "totalTimeMinutes": 55,
  "imageData": "data:image/jpeg;base64,/9j/4AAQSkZJRg...",
  "imageFilename": "recipe-card.jpg"
}

Error Response Example

{
  "success": false,
  "error": {
    "code": "ERR_INVALID_URL",
    "message": "Invalid file type. Please upload a JPG, PNG, WEBP, or GIF image."
  }
}
This endpoint uses AI vision models and may consume significant API tokens. Rate limits apply.
Images must be clear and readable for best results. Low-resolution or blurry images may result in parsing errors.

Build docs developers (and LLMs) love