REST API · v1

תיעוד ה-API של MakeFav

צרו חבילות favicon שלמות מהקוד שלכם, מסקריפטי בנייה ומצינורות CI. בקשה אחת הופכת כל תמונה ל-favicon.ico, אייקוני Apple touch, אייקונים ל-Android ול-PWA, web manifest וקוד HTML מוכן להדבקה.

בעמוד זה

התחלה מהירה

ה-API של MakeFav הוא REST API פשוט מבוסס HTTPS ו-JSON. כל נקודות הקצה נמצאות תחת כתובת בסיס אחת:

https://makefav.com/api/v1
  1. יצירת חשבון חינמי
    הירשמו, אשרו את כתובת האימייל שלכם והשאירו את המנוי לניוזלטר של MakeFav פעיל – זהו התנאי היחיד לתוכנית החינמית.
  2. יצירת מפתח API
    פתחו את עמוד מפתחות ה-API בחשבון שלכם וצרו מפתח אישי. הוא מתחיל ב-mf_ ומוצג פעם אחת בלבד, לכן שמרו אותו במקום מאובטח. ניהול מפתחות API
  3. שליחת הבקשה הראשונה
    העלו תמונה לנקודת הקצה generate ושמרו את קובץ ה-ZIP שיוחזר:
curl --fail-with-body -sS https://makefav.com/api/v1/generate \
  -H "Authorization: Bearer $MAKEFAV_API_KEY" \
  -F "[email protected]" \
  -F "app_name=My App" \
  -F "theme_color=#2f9e68" \
  -F "radius=20" \
  -o favicons.zip

Unzip favicons.zip, upload the files to your website and paste the HTML code from the end of readme-makefav.txt into the <head> of every page.

אימות

כל בקשה לנקודת קצה מוגנת חייבת לכלול מפתח API אישי. אפשר ליצור מפתחות, לתת להם שמות ולבטל אותם בכל עת בעמוד החשבון שלכם: מפתחות API

Send the key as a bearer token in the Authorization header, or – if your HTTP client makes that awkward – in the X-API-Key header. Both are equivalent.

Authorization: Bearer mf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# or, alternatively
X-API-Key: mf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
מפתחות שייכים למשתמש שכתובת האימייל שלו אושרה והמנוי שלו לניוזלטר פעיל (תנאי התוכנית החינמית). אם האימייל לא אושר, הניוזלטר בוטל או החשבון נחסם, כל בקשה תחזיר 403 Forbidden.
התייחסו למפתחות API כמו לסיסמאות: שמרו אותם בשרת או בסודות של CI, ולעולם לא בקוד שרץ בדפדפן, באפליקציות לנייד או במאגרים ציבוריים. אם מפתח דלף, בטלו אותו מיד.

Missing or invalid keys return 401 Unauthorized. The GET /sizes and GET /openapi.json endpoints do not require a key.

מגבלות קצב

כברירת מחדל, כל מפתח API יכול לבצע 100 בקשות לשעה. כל תגובה מאומתת מראה לכם מה מצבכם:

כותרתתיאור
X-RateLimit-Limitמספר הבקשות המרבי המותר בחלון הנוכחי.
X-RateLimit-Remainingבקשות שנותרו בחלון הנוכחי.
X-RateLimit-Resetחותמת זמן Unix (בשניות, UTC) שבה החלון מתאפס.
HTTP/1.1 200 OK
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 97
X-RateLimit-Reset: 1767225600

When the limit is exceeded the API responds with HTTP 429 and the error code rate_limited. Wait until the time in X-RateLimit-Reset before retrying – do not retry in a tight loop.

HTTP/1.1 429 Too Many Requests
Content-Type: application/json
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1767225600

{"error": {"code": "rate_limited", "message": "Rate limit exceeded. Try again after the reset time."}}

You can check your current quota at any time with GET /me.

נקודות קצה

נקודת קצהאימותתיאור
POST /generateמפתח APIיצירת חבילת favicon שלמה.
GET /meמפתח APIהחשבון שלכם ומצב מגבלת הקצב הנוכחי.
GET /sizesללארשימה של כל קבצי האייקונים והגדלים שהמחולל מייצר.
GET /openapi.jsonללאמפרט OpenAPI 3.1 קריא למכונה.

יצירת חבילת favicon

POST/generate

יוצר חבילת favicon שלמה מתמונת מקור אחת. ניתן לשלוח את התמונה באחת משלוש דרכים:

סוג תוכןשדה התמונהתיאור
multipart/form-dataimageהעלאת קובץ. מומלץ – האפשרות היעילה ביותר.
application/jsonimage_base64Base64-encoded image, either raw base64 or a data URL such as data:image/png;base64,iVBOR….
application/jsonimage_urlכתובת http או https ציבורית של התמונה. השרת מוריד אותה (עד 10MB).

פורמטי קלט נתמכים: PNG, JPG, WebP, AVIF, GIF, BMP, SVG ו-ICO. גודל קובץ מרבי: 10MB.

פרמטרים

כל הפרמטרים אופציונליים. שלחו אותם כשדות טופס (multipart) או כמאפייני JSON. ערכים לא תקינים יוחלפו בברירת המחדל.

שםסוג / טווחברירת מחדלתיאור
app_nameמחרוזת, עד 60 תוויםMy Websiteשם האתר או האפליקציה שלכם, משמש ב-manifest.json ובדף הדוגמה.
short_nameמחרוזת, עד 24 תווים12 התווים הראשונים של app_nameשם קצר שמוצג מתחת לאייקון במסכי הבית של Android.
theme_color#rrggbb#ffffffצבע ממשק הדפדפן (תגית meta מסוג theme-color וה-manifest).
tile_color#rrggbbזהה ל-theme_colorצבע הרקע של אריחי Start ב-Windows.
backgroundtransparent | #rrggbbtransparentרקע של אייקוני הדפדפן, Android ו-Windows.
apple_background#rrggbb#ffffffרקע של אייקוני Apple touch והאייקון ה-maskable (iOS אינו תומך בשקיפות). מתעלמים מהערך כאשר background הוא צבע – במקרה כזה נעשה שימוש בצבע הזה.
paddingמספר שלם, 0–40 (%)0שטח ריק סביב התמונה, באחוזים מגודל האייקון.
radiusמספר שלם, 0–50 (%)0פינות מעוגלות. 50 יוצר עיגול. לא חל על אייקוני Apple, ש-iOS מעגל בעצמו.
zoomמספר שלם, 50–400 (%)100קנה המידה של התמונה בתוך האייקון. ערכים מעל 100 חותכים את התמונה.
offset_x, offset_yמספר, מ-1- עד 10מזיז את התמונה אופקית / אנכית, כחלק מגודל האייקון.
pathמחרוזת/התיקייה בשרת שלכם שבה יישמרו האייקונים. משמשת בקטע ה-HTML, ב-manifest וב-browserconfig.
displaystandalone | fullscreen | minimal-ui | browserstandaloneמצב התצוגה של PWA שנכתב ל-manifest.
pixelatedauto | 1 | 0autoשינוי גודל חד בשיטת השכן הקרוב ביותר עבור פיקסל ארט. הערך auto מפעיל אותו עבור מקורות של 64 פיקסלים ומטה.
maskable1 | 01יוצר גם את maskable-icon-512x512.png עם ריפוד של אזור בטוח עבור אייקונים אדפטיביים ב-Android.
ico_sizesרשימה מופרדת בפסיקים של 16, 24, 32, 48, 64, 128, 25616,32,48הגדלים המוטמעים בקובץ favicon.ico.
groupsרשימה מופרדת בפסיקים של favicon, apple, android, msfavicon,apple,android,msערכות האייקונים ליצירה: favicons לדפדפנים, אייקוני Apple touch, אייקוני Android / PWA ואריחי Windows.
formatzip | jsonzipפורמט התגובה – ראו להלן.

תגובה

format=zip
Binary ZIP archive with Content-Type: application/zip and Content-Disposition: attachment. Default.
format=json
JSON object with the package id (32 hex characters), the html snippet for your <head> and a files array; each file has name, mime, size (bytes) and base64 contents.

דוגמה לבקשה – multipart, תגובת ZIP

curl --fail-with-body -sS https://makefav.com/api/v1/generate \
  -H "Authorization: Bearer $MAKEFAV_API_KEY" \
  -F "[email protected]" \
  -F "app_name=My App" \
  -F "theme_color=#2f9e68" \
  -F "radius=20" \
  -o favicons.zip
HTTP/1.1 200 OK
Content-Type: application/zip
Content-Disposition: attachment
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 99
X-RateLimit-Reset: 1767225600

<binary ZIP data>

דוגמה לבקשה – JSON עם כתובת URL של תמונה, תגובת JSON

curl --fail-with-body -sS https://makefav.com/api/v1/generate \
  -H "Authorization: Bearer $MAKEFAV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image_url": "https://example.com/logo.png",
    "app_name": "My App",
    "theme_color": "#2f9e68",
    "radius": 20,
    "groups": "favicon,apple,android",
    "format": "json"
  }'
{
  "id": "9f86d081884c7d659a2feaa0c55ad015",
  "html": "<link rel=\"apple-touch-icon\" sizes=\"57x57\" href=\"/apple-icon-57x57.png\">\n…\n<meta name=\"theme-color\" content=\"#2f9e68\">",
  "files": [
    {"name": "favicon.ico", "mime": "image/x-icon", "size": 15086, "base64": "AAABAAMAEBAAAAEAIABoBAAANgAAACAg…"},
    {"name": "favicon-16x16.png", "mime": "image/png", "size": 612, "base64": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQ…"},
    {"name": "manifest.json", "mime": "application/json", "size": 1094, "base64": "ewogICAgIm5hbWUiOiAiTXkgQXBwIiwK…"}
  ]
}

קבלת פרטי החשבון שלך

GET/me

מחזיר את המשתמש שאליו שייך מפתח ה-API ואת מצב מגבלת הקצב הנוכחי. שימושי לאימות מפתח. דורש אימות; ללא פרמטרים.

דוגמה לבקשה

curl -sS https://makefav.com/api/v1/me \
  -H "Authorization: Bearer $MAKEFAV_API_KEY"

דוגמה לתגובה

{
  "id": 1,
  "email": "[email protected]",
  "name": "Jane Doe",
  "rate_limit": {"limit": 100, "remaining": 97, "reset": 1767225600}
}

רשימת גדלי אייקונים

GET/sizes

Returns every icon file the generator can produce, with its pixel size and group. No authentication and no parameters. The group value matches the groups parameter of POST /generate.

דוגמה לבקשה

curl -sS https://makefav.com/api/v1/sizes

דוגמה לתגובה

{
  "files": [
    {"name": "favicon-16x16.png", "size": 16, "group": "favicon"},
    {"name": "favicon-32x32.png", "size": 32, "group": "favicon"},
    {"name": "apple-touch-icon.png", "size": 180, "group": "apple"},
    {"name": "android-icon-192x192.png", "size": 192, "group": "android"},
    {"name": "ms-icon-144x144.png", "size": 144, "group": "ms"}
  ]
}

מפרט OpenAPI

GET/openapi.json

מחזיר את תיאור ה-OpenAPI 3.1 של ה-API הזה. ללא אימות. ניתן לייבא אותו ל-Postman, Insomnia או Swagger UI, או להשתמש בו ליצירת לקוח מוטמע-טיפוסים לשפה שלכם.

curl -sS https://makefav.com/api/v1/openapi.json -o makefav-openapi.json

שגיאות

Successful requests return HTTP 200. Every error returns a JSON body with a stable, machine-readable code and a human-readable message. Always branch on the code, not on the message text.

HTTP/1.1 422 Unprocessable Content
Content-Type: application/json

{
  "error": {
    "code": "invalid_image",
    "message": "The uploaded file could not be decoded as an image."
  }
}
סטטוס HTTPקוד שגיאהמשמעות
400bad_requestהבקשה שגויה, למשל לא נשלחה תמונה או שגוף ה-JSON אינו תקין.
401unauthorizedמפתח ה-API חסר או לא תקין.
403forbiddenהאימייל של בעל המפתח לא אומת, ההרשמה לניוזלטר מושבתת, או שהחשבון נחסם.
413file_too_largeהתמונה גדולה מ-10MB.
415unsupported_typeסוג הקובץ או סוג התוכן של הבקשה אינם נתמכים.
422invalid_imageלא ניתן היה לפענח את הקובץ כתמונה, או שלא ניתן היה להוריד את כתובת ה-URL של התמונה.
429rate_limitedיותר מדי בקשות. המתינו עד X-RateLimit-Reset.
500server_errorמשהו השתבש מצידנו. נסו שוב מאוחר יותר; אם הבעיה נמשכת, פנו לתמיכה.

קבצי פלט

With all groups enabled, a package contains the files below. Files from disabled groups are left out.

קובץגודלקבוצה
favicon.ico16, 32, 48 (ניתן להגדרה)תמיד
favicon-16x16.png16 × 16favicon
favicon-32x32.png32 × 32favicon
favicon-96x96.png96 × 96favicon
apple-icon-57x57.png57 × 57apple
apple-icon-60x60.png60 × 60apple
apple-icon-72x72.png72 × 72apple
apple-icon-76x76.png76 × 76apple
apple-icon-114x114.png114 × 114apple
apple-icon-120x120.png120 × 120apple
apple-icon-144x144.png144 × 144apple
apple-icon-152x152.png152 × 152apple
apple-icon-180x180.png180 × 180apple
apple-icon.png192 × 192apple
apple-icon-precomposed.png192 × 192apple
apple-touch-icon.png180 × 180apple
android-icon-36x36.png36 × 36android
android-icon-48x48.png48 × 48android
android-icon-72x72.png72 × 72android
android-icon-96x96.png96 × 96android
android-icon-144x144.png144 × 144android
android-icon-192x192.png192 × 192android
android-icon-512x512.png512 × 512android
web-app-manifest-192x192.png192 × 192android
web-app-manifest-512x512.png512 × 512android
maskable-icon-512x512.png512 × 512android
ms-icon-70x70.png70 × 70ms
ms-icon-144x144.png144 × 144ms
ms-icon-150x150.png150 × 150ms
ms-icon-310x310.png310 × 310ms

קבצים נוספים

קובץכלולתיאור
favicon.svgרק עבור קלט SVG ללא חיתוך, זום, ריווח, פינות או רקעעותק מנוקה של ה-SVG שלכם לדפדפנים שתומכים ב-favicon וקטורי.
manifest.json, site.webmanifestandroidWeb app manifest עבור Android ו-PWA הניתנות להתקנה (שני עותקים זהים).
browserconfig.xmlmsהגדרות אריח Windows עם צבע האריח שלכם.
readme-makefav.txtתמידהוראות התקנה עם קוד ה-HTML עבור ה-<head> שלכם בסוף.

דוגמאות קוד

Each example uploads logo.png with a few options and saves favicons.zip, handling API errors. Set the environment variable MAKEFAV_API_KEY to your API key first.

העלאת Multipart:

# Multipart upload (recommended). --fail-with-body exits non-zero on HTTP errors
# and still saves the JSON error body, so you can inspect it.
curl --fail-with-body -sS https://makefav.com/api/v1/generate \
  -H "Authorization: Bearer $MAKEFAV_API_KEY" \
  -F "[email protected]" \
  -F "app_name=My App" \
  -F "theme_color=#2f9e68" \
  -F "radius=20" \
  -o favicons.zip \
  || { echo "Request failed:"; cat favicons.zip; rm -f favicons.zip; exit 1; }

גוף JSON עם תמונה בקידוד base64 (דורש jq):

# JSON body with a base64-encoded image (built with jq to avoid argument length limits)
base64 < logo.png | tr -d '\n' > logo.b64
jq -n --rawfile img logo.b64 \
  '{image_base64: $img, app_name: "My App", theme_color: "#2f9e68", radius: 20}' \
| curl --fail-with-body -sS https://makefav.com/api/v1/generate \
    -H "Authorization: Bearer $MAKEFAV_API_KEY" \
    -H "Content-Type: application/json" \
    --data-binary @- \
    -o favicons.zip \
  || { echo "Request failed:"; cat favicons.zip; rm -f favicons.zip; exit 1; }

שימוש ב-HTML

Upload all files to the folder you set with path, then paste the snippet into the <head> of every page. It is included at the end of readme-makefav.txt in the package and, with format=json, returned in the html field. Example for the options used in the code examples above:

<head>
  <meta charset="utf-8">
  <title>My App</title>

  <link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
  <link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
  <link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
  <link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
  <link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
  <link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
  <link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
  <link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
  <link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
  <link rel="icon" href="/favicon.ico" sizes="any">
  <link rel="manifest" href="/manifest.json">
  <meta name="msapplication-TileColor" content="#2f9e68">
  <meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
  <meta name="msapplication-config" content="/browserconfig.xml">
  <meta name="theme-color" content="#2f9e68">
</head>

לאחר הפריסה, נקו את המטמון של הדפדפן או פתחו את האתר בחלון פרטי – דפדפנים שומרים favicons במטמון בעקשנות.

יומן שינויים

v1

  • הגרסה הציבורית הראשונה של MakeFav REST API.
  • Endpoints POST /generate, GET /me, GET /sizes and GET /openapi.json.
  • פורמטי תגובה ZIP ו-JSON, וקלט תמונה בשיטות multipart, base64 וכתובת URL.
  • מפתחות API אישיים עם 100 בקשות לשעה.

גרסה 1 יציבה: אנו מוסיפים רק פרמטרים ושדות אופציונליים. שינויים שוברי תאימות ישוחררו כגרסה חדשה בהודעה מראש.

תמיכה

שאלות, דיווחי באגים או צורך במגבלת קצב גבוהה יותר? נשמח לעזור. אנא צרפו להודעה את זמן הבקשה ואת קוד השגיאה – לעולם לא את מפתח ה-API שלכם.