Integracja Programistyczna REST API
Bezpośredni, wysokowydajny dostęp programistyczny do bazy ponad 1 900 produktów spożywczych, 780 przepisów, 53 000 substancji leczniczych i 2 000 ćwiczeń.
Krok 1: Wdrożenie, Rejestracja i Klucze API
Rozpocznij integrację z API Diets Premium w kilku prostych krokach. Wygeneruj klucz w panelu użytkownika lub przetestuj publiczny pakiet deweloperski.
Dostępny darmowy pakiet deweloperski 100 req/dzień. Zalogowane konta otrzymują automatycznie bonus +100 zapytań/dzień.
Zalogowani użytkownicy generują indywidualne klucze Bearer z pełnym dostępem do wyszukiwania semantycznego i zaawansowanych filtrów.
Klucze API przechowuj wyłącznie na serwerze w bezpiecznych zmiennych środowiskowych. Nigdy nie udostępniaj ich publicznie.
Krok 2: Połączenie Klienta HTTP i Przykłady Kodu
Wszystkie zapytania do REST API są realizowane metodą POST na dedykowane punkty końcowe z nagłówkiem Content-Type: application/json.
https://www.dietspremium.com/api/v1
curl -X POST "https://www.dietspremium.com/api/v1/food" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "salmon", "locale": "en", "max_results": 5, "ai": true}'
const response = await fetch("https://www.dietspremium.com/api/v1/food", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
query: "chicken breast",
locale: "en",
proteins_min: 25,
kcal_max: 300,
ai: true
})
});
const data = await response.json();
import requests
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"query": "spinach salad",
"locale": "en",
"food_nutrient_include": "iron",
"max_results": 10
}
response = requests.post("https://www.dietspremium.com/api/v1/food", json=payload, headers=headers)
print(response.json())
| Status Code | Meaning | Description |
|---|---|---|
| 200 OK | Success | Request processed successfully. Returns result array with total count and pagination. |
| 400 Bad Request | Invalid Payload | Missing required parameter or malformed JSON structure. |
| 401 Unauthorized | Invalid Token | Missing or invalid Bearer API key. |
| 429 Too Many Requests | Rate Limit Exceeded | Daily limit reached. Resets at midnight UTC. |
Krok 3: Punkty Końcowe i Przykłady Użycia (Alfabetycznie)
Kompletne przykłady zapytań i odpowiedzi dla 9 domen żywieniowo-medycznych, uszeregowanych alfabetycznie.
/api/v1/allergen
Allergen Search & Intolerance Detection
Access the comprehensive EU 1169/2011 allergens registry, cross-contamination warnings, and ingredient intolerance codes.
| Parameter | Type | Status | Default | Description |
|---|---|---|---|---|
| query | string | required | — | Allergen name or food derivative (e.g. "peanut", "histamine", "casein") |
| locale | string | optional | en | Language locale (en, pl, de, fr, nl, cz, at, ch, lu) |
| page | integer | optional | 1 | Pagination page index |
| ai | boolean | optional | true | Semantic AI query matching |
{
"query": "gluten",
"locale": "en",
"page": 1
}
{
"items": [
{"id": 1, "name": "Gluten-containing cereals", "code": "GLUTEN", "severity": "HIGH"}
],
"total": 1,
"page": 1
}
/api/v1/article
Article & Clinical Nutrition Guides
Search 6,000+ peer-reviewed nutrition articles, dietetic publications, and RAG grounding chapters with AI semantic vector matching.
| Parameter | Type | Status | Default | Description |
|---|---|---|---|---|
| query | string | required | — | Search term or medical inquiry (e.g. "insulin resistance diet") |
| locale | string | optional | en | Target language locale |
| ai | boolean | optional | true | Semantic AI search enabled |
| page | integer | optional | 1 | Pagination index |
{
"query": "insulin resistance diet",
"locale": "en",
"ai": true,
"page": 1
}
{
"items": [
{"id": 412, "title": "Insulin Resistance & Low GI Diets", "slug": "insulin-resistance-diet", "readingTime": 6}
],
"total": 12,
"page": 1
}
/api/v1/company
Company & Dietetic Catering Directory
Explore 173,000+ verified dietary catering brands, clinics, fitness clubs, and health centers with geolocation metadata.
| Parameter | Type | Status | Default | Description |
|---|---|---|---|---|
| query | string | required | — | Company name, specialty, or city (e.g. "keto catering Munich") |
| locale | string | optional | en | Target language locale |
| city | string | optional | — | City or geoname filter |
{
"query": "catering dietetyczny",
"locale": "pl",
"city": "Warszawa"
}
{
"items": [
{"id": 98, "name": "Premium Keto Catering", "city": "Warszawa", "rating": 4.9}
],
"total": 1
}
/api/v1/exercise
Exercise & Biomechanics Database
Search 2,000+ strength and cardio exercises with anatomical target muscles, required equipment, and calorie burn equations.
| Parameter | Type | Status | Default | Description |
|---|---|---|---|---|
| query | string | required | — | Exercise or muscle group (e.g. "dumbbell chest press", "quadriceps") |
| locale | string | optional | en | Target locale |
| ai | boolean | optional | true | AI semantic search |
{
"query": "barbell squat",
"locale": "en",
"ai": true
}
{
"items": [
{"id": 105, "name": "Barbell Back Squat", "muscle": "Quadriceps", "difficulty": "INTERMEDIATE"}
],
"total": 1
}
/api/v1/food
Food & Nutrient Database
High-speed search across 1,900+ foods with complete macronutrients, calorie filters, micronutrients, and allergen exclusions.
| Parameter | Type | Status | Default | Description |
|---|---|---|---|---|
| query | string | required | — | Food item or ingredient (e.g. "grilled chicken breast", "avocado") |
| locale | string | optional | en | Language locale |
| kcal_min / kcal_max | integer | optional | 0 | Calorie thresholds per 100g |
| proteins_min | integer | optional | 0 | Minimum protein content in grams |
| allergen_exclude | string | optional | — | Comma-separated allergens to exclude |
| food_nutrient_include | string | optional | — | Include specific micronutrient (e.g. "iron", "calcium") |
| ai | boolean | optional | true | AI semantic search |
{
"query": "chicken breast",
"locale": "en",
"proteins_min": 25,
"kcal_max": 250,
"allergen_exclude": "gluten,lactose",
"ai": true
}
{
"items": [
{"id": 12, "name": "Chicken Breast Raw", "kcal": 165, "proteins": 31.0, "fats": 3.6, "carbs": 0.0}
],
"total": 1
}
/api/v1/medication
Medication & Food-Drug Interactions
Database of 53,000+ pharmaceutical substances evaluating critical food-drug interactions, absorption interference, and nutrient depletion.
| Parameter | Type | Status | Default | Description |
|---|---|---|---|---|
| query | string | required | — | Pharmaceutical compound or brand name (e.g. "Levothyroxine", "Metformin") |
| locale | string | optional | en | Target locale |
{
"query": "Levothyroxine",
"locale": "en"
}
{
"items": [
{"id": 782, "name": "Levothyroxine Sodium", "interactions": ["Avoid calcium supplements within 4h", "Avoid coffee within 30m"]}
],
"total": 1
}
/api/v1/recipe
Recipe & Culinary Meal Database
Access 780+ chef-crafted culinary recipes with portion weights, preparation steps, and balanced macronutrient distribution.
| Parameter | Type | Status | Default | Description |
|---|---|---|---|---|
| query | string | required | — | Recipe phrase (e.g. "quick keto avocado salmon salad") |
| locale | string | optional | en | Target locale |
| ai | boolean | optional | true | AI semantic search |
{
"query": "keto salmon salad",
"locale": "en",
"ai": true
}
{
"items": [
{"id": 55, "title": "Avocado Salmon Keto Bowl", "kcal": 480, "proteins": 38.0, "fats": 32.0, "carbs": 8.0}
],
"total": 1
}
/api/v1/user
Specialist & Certified Dietitian Directory
Search verified clinical nutritionists, dietitians, and personal trainers with client booking and certification data.
| Parameter | Type | Status | Default | Description |
|---|---|---|---|---|
| query | string | required | — | Specialist specialty, city, or name (e.g. "clinical sports dietitian") |
| locale | string | optional | en | Target locale |
{
"query": "dietetyk kliniczny",
"locale": "pl"
}
{
"items": [
{"id": 14, "name": "dr Anna Nowak", "title": "Dietetyk Kliniczny", "verified": true}
],
"total": 1
}
/api/v1/supplement
Supplement & Active Substance Database
Comprehensive dietary supplement catalog with ingredient dosages, vitamin forms, and safety recommendations.
| Parameter | Type | Status | Default | Description |
|---|---|---|---|---|
| query | string | required | — | Supplement or active ingredient (e.g. "Omega 3 EPA DHA", "Creatine Monohydrate") |
| locale | string | optional | en | Target locale |
{
"query": "Creatine Monohydrate",
"locale": "en"
}
{
"items": [
{"id": 302, "name": "Creatine Monohydrate Creapure", "category": "Amino Acids", "standardDose": "5g/day"}
],
"total": 1
}
/api/v1/diet
Clinical & Lifestyle Diet Templates (158 Types)
Official nutritionist-designed diet templates with multi-currency pricing, day duration (3-28 days), macro splits, and allergen avoidance.
| Parameter | Type | Status | Default | Description |
|---|---|---|---|---|
| query | string | optional | — | Search keyword or condition (e.g. "keto", "cukrzyca") |
| diet_template_type | string|int | optional | — | Diet template type ID, find code, or localized name (e.g. "keto", "hashimoto", 4) |
| days | integer | optional | — | Duration in days (e.g. 7, 14, 21, 28) |
| avoid_allergens | array | optional | [] | Allergen find codes to strictly exclude (e.g. ["milk", "nuts"]) |
| kcal_min / kcal_max | integer | optional | 0 | Daily calorie bounds |
| currency | string | optional | locale default | Currency for pricing (PLN, EUR, USD, ALL) |
| locale | string | optional | en | Language locale (en, pl, de, etc.) |
| page | integer | optional | 1 | Pagination page index |
{
"diet_template_type": "keto",
"days": 28,
"avoid_allergens": ["milk"],
"currency": "ALL",
"locale": "pl"
}
{
"items": [
{
"id": 16,
"name": "Shape & Power 1800 kcal",
"days_count": 28,
"has_price": true,
"store": [
{"name": "Lidl"}
],
"price": {
"cost_per_day": 20.12,
"total_cost": 563.40,
"currency": "PLN",
"weekly_breakdown": {
"week_1": 164.32,
"week_2": 125.46,
"week_3": 129.41,
"week_4": 144.21
}
}
}
],
"total": 1,
"page": 1
}
/api/v1/food-world
Global Food Products & Barcodes (Open Food Facts + USDA)
Search 3.5M+ global branded products, EAN/UPC barcodes, brands, Nutri-Score, Eco-Score, and international ingredients.
| Parameter | Type | Status | Default | Description |
|---|---|---|---|---|
| query | string | optional | — | Product name or keywords (e.g. "Coca-Cola Zero", "Nutella") |
| barcode | string | optional | — | EAN-13 or UPC barcode string (e.g. "5449000000996") |
| brand | string | optional | — | Manufacturer / brand name (e.g. "Barilla", "Nestle") |
| locale | string | optional | en | Target language locale |
| currency | string | optional | locale default | Currency for pricing (EUR, PLN, USD, ALL) |
| page | integer | optional | 1 | Pagination page index |
{
"query": "barilla spaghetti",
"brand": "Barilla",
"locale": "pl",
"currency": "ALL"
}
{
"items": [
{
"id": 104291,
"name": "Spaghetti n.5",
"brand": "Barilla",
"barcode": "8076809513753",
"nutriscore_grade": "a",
"ecoscore_grade": "b",
"kcal": 359,
"proteins": 12.5,
"fats": 2.0,
"carbs": 70.9,
"has_price": true,
"price": {
"amount": 1.49,
"currency": "EUR"
}
}
],
"total": 1,
"page": 1
}
Pełna Specyfikacja OpenAPI 3.0 (Nelmio Bundle)
Interaktywny interfejs OpenAPI 3.0 (Nelmio API Doc) zawiera 100% schematów parametrów, definicji typów oraz interaktywną konsolę testową.