Forkbit

Resources

SDKs

The Forkbit REST API can be called from any language. We maintain a first-party TypeScript SDK, and every other language talks to the API directly.

JavaScript / TypeScript

terminal
npm install @forkbit/js
usage
import { Forkbit } from "@forkbit/js";

const forkbit = new Forkbit({ apiKey: process.env.FORKBIT_API_KEY! });

const { data } = await forkbit.foods.search("banana");
console.log(data[0].name);

Methods

All five methods return a typed ForkbitResponse with data, meta, credits, and rateLimit.

foods
const { data, meta } = await forkbit.foods.search("chicken breast", { limit: 10 });
const { data: food } = await forkbit.foods.get(data[0].id);
const { data: foods } = await forkbit.foods.batch([food.id]);
parse and recipes
const { data: meal } = await forkbit.parse.nutrition("2 eggs and a slice of toast with butter");

const { data: recipe } = await forkbit.recipes.analyze({
  servings: 4,
  ingredients: ["200g chicken breast", "1 tbsp olive oil"],
});

Other languages

There is no official SDK for Python or other languages yet. The REST API is plain JSON over HTTPS, so httpx, requests, or an equivalent HTTP client in your language works without any special setup.

OpenAPI

We publish a complete OpenAPI 3.0 spec at https://api.forkbit.io/openapi.json. Generate a client in any language with openapi-generator or your tool of choice.