Skip to main content
POST
/
api
/
parseInstructions
Parse Instructions from Text
curl --request POST \
  --url https://api.example.com/api/parseInstructions \
  --header 'Content-Type: application/json' \
  --data '
{
  "text": "<string>"
}
'
{
  "success": true,
  "data": "<string>",
  "error": {
    "code": "<string>",
    "message": "<string>"
  }
}

Overview

The /api/parseInstructions endpoint extracts structured cooking instruction steps from raw HTML or text content. It uses AI to parse instructions while preserving all important details like temperatures, times, and techniques. This endpoint is useful when you have recipe HTML content but need to extract just the cooking instructions in a clean, structured format.

Request

text
string
required
Raw HTML or text content containing cooking instructions. Maximum 15,000 characters.This can be the full HTML of a recipe page or just the instructions section.

Response

Success Response

success
boolean
required
Always true for successful responses
data
string
required
JSON string containing an array of instruction steps. Parse this string to access the array of instruction strings.

Error Response

success
boolean
Always false for error responses
error
object
Error details

Error Codes

ERR_INVALID_URL
Text input is required and must be a string (despite the code name, this is used for input validation)
ERR_NO_RECIPE_FOUND
Text input is empty
ERR_AI_PARSE_FAILED
AI returned invalid response format or no response from AI service
ERR_TIMEOUT
AI service request timed out
ERR_UNKNOWN
AI service is not configured, authentication failed, or quota exceeded

Features

This endpoint automatically:
  • Extracts all instruction steps in order
  • Preserves cooking temperatures exactly (“350°F”, “medium-high heat”)
  • Preserves cooking times (“30 minutes”, “until golden brown”)
  • Keeps all measurements and technique descriptions
  • Removes author names and attribution text
  • Filters out non-instruction content
  • Maintains original level of detail

Examples

curl -X POST https://your-domain.com/api/parseInstructions \
  -H "Content-Type: application/json" \
  -d '{
    "text": "<h2>Instructions</h2><ol><li>Preheat oven to 350°F.</li><li>Mix flour and sugar.</li><li>Bake for 30 minutes.</li></ol>"
  }'

Success Response Example

{
  "success": true,
  "data": "[\"Preheat oven to 350°F (175°C). Grease and flour two 9-inch round cake pans.\",\"In a medium bowl, whisk together 2 1/2 cups all-purpose flour, 1 teaspoon baking powder, 1/2 teaspoon baking soda, and 1/4 teaspoon salt. Set aside.\",\"In a large bowl, using an electric mixer on medium speed, cream together 3/4 cup unsalted butter and 1 3/4 cups granulated sugar until light and fluffy, about 3-4 minutes.\",\"Beat in 3 large eggs, one at a time, mixing well after each addition. Stir in 1 1/2 teaspoons vanilla extract.\",\"Bake for 28-32 minutes, or until a toothpick inserted in the center comes out clean.\"]"
}
When parsed, the data field contains:
[
  "Preheat oven to 350°F (175°C). Grease and flour two 9-inch round cake pans.",
  "In a medium bowl, whisk together 2 1/2 cups all-purpose flour, 1 teaspoon baking powder, 1/2 teaspoon baking soda, and 1/4 teaspoon salt. Set aside.",
  "In a large bowl, using an electric mixer on medium speed, cream together 3/4 cup unsalted butter and 1 3/4 cups granulated sugar until light and fluffy, about 3-4 minutes.",
  "Beat in 3 large eggs, one at a time, mixing well after each addition. Stir in 1 1/2 teaspoons vanilla extract.",
  "Bake for 28-32 minutes, or until a toothpick inserted in the center comes out clean."
]

Error Response Example

{
  "success": false,
  "error": {
    "code": "ERR_NO_RECIPE_FOUND",
    "message": "Text input is empty"
  }
}
The input text is limited to the first 15,000 characters. Longer content will be truncated.
This endpoint uses AI and may consume API tokens. Ensure your AI service (Groq) is properly configured with an API key.
The AI preserves all details from the HTML. Do not rely on the AI to simplify or shorten instructions - it extracts them exactly as written.

Build docs developers (and LLMs) love