← Keto Recipe API

Keto Recipe API quickstart

488 ketogenic recipes with ingredients, steps, prep and cook times, and macros. Host: keto-diet.p.rapidapi.com.

1. Subscribe

  1. Open the Keto Recipe API listing on RapidAPI.
  2. Choose the free BASIC plan and click Subscribe.
  3. Copy your key from the Code Snippets panel. Every request sends it as X-RapidAPI-Key.

2. First request

curl --request GET "https://keto-diet.p.rapidapi.com/" \
  --header "X-RapidAPI-Key: <your key>" \
  --header "X-RapidAPI-Host: keto-diet.p.rapidapi.com"

The response is a JSON array of recipes (id, recipe, category, prep_time_in_minutes, cook_time_in_minutes, difficulty, serving, ingredient_1, measurement_1, directions_step_1, ...).

3. Endpoints

Endpoint Description
GET / List recipes, with the search and filters below
GET /categories/ List recipe categories (id, category, thumbnail)

4. Search and filter

All parameters are optional and can be combined.

Param Meaning
search Case-insensitive match on the recipe name
id Exact recipe id
category Category id, from /categories/
difficulty Exact difficulty, for example Easy
calories__lt, calories__gt Less than / greater than
fat_in_grams__lt, fat_in_grams__gt Same, for fat
carbohydrates_in_grams__lt, carbohydrates_in_grams__gt Same, for carbs
protein_in_grams__lt, protein_in_grams__gt Same, for protein
prep_time_in_minutes__lt, prep_time_in_minutes__gt Same, for prep time
cook_time_in_minutes__lt, cook_time_in_minutes__gt Same, for cook time

Example: easy recipes under 500 calories and 10 g of carbs that mention "chicken".

curl --request GET "https://keto-diet.p.rapidapi.com/?search=chicken&difficulty=Easy&calories__lt=500&carbohydrates_in_grams__lt=10" \
  --header "X-RapidAPI-Key: <your key>" \
  --header "X-RapidAPI-Host: keto-diet.p.rapidapi.com"

5. Pagination

This API does not paginate. GET / returns every recipe that matches your filters in one array, so narrow the result with the filters above.

6. Code samples

Each sample runs the "chicken under 500 calories" search.

curl

curl --request GET "https://keto-diet.p.rapidapi.com/?search=chicken&calories__lt=500" \
  --header "X-RapidAPI-Key: <your key>" \
  --header "X-RapidAPI-Host: keto-diet.p.rapidapi.com"

Python (requests)

import requests

resp = requests.get(
    "https://keto-diet.p.rapidapi.com/",
    headers={
        "X-RapidAPI-Key": "<your key>",
        "X-RapidAPI-Host": "keto-diet.p.rapidapi.com",
    },
    params={"search": "chicken", "calories__lt": 500},
)
resp.raise_for_status()
for recipe in resp.json():
    print(recipe["recipe"])

JavaScript (fetch)

const params = new URLSearchParams({ search: "chicken", calories__lt: "500" });
const res = await fetch(`https://keto-diet.p.rapidapi.com/?${params}`, {
  headers: {
    "X-RapidAPI-Key": "<your key>",
    "X-RapidAPI-Host": "keto-diet.p.rapidapi.com",
  },
});
const recipes = await res.json();
recipes.forEach((r) => console.log(r.recipe));

Swift

import Foundation

var components = URLComponents(string: "https://keto-diet.p.rapidapi.com/")!
components.queryItems = [
    URLQueryItem(name: "search", value: "chicken"),
    URLQueryItem(name: "calories__lt", value: "500"),
]
var request = URLRequest(url: components.url!)
request.setValue("<your key>", forHTTPHeaderField: "X-RapidAPI-Key")
request.setValue("keto-diet.p.rapidapi.com", forHTTPHeaderField: "X-RapidAPI-Host")

let (data, _) = try await URLSession.shared.data(for: request)
print(String(data: data, encoding: .utf8) ?? "")

Kotlin (OkHttp)

import okhttp3.OkHttpClient
import okhttp3.Request

val client = OkHttpClient()
val request = Request.Builder()
    .url("https://keto-diet.p.rapidapi.com/?search=chicken&calories__lt=500")
    .addHeader("X-RapidAPI-Key", "<your key>")
    .addHeader("X-RapidAPI-Host", "keto-diet.p.rapidapi.com")
    .build()

client.newCall(request).execute().use { response ->
    println(response.body?.string())
}

Dart (http)

import 'package:http/http.dart' as http;

Future<void> main() async {
  final uri = Uri.https('keto-diet.p.rapidapi.com', '/', {
    'search': 'chicken',
    'calories__lt': '500',
  });
  final response = await http.get(uri, headers: {
    'X-RapidAPI-Key': '<your key>',
    'X-RapidAPI-Host': 'keto-diet.p.rapidapi.com',
  });
  print(response.body);
}

Subscribe on RapidAPI

Encurate Datasets