API v1
תיעוד API
השתמש ב-DishPic API כדי לשלב המרת תמונות מזון מקצועיות ישירות לאפליקציה שלך. כל הבקשות דורשות API Key שניתן ליצור בדף ההגדרות.
אימות
כל הבקשות ל-API דורשות header של Authorization עם ה-API Key שלך:
http
Authorization: Bearer dp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxניתן ליצור API Key חדש בדף ההגדרות. המפתח מוצג פעם אחת בלבד — שמור אותו במקום בטוח.
POST
/api/generateממיר תמונת מנה למקצועית. דורש קרדיט אחד לכל תמונה שנוצרת.
פרמטרים (JSON body)
| שדה | סוג | תיאור |
|---|---|---|
dishImageBase64* | string | תמונת המנה בקידוד Base64 (JPEG/PNG) |
presetId* | string | סגנון הצילום: "studio", "natural", "dark", "bright", "minimal" או ID של פריסט מותאם |
category | string | קטגוריית המנה: "main", "salad", "dessert", "drink", "starter" |
תגובה
json
{
"imageBase64": "iVBORw0KGgoAAAANSUhEUgA...",
"projectId": "550e8400-e29b-41d4-a716-446655440000",
"creditsRemaining": 42
}דוגמת cURL
curl
curl -X POST https://dishpic.co.il/api/generate \
-H "Authorization: Bearer dp_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"dishImageBase64": "/9j/4AAQSkZJRg...",
"presetId": "studio",
"category": "main"
}'GET
/api/galleryמחזיר את כל התמונות שנוצרו עבור המשתמש, ממוינות מהחדשה לישנה.
Query Parameters
| שדה | סוג | תיאור |
|---|---|---|
limit | number | מספר תמונות לדף (ברירת מחדל: 20, מקסימום: 100) |
offset | number | היסט לעמוד הבא (ברירת מחדל: 0) |
projectId | string | סנן לפי פרויקט ספציפי (אופציונלי) |
תגובה
json
{
"images": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"resultUrl": "https://kykwilrygdatujudlmew.supabase.co/storage/v1/object/public/images/...",
"originalUrl": "https://kykwilrygdatujudlmew.supabase.co/storage/v1/object/public/images/...",
"presetId": "studio",
"category": "main",
"createdAt": "2026-04-03T10:30:00Z"
}
],
"total": 127
}דוגמת cURL
curl
curl "https://dishpic.co.il/api/gallery?limit=10&offset=0" \
-H "Authorization: Bearer dp_your_api_key_here"GET
/api/custom-presetsמחזיר את כל הפריסטים המותאמים אישית שהעלית.
json
{
"presets": [
{
"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"name": "סגנון הבית",
"referenceImageUrl": "https://kykwilrygdatujudlmew.supabase.co/...",
"createdAt": "2026-04-01T08:00:00Z"
}
]
}Rate Limits
60
בקשות לדקה
לכל API Key
500
יצירת תמונות ליום
לחשבון
10MB
גודל תמונה מקסימלי
לבקשה
חריגה מהמגבלות תחזיר קוד שגיאה 429 Too Many Requests.
קודי שגיאה
| קוד HTTP | שגיאה | תיאור |
|---|---|---|
400 | Bad Request | פרמטר חסר או לא תקין |
401 | Unauthorized | API Key חסר או לא תקין |
402 | Payment Required | אין מספיק קרדיטים בחשבון |
429 | Too Many Requests | חרגת ממגבלת הבקשות |
500 | Internal Server Error | שגיאת שרת — נסה שוב |
json
// פורמט תגובת שגיאה
{
"error": "תיאור השגיאה כאן"
}דוגמאות קוד
TypeScript / Node.js
typescript
import fs from "fs";
const API_KEY = process.env.DISHPIC_API_KEY!;
const API_URL = "https://dishpic.co.il";
async function generateDishPhoto(imagePath: string) {
// Read image and convert to base64
const imageBuffer = fs.readFileSync(imagePath);
const imageBase64 = imageBuffer.toString("base64");
const response = await fetch(`${API_URL}/api/generate`, {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
dishImageBase64: imageBase64,
presetId: "studio",
category: "main",
}),
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.error);
}
const { imageBase64: resultBase64, creditsRemaining } = await response.json();
console.log(`Credits remaining: ${creditsRemaining}`);
// Save result
const resultBuffer = Buffer.from(resultBase64, "base64");
fs.writeFileSync("result.jpg", resultBuffer);
console.log("Saved to result.jpg");
}
generateDishPhoto("./dish.jpg").catch(console.error);Python
python
import base64
import requests
API_KEY = "dp_your_api_key_here"
API_URL = "https://dishpic.co.il"
def generate_dish_photo(image_path: str) -> bytes:
with open(image_path, "rb") as f:
image_base64 = base64.b64encode(f.read()).decode("utf-8")
response = requests.post(
f"{API_URL}/api/generate",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={
"dishImageBase64": image_base64,
"presetId": "studio",
"category": "main",
},
)
response.raise_for_status()
data = response.json()
print(f"Credits remaining: {data['creditsRemaining']}")
return base64.b64decode(data["imageBase64"])
result = generate_dish_photo("dish.jpg")
with open("result.jpg", "wb") as f:
f.write(result)
print("Saved to result.jpg")