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

# Generate Recipe

> Generate a recipe based on a prompt and preferences.



## OpenAPI

````yaml https://www.mrcook.app/api/business/openapi.json post /v1/recipes/generate
openapi: 3.1.0
info:
  title: Mr. Cook API
  version: 1.0.0
  description: API for integrating recipe generation into your products
  contact:
    email: feedback@mrcook.app
  termsOfService: https://www.mrcook.app/legal/api-terms
servers:
  - url: https://api.mrcook.app
    description: Production API
security: []
paths:
  /v1/recipes/generate:
    post:
      summary: Generate Recipe
      description: Generate a recipe based on a prompt and preferences.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  minLength: 1
                  maxLength: 2500
                  description: >-
                    The recipe prompt. This can either be a recipe name,
                    description or a list of ingredients. The more details you
                    provide, the better the recipe will be.
                  example: Cheesburger with Bacon
                language:
                  type: string
                  enum:
                    - en
                    - de
                    - es
                    - fr
                    - pt-BR
                    - ru
                    - nl
                    - it
                    - nb
                    - sv
                    - tr
                    - da
                  default: en
                  description: The language to generate the recipe in
                  example: en
                preference:
                  type: string
                  description: >-
                    Optional dietary preferences (e.g. 'vegetarian', 'vegan',
                    'gluten-free', 'dairy-free')
              required:
                - prompt
      responses:
        '200':
          description: Successfully generated recipe.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        description: >-
                          The ID of the recipe. This can be used to generate an
                          image for the recipe.
                        example: 018ff556-a36a-7cb8-95a1-a2ac02da3e93
                      title:
                        type: string
                        description: The title of the recipe
                        example: Spicy Bacon Cheddar Cheeseburger with Pickles
                      description:
                        type: string
                        description: The description of the recipe
                        example: >-
                          Add a spicy kick to the classic American cheeseburger
                          by introducing some heat to the flavors. This burger
                          features a juicy beef patty with a melted cheddar
                          cheese and crispy bacon, combined with a spicy twist
                          to elevate the taste.
                      servings:
                        type: string
                        description: Servings
                        example: 4 servings
                      preparationTime:
                        type: number
                        description: The preparation time of the recipe in minutes
                        example: 15
                      cookingTime:
                        type: number
                        description: The cooking time of the recipe in minutes
                        example: 15
                      cuisine:
                        type: string
                        description: The cuisine of the recipe
                        example: American
                      ingredients:
                        type: array
                        items:
                          type: string
                        description: List of ingredients with quantity
                        example:
                          - 500 grams ground beef
                          - 4 slices bacon
                          - 4 slices cheddar cheese
                          - 4 hamburger buns
                          - 4 tablespoons mayonnaise
                          - 4 leaves lettuce
                          - 1 tomato, sliced
                          - 8 slices pickles
                          - ...
                      instructions:
                        type: array
                        items:
                          type: string
                        description: List of instructions for the recipe
                        example:
                          - >-
                            Season the ground beef with salt, pepper, and
                            cayenne pepper or hot sauce. Mix well until evenly
                            distributed.
                          - >-
                            Form the beef into 4 patties, slightly larger than
                            the buns.
                          - ...
                          - Cover with the top bun and serve immediately.
                      language:
                        type: string
                        enum:
                          - en
                          - de
                          - es
                          - fr
                          - pt-BR
                          - ru
                          - nl
                          - it
                          - nb
                          - sv
                          - tr
                          - da
                        default: en
                        description: The language of the recipe
                        example: en
                    required:
                      - id
                      - title
                      - ingredients
                      - instructions
                required:
                  - success
                  - data
        '401':
          description: >-
            Invalid or missing API key. Learn more:
            https://docs.mrcook.app/business-api/api-key
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: UNAUTHORIZED
                  message:
                    type: string
                    example: >-
                      Invalid or missing API key. Learn more:
                      https://docs.mrcook.app/business-api/api-key
                required:
                  - code
                  - message
        '402':
          description: >-
            Insufficient credits. Please purchase more credits:
            https://docs.mrcook.app/business-api/pricing
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INSUFFICIENT_CREDITS
                  message:
                    type: string
                    example: >-
                      Insufficient credits. Please purchase more credits:
                      https://docs.mrcook.app/business-api/pricing
                required:
                  - code
                  - message
        '403':
          description: You don't have permission to access this resource.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: FORBIDDEN
                  message:
                    type: string
                    example: You don't have permission to access this resource.
                required:
                  - code
                  - message
        '429':
          description: >-
            Rate limit exceeded. Please contact support if you need a higher
            limit.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: TOO_MANY_REQUESTS
                  message:
                    type: string
                    example: >-
                      Rate limit exceeded. Please contact support if you need a
                      higher limit.
                required:
                  - code
                  - message
        '500':
          description: Failed to generate the recipe
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: GENERATION_FAILED
                  message:
                    type: string
                    example: Failed to generate the recipe
                required:
                  - code
                  - message
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: 'How to get your API key: https://docs.mrcook.app/business-api/api-key'

````