import { FoodBlock } from "@foodx/sdk";import { createHash } from "crypto"; const client = new FoodBlock({ apiKey: process.env.FOODX_API_KEY, baseURL: "https://api.foodx.world/api/v1",}); // Create a product listingconst block = FoodBlock.create("substance.product", { name: "Organic Tomatoes", price: 350, currency: "GBP", organic: true, category: "vegetables",}, { seller: "a3f8c2d1e9b7a4f5c8d2e1b9a7f5c2d1" }); // Place an orderconst order = FoodBlock.create("transfer.order", { amount: 700, status: "pending", items: [{ product: block.hash, qty: 2 }],}, { from: buyer.hash, to: seller.hash }); // Leave a reviewconst review = FoodBlock.create("observe.review", { score: 4.8, text: "Best tomatoes in Kent — perfectly ripe, great flavour",}, { subject: block.hash, author: buyer.hash }); // POST a block to the networkawait fetch("/api/v1/foodblock", { method: "POST", headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json", }, body: JSON.stringify({ type, state, refs }),}); // Query the feedconst feed = await fetch("/api/v1/foodblock/feed?limit=20&lat=51.09&lng=-0.71");const { blocks, total, next_cursor } = await feed.json(); // Trace provenanceconst provenance = await fetch(`/api/v1/foodblock/${hash}/provenance`);const { chain } = await provenance.json(); // Register a sellerconst actor = FoodBlock.create("actor.seller", { name: "Kent Farm", type: "producer", status: "live", lat: 51.09, lng: -0.71, bio: "Family farm since 1987",}, { place: venue.hash }); // Share a recipeconst recipe = FoodBlock.create("transform.recipe", { title: "Tomato Bruschetta", serves: 4, prep_time: "10min", cook_time: "5min", ingredients: ["tomatoes", "basil", "bread", "garlic", "olive oil"], steps: ["Dice tomatoes", "Toast bread", "Rub garlic", "Assemble"],}, { author: chef.hash }); // Rescue surplus foodconst surplus = FoodBlock.create("substance.surplus", { name: "Sourdough loaves", quantity: "12", expires: "2025-03-18T23:00:00Z", price: 0,}, { seller: bakery.hash, place: venue.hash }); // Subscribe to eventsconst webhook = await fetch("/api/v1/webhooks", { method: "POST", body: JSON.stringify({ url: "https://myapp.com/hook", events: ["order.created", "review.created", "block.updated"], }),}); // Check trust scoresconst trust = await fetch(`/api/v1/trust/${actorHash}`);const { avg_score, review_count } = await trust.json();if (avg_score > 4.5) badge.assign("trusted-seller", actorHash); // Register an AI agentagent.register({ capabilities: ["substance.product", "transfer.order"], max_amount: 500, rate_limit: 60, auto_approve: true,}); // Create a venueconst venue = FoodBlock.create("place.venue", { name: "The Golden Fork", lat: 51.509, lng: -0.118, category: "restaurant", capacity: 45,}, { operator: owner.hash }); // Express intent to buyconst intent = FoodBlock.create("observe.intent", { product_name: "Sourdough", quantity: "6 loaves", deadline: "2025-03-19T09:00:00Z",}, { author: buyer.hash }); // Certify organicconst cert = FoodBlock.create("observe.certification", { standard: "organic", issuer: "Soil Association", valid_until: "2026-01-01",}, { subject: farm.hash, authority: inspector.hash }); // Direct messagingconst conversation = FoodBlock.create("observe.conversation", { title: "Order #4821",}, { participants: [buyer.hash, seller.hash] }); const message = FoodBlock.create("transfer.message", { content: "Is the sourdough still available?",}, { conversation: convo.hash, author: buyer.hash }); // Track a shipmentconst dispatch = FoodBlock.create("transfer.dispatch", { item: "Wheat flour - 500kg", status: "dispatched", vehicle: "LK71 ABX",}, { from: factory.hash, to: bakery.hash }); // hash = SHA-256(canonical(type + state + refs))// Append-only. Immutable. Content-addressed. Sovereign.import { FoodBlock } from "@foodx/sdk";import { createHash } from "crypto"; const client = new FoodBlock({ apiKey: process.env.FOODX_API_KEY, baseURL: "https://api.foodx.world/api/v1",}); // Create a product listingconst block = FoodBlock.create("substance.product", { name: "Organic Tomatoes", price: 350, currency: "GBP", organic: true, category: "vegetables",}, { seller: "a3f8c2d1e9b7a4f5c8d2e1b9a7f5c2d1" }); // Place an orderconst order = FoodBlock.create("transfer.order", { amount: 700, status: "pending", items: [{ product: block.hash, qty: 2 }],}, { from: buyer.hash, to: seller.hash }); // Leave a reviewconst review = FoodBlock.create("observe.review", { score: 4.8, text: "Best tomatoes in Kent — perfectly ripe, great flavour",}, { subject: block.hash, author: buyer.hash }); // POST a block to the networkawait fetch("/api/v1/foodblock", { method: "POST", headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json", }, body: JSON.stringify({ type, state, refs }),}); // Query the feedconst feed = await fetch("/api/v1/foodblock/feed?limit=20&lat=51.09&lng=-0.71");const { blocks, total, next_cursor } = await feed.json(); // Trace provenanceconst provenance = await fetch(`/api/v1/foodblock/${hash}/provenance`);const { chain } = await provenance.json(); // Register a sellerconst actor = FoodBlock.create("actor.seller", { name: "Kent Farm", type: "producer", status: "live", lat: 51.09, lng: -0.71, bio: "Family farm since 1987",}, { place: venue.hash }); // Share a recipeconst recipe = FoodBlock.create("transform.recipe", { title: "Tomato Bruschetta", serves: 4, prep_time: "10min", cook_time: "5min", ingredients: ["tomatoes", "basil", "bread", "garlic", "olive oil"], steps: ["Dice tomatoes", "Toast bread", "Rub garlic", "Assemble"],}, { author: chef.hash }); // Rescue surplus foodconst surplus = FoodBlock.create("substance.surplus", { name: "Sourdough loaves", quantity: "12", expires: "2025-03-18T23:00:00Z", price: 0,}, { seller: bakery.hash, place: venue.hash }); // Subscribe to eventsconst webhook = await fetch("/api/v1/webhooks", { method: "POST", body: JSON.stringify({ url: "https://myapp.com/hook", events: ["order.created", "review.created", "block.updated"], }),}); // Check trust scoresconst trust = await fetch(`/api/v1/trust/${actorHash}`);const { avg_score, review_count } = await trust.json();if (avg_score > 4.5) badge.assign("trusted-seller", actorHash); // Register an AI agentagent.register({ capabilities: ["substance.product", "transfer.order"], max_amount: 500, rate_limit: 60, auto_approve: true,}); // Create a venueconst venue = FoodBlock.create("place.venue", { name: "The Golden Fork", lat: 51.509, lng: -0.118, category: "restaurant", capacity: 45,}, { operator: owner.hash }); // Express intent to buyconst intent = FoodBlock.create("observe.intent", { product_name: "Sourdough", quantity: "6 loaves", deadline: "2025-03-19T09:00:00Z",}, { author: buyer.hash }); // Certify organicconst cert = FoodBlock.create("observe.certification", { standard: "organic", issuer: "Soil Association", valid_until: "2026-01-01",}, { subject: farm.hash, authority: inspector.hash }); // Direct messagingconst conversation = FoodBlock.create("observe.conversation", { title: "Order #4821",}, { participants: [buyer.hash, seller.hash] }); const message = FoodBlock.create("transfer.message", { content: "Is the sourdough still available?",}, { conversation: convo.hash, author: buyer.hash }); // Track a shipmentconst dispatch = FoodBlock.create("transfer.dispatch", { item: "Wheat flour - 500kg", status: "dispatched", vehicle: "LK71 ABX",}, { from: factory.hash, to: bakery.hash }); // hash = SHA-256(canonical(type + state + refs))// Append-only. Immutable. Content-addressed. Sovereign.
// POST a block to the networkawait fetch("/api/v1/foodblock", { method: "POST", headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json", }, body: JSON.stringify({ type, state, refs }),}); // Query the feedconst feed = await fetch("/api/v1/foodblock/feed?limit=20&lat=51.09&lng=-0.71");const { blocks, total, next_cursor } = await feed.json(); // Trace provenanceconst provenance = await fetch(`/api/v1/foodblock/${hash}/provenance`);const { chain } = await provenance.json(); // Register a sellerconst actor = FoodBlock.create("actor.seller", { name: "Kent Farm", type: "producer", status: "live", lat: 51.09, lng: -0.71, bio: "Family farm since 1987",}, { place: venue.hash }); // Share a recipeconst recipe = FoodBlock.create("transform.recipe", { title: "Tomato Bruschetta", serves: 4, prep_time: "10min", cook_time: "5min", ingredients: ["tomatoes", "basil", "bread", "garlic", "olive oil"], steps: ["Dice tomatoes", "Toast bread", "Rub garlic", "Assemble"],}, { author: chef.hash }); // Rescue surplus foodconst surplus = FoodBlock.create("substance.surplus", { name: "Sourdough loaves", quantity: "12", expires: "2025-03-18T23:00:00Z", price: 0,}, { seller: bakery.hash, place: venue.hash }); // Subscribe to eventsconst webhook = await fetch("/api/v1/webhooks", { method: "POST", body: JSON.stringify({ url: "https://myapp.com/hook", events: ["order.created", "review.created", "block.updated"], }),}); // Check trust scoresconst trust = await fetch(`/api/v1/trust/${actorHash}`);const { avg_score, review_count } = await trust.json();if (avg_score > 4.5) badge.assign("trusted-seller", actorHash); // Register an AI agentagent.register({ capabilities: ["substance.product", "transfer.order"], max_amount: 500, rate_limit: 60, auto_approve: true,}); // Create a venueconst venue = FoodBlock.create("place.venue", { name: "The Golden Fork", lat: 51.509, lng: -0.118, category: "restaurant", capacity: 45,}, { operator: owner.hash }); // Express intent to buyconst intent = FoodBlock.create("observe.intent", { product_name: "Sourdough", quantity: "6 loaves", deadline: "2025-03-19T09:00:00Z",}, { author: buyer.hash }); // Certify organicconst cert = FoodBlock.create("observe.certification", { standard: "organic", issuer: "Soil Association", valid_until: "2026-01-01",}, { subject: farm.hash, authority: inspector.hash }); // Direct messagingconst conversation = FoodBlock.create("observe.conversation", { title: "Order #4821",}, { participants: [buyer.hash, seller.hash] }); const message = FoodBlock.create("transfer.message", { content: "Is the sourdough still available?",}, { conversation: convo.hash, author: buyer.hash }); // Track a shipmentconst dispatch = FoodBlock.create("transfer.dispatch", { item: "Wheat flour - 500kg", status: "dispatched", vehicle: "LK71 ABX",}, { from: factory.hash, to: bakery.hash }); // hash = SHA-256(canonical(type + state + refs))// Append-only. Immutable. Content-addressed. Sovereign.import { FoodBlock } from "@foodx/sdk";import { createHash } from "crypto"; const client = new FoodBlock({ apiKey: process.env.FOODX_API_KEY, baseURL: "https://api.foodx.world/api/v1",}); // Create a product listingconst block = FoodBlock.create("substance.product", { name: "Organic Tomatoes", price: 350, currency: "GBP", organic: true, category: "vegetables",}, { seller: "a3f8c2d1e9b7a4f5c8d2e1b9a7f5c2d1" }); // Place an orderconst order = FoodBlock.create("transfer.order", { amount: 700, status: "pending", items: [{ product: block.hash, qty: 2 }],}, { from: buyer.hash, to: seller.hash }); // Leave a reviewconst review = FoodBlock.create("observe.review", { score: 4.8, text: "Best tomatoes in Kent — perfectly ripe, great flavour",}, { subject: block.hash, author: buyer.hash }); // POST a block to the networkawait fetch("/api/v1/foodblock", { method: "POST", headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json", }, body: JSON.stringify({ type, state, refs }),}); // Query the feedconst feed = await fetch("/api/v1/foodblock/feed?limit=20&lat=51.09&lng=-0.71");const { blocks, total, next_cursor } = await feed.json(); // Trace provenanceconst provenance = await fetch(`/api/v1/foodblock/${hash}/provenance`);const { chain } = await provenance.json(); // Register a sellerconst actor = FoodBlock.create("actor.seller", { name: "Kent Farm", type: "producer", status: "live", lat: 51.09, lng: -0.71, bio: "Family farm since 1987",}, { place: venue.hash }); // Share a recipeconst recipe = FoodBlock.create("transform.recipe", { title: "Tomato Bruschetta", serves: 4, prep_time: "10min", cook_time: "5min", ingredients: ["tomatoes", "basil", "bread", "garlic", "olive oil"], steps: ["Dice tomatoes", "Toast bread", "Rub garlic", "Assemble"],}, { author: chef.hash }); // Rescue surplus foodconst surplus = FoodBlock.create("substance.surplus", { name: "Sourdough loaves", quantity: "12", expires: "2025-03-18T23:00:00Z", price: 0,}, { seller: bakery.hash, place: venue.hash }); // Subscribe to eventsconst webhook = await fetch("/api/v1/webhooks", { method: "POST", body: JSON.stringify({ url: "https://myapp.com/hook", events: ["order.created", "review.created", "block.updated"], }),}); // Check trust scoresconst trust = await fetch(`/api/v1/trust/${actorHash}`);const { avg_score, review_count } = await trust.json();if (avg_score > 4.5) badge.assign("trusted-seller", actorHash); // Register an AI agentagent.register({ capabilities: ["substance.product", "transfer.order"], max_amount: 500, rate_limit: 60, auto_approve: true,}); // Create a venueconst venue = FoodBlock.create("place.venue", { name: "The Golden Fork", lat: 51.509, lng: -0.118, category: "restaurant", capacity: 45,}, { operator: owner.hash }); // Express intent to buyconst intent = FoodBlock.create("observe.intent", { product_name: "Sourdough", quantity: "6 loaves", deadline: "2025-03-19T09:00:00Z",}, { author: buyer.hash }); // Certify organicconst cert = FoodBlock.create("observe.certification", { standard: "organic", issuer: "Soil Association", valid_until: "2026-01-01",}, { subject: farm.hash, authority: inspector.hash }); // Direct messagingconst conversation = FoodBlock.create("observe.conversation", { title: "Order #4821",}, { participants: [buyer.hash, seller.hash] }); const message = FoodBlock.create("transfer.message", { content: "Is the sourdough still available?",}, { conversation: convo.hash, author: buyer.hash }); // Track a shipmentconst dispatch = FoodBlock.create("transfer.dispatch", { item: "Wheat flour - 500kg", status: "dispatched", vehicle: "LK71 ABX",}, { from: factory.hash, to: bakery.hash }); // hash = SHA-256(canonical(type + state + refs))// Append-only. Immutable. Content-addressed. Sovereign.import { FoodBlock } from "@foodx/sdk";import { createHash } from "crypto"; const client = new FoodBlock({ apiKey: process.env.FOODX_API_KEY, baseURL: "https://api.foodx.world/api/v1",}); // Create a product listingconst block = FoodBlock.create("substance.product", { name: "Organic Tomatoes", price: 350, currency: "GBP", organic: true, category: "vegetables",}, { seller: "a3f8c2d1e9b7a4f5c8d2e1b9a7f5c2d1" }); // Place an orderconst order = FoodBlock.create("transfer.order", { amount: 700, status: "pending", items: [{ product: block.hash, qty: 2 }],}, { from: buyer.hash, to: seller.hash }); // Leave a reviewconst review = FoodBlock.create("observe.review", { score: 4.8, text: "Best tomatoes in Kent — perfectly ripe, great flavour",}, { subject: block.hash, author: buyer.hash }); 
title: "Tomato Bruschetta", serves: 4, prep_time: "10min", cook_time: "5min", ingredients: ["tomatoes", "basil", "bread", "garlic", "olive oil"], steps: ["Dice tomatoes", "Toast bread", "Rub garlic", "Assemble"],}, { author: chef.hash }); // Rescue surplus foodconst surplus = FoodBlock.create("substance.surplus", { name: "Sourdough loaves", quantity: "12", expires: "2025-03-18T23:00:00Z", price: 0,}, { seller: bakery.hash, place: venue.hash }); // Subscribe to eventsconst webhook = await fetch("/api/v1/webhooks", { method: "POST", body: JSON.stringify({ url: "https://myapp.com/hook", events: ["order.created", "review.created", "block.updated"], }),}); // Check trust scoresconst trust = await fetch(`/api/v1/trust/${actorHash}`);const { avg_score, review_count } = await trust.json();if (avg_score > 4.5) badge.assign("trusted-seller", actorHash); // Register an AI agentagent.register({ capabilities: ["substance.product", "transfer.order"], max_amount: 500, rate_limit: 60, auto_approve: true,}); // Create a venueconst venue = FoodBlock.create("place.venue", { name: "The Golden Fork", lat: 51.509, lng: -0.118, category: "restaurant", capacity: 45,}, { operator: owner.hash }); // Express intent to buyconst intent = FoodBlock.create("observe.intent", { product_name: "Sourdough", quantity: "6 loaves", deadline: "2025-03-19T09:00:00Z",}, { author: buyer.hash }); // Certify organicconst cert = FoodBlock.create("observe.certification", { standard: "organic", issuer: "Soil Association", valid_until: "2026-01-01",}, { subject: farm.hash, authority: inspector.hash }); // Direct messagingconst conversation = FoodBlock.create("observe.conversation", { title: "Order #4821",}, { participants: [buyer.hash, seller.hash] }); const message = FoodBlock.create("transfer.message", { content: "Is the sourdough still available?",}, { conversation: convo.hash, author: buyer.hash }); // Track a shipmentconst dispatch = FoodBlock.create("transfer.dispatch", { item: "Wheat flour - 500kg", status: "dispatched", vehicle: "LK71 ABX",}, { from: factory.hash, to: bakery.hash }); // hash = SHA-256(canonical(type + state + refs))// Append-only. Immutable. Content-addressed. Sovereign.import { FoodBlock } from "@foodx/sdk";import { createHash } from "crypto"; const client = new FoodBlock({ apiKey: process.env.FOODX_API_KEY, baseURL: "https://api.foodx.world/api/v1",}); // Create a product listingconst block = FoodBlock.create("substance.product", { name: "Organic Tomatoes", price: 350, currency: "GBP", organic: true, category: "vegetables",}, { seller: "a3f8c2d1e9b7a4f5c8d2e1b9a7f5c2d1" }); // Place an orderconst order = FoodBlock.create("transfer.order", { amount: 700, status: "pending", items: [{ product: block.hash, qty: 2 }],}, { from: buyer.hash, to: seller.hash }); // Leave a reviewconst review = FoodBlock.create("observe.review", { score: 4.8, text: "Best tomatoes in Kent — perfectly ripe, great flavour",}, { subject: block.hash, author: buyer.hash }); // POST a block to the networkawait fetch("/api/v1/foodblock", { method: "POST", headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json", }, body: JSON.stringify({ type, state, refs }),}); // Query the feedconst feed = await fetch("/api/v1/foodblock/feed?limit=20&lat=51.09&lng=-0.71");const { blocks, total, next_cursor } = await feed.json(); // Trace provenanceconst provenance = await fetch(`/api/v1/foodblock/${hash}/provenance`);const { chain } = await provenance.json(); // Register a sellerconst actor = FoodBlock.create("actor.seller", { name: "Kent Farm", type: "producer", status: "live", lat: 51.09, lng: -0.71, bio: "Family farm since 1987",}, { place: venue.hash }); // Share a recipeconst recipe = FoodBlock.create("transform.recipe", { title: "Tomato Bruschetta", serves: 4, prep_time: "10min", cook_time: "5min", ingredients: ["tomatoes", "basil", "bread", "garlic", "olive oil"], steps: ["Dice tomatoes", "Toast bread", "Rub garlic", "Assemble"],}, { author: chef.hash }); // Rescue surplus foodconst surplus = FoodBlock.create("substance.surplus", { name: "Sourdough loaves", quantity: "12", expires: "2025-03-18T23:00:00Z", price: 0,}, { seller: bakery.hash, place: venue.hash }); // Subscribe to eventsconst webhook = await fetch("/api/v1/webhooks", { method: "POST", body: JSON.stringify({ url: "https://myapp.com/hook", events: ["order.created", "review.created", "block.updated"], }),}); // Check trust scoresconst trust = await fetch(`/api/v1/trust/${actorHash}`);const { avg_score, review_count } = await trust.json();if (avg_score > 4.5) badge.assign("trusted-seller", actorHash); // Register an AI agentagent.register({ capabilities: ["substance.product", "transfer.order"], max_amount: 500, rate_limit: 60, auto_approve: true,}); // Create a venueconst venue = FoodBlock.create("place.venue", { name: "The Golden Fork", lat: 51.509, lng: -0.118, category: "restaurant", capacity: 45,}, { operator: owner.hash }); // Express intent to buyconst intent = FoodBlock.create("observe.intent", { product_name: "Sourdough", quantity: "6 loaves", deadline: "2025-03-19T09:00:00Z",}, { author: buyer.hash }); // Certify organicconst cert = FoodBlock.create("observe.certification", { standard: "organic", issuer: "Soil Association", valid_until: "2026-01-01",}, { subject: farm.hash, authority: inspector.hash }); // Direct messagingconst conversation = FoodBlock.create("observe.conversation", { title: "Order #4821",}, { participants: [buyer.hash, seller.hash] }); const message = FoodBlock.create("transfer.message", { content: "Is the sourdough still available?",}, { conversation: convo.hash, author: buyer.hash }); // Track a shipmentconst dispatch = FoodBlock.create("transfer.dispatch", { item: "Wheat flour - 500kg", status: "dispatched", vehicle: "LK71 ABX",}, { from: factory.hash, to: bakery.hash }); // hash = SHA-256(canonical(type + state + refs))// Append-only. Immutable. Content-addressed. Sovereign.import { FoodBlock } from "@foodx/sdk";import { createHash } from "crypto"; const client = new FoodBlock({ apiKey: process.env.FOODX_API_KEY, baseURL: "https://api.foodx.world/api/v1",}); // Create a product listingconst block = FoodBlock.create("substance.product", { name: "Organic Tomatoes", price: 350, currency: "GBP", organic: true, category: "vegetables",}, { seller: "a3f8c2d1e9b7a4f5c8d2e1b9a7f5c2d1" }); // Place an orderconst order = FoodBlock.create("transfer.order", { amount: 700, status: "pending", items: [{ product: block.hash, qty: 2 }],}, { from: buyer.hash, to: seller.hash }); // Leave a reviewconst review = FoodBlock.create("observe.review", { score: 4.8, text: "Best tomatoes in Kent — perfectly ripe, great flavour",}, { subject: block.hash, author: buyer.hash }); // POST a block to the networkawait fetch("/api/v1/foodblock", { method: "POST", headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json", }, body: JSON.stringify({ type, state, refs }),}); // Query the feedconst feed = await fetch("/api/v1/foodblock/feed?limit=20&lat=51.09&lng=-0.71");const { blocks, total, next_cursor } = await feed.json(); // Trace provenanceconst provenance = await fetch(`/api/v1/foodblock/${hash}/provenance`);const { chain } = await provenance.json(); // Register a sellerconst actor = FoodBlock.create("actor.seller", { name: "Kent Farm", type: "producer", status: "live", lat: 51.09, lng: -0.71, bio: "Family farm since 1987",}, { place: venue.hash }); // Share a recipeconst recipe = FoodBlock.create("transform.recipe", {
FOR DEVELOPERS

Build on the food graph

223 endpoints across 30 categories. MCP server, REST API, or SDK.

Developer Journey

From understanding the protocol to shipping in production

Foundation

Learn

Understand the protocol. Six base types, three fields, ten rules.

Interactive

Try

Playground, block explorer, guided onboarding. No signup required.

Reference

Build

223 endpoints, 5 SDKs, MCP server. Full API reference with code examples.

Operations

Ship

Dashboard, status page, changelog. Everything for production.

Start Building

Free sandbox. No credit card. 223 endpoints, 5 SDKs, and a playground — all ready.

API DocsPlaygroundPricingGitHub